[PATCHv4 2/9] i2c: mv64xxx: make the registers offset configurable

Maxime Ripard maxime.ripard at free-electrons.com
Wed Jun 12 11:17:18 EDT 2013


On Wed, Jun 12, 2013 at 03:51:39PM +0100, Russell King - ARM Linux wrote:
> On Wed, Jun 12, 2013 at 04:44:47PM +0200, Maxime Ripard wrote:
> > Hi Russel,
> > 
> > On Wed, Jun 12, 2013 at 02:57:35PM +0100, Russell King - ARM Linux wrote:
> > > It'd be much better to copy the offsets themselves in drv_data.  You're
> > > only talking about 7 bytes here, so there's no worry about bloating the
> > > drv_data structure.
> > 
> > It was more about keeping things separated. Moreover, the probe
> > function gets smaller, since you have only a pointer to pass on, instead
> > of assigning those 7 bytes.
> 
> 	struct driver_data {
> 		struct mv64xxx_i2c_regs reg_offsets;
> 	};
> 
> 	struct driver_data *drv_data;
> 
> 	memcpy(drv_data->reg_offsets, reg_offsets, sizeof(drv_data->reg_offsets));
> 
> No need to write it each member as a separate assignment.

Ah right. I previously understood that you wanted a single variable for
each register in the driver data structure.

I'll do like you suggested.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com



More information about the linux-arm-kernel mailing list