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

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

 



>
> Code looks reasonable, so you get my:
>
> Acked-by: Jean Delvare <khali at linux-fr.org>

Thanks.

>
> However, please read my few suggestions below to make the driver even
> better.
>> +
>> +     data->rx_buf = kmalloc(MAX1111_RX_BUF_SIZE, GFP_KERNEL);
>> +     if (!data->rx_buf) {
>> +             kfree(data->tx_buf);
>> +             return -ENOMEM;
>> +     }
>
> 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.




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

  Powered by Linux