[RFC 2.6] Rework memory allocation in i2c chip drivers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Apr 04, 2004 at 12:20:42AM +0400, Sergey Vlasov wrote:
> Hello!
> 
> > Some times ago, Ralf Roesch reported that the memory allocation scheme
> > used in the i2c eeprom driver was causing trouble on MIPS architecture:
> > 
> > http://archives.andrew.net.au/lm-sensors/msg07233.html
> > 
> > The cause of the problems is that we do allocate two structures with a
> > single kmalloc, which breaks alignment. This doesn't seem to be a
> > problem on x86, but is on mips and probably on other architectures as
> > well. It happens that all other chip drivers work the same way too, so
> > they all would need to be fixed.
> 
> Instead of splitting one kmalloc in two, it would also be possible to
> add a "struct i2c_client client" field to each of the *_data
> structures - the compiler should align all fields appropriately.
> Probably this way will result in less changes to the code (and also
> less labels and less error paths).
> 
> Example patch for lm75 (untested):

I like this version a lot better.  It's simpler and if we do this, we
can easily switch to the proper refcount handling of the i2c_client
structures like we should do in 2.7.

Jean, care to redo your patch in this form?

thanks,

greg k-h



[Index of Archives]     [Linux Kernel]     [Linux Hardware Monitoring]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux