[lm-sensors] [PATCH 6/8] hwmon: add max1111/max1110 Low-power Multichannel Serial 8-bit ADCs

Russell King - ARM Linux linux at arm.linux.org.uk
Tue Sep 23 09:23:25 CEST 2008

On Tue, Sep 23, 2008 at 09:31:09AM +0800, Eric Miao wrote:
> > Allocating such small buffers using kmalloc seems pretty inefficient.
> > At the very least, I would allocate both buffers at once. But quite
> > frankly I don't get why you don't just make these buffers part of
> > struct max1111_data. This would even make the structure smaller!
> >
> I originally place the buffer within "struct max1111_data" but received
> a mail from David Brownell suggesting using a kmalloc() buffer, so that
> DMA mode will work better with the cache alignment and trailing bytes,
> though PIO can just work happily. I don't know the specific reason for
> this, honestly.

Having cachelines overlap with other data which may be modified during
the DMA causes problems on non-cache coherent hardware.  It's much
safer to ensure that DMA buffers don't share cache lines with anything

More information about the lm-sensors mailing list