RE: [PATCH v2 2/2] iio: imu: smi240: imu driver

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

 



> Hi Christophe,
> 
> ....
>> +
>> +	data = iio_priv(indio_dev);
>> +	dev_set_drvdata(dev, indio_dev);
>> +	data->regmap = regmap;
>> +	data->capture = 0;
> 
> No need to explicitly initialize 'capture', devm_iio_device_alloc() already zeroes the allocated emmory.
> It doesn't hurt to be explicit, but why this field and not the other ones?
> 
> -> This is the flag to enable capture mode. It is important to be disabled by default, therefore rather make this explicitly.

It's redundant.

-> We would like not to make our important sensor logic dependent on the underlying infrastructure behavior. Otherwise if the new version does not zero the allocated memory  (although this is very unlikely to happen), the driver won't work , and it is difficult to find the root cause. To explicitly set the initial value, makes the driver more robust.

Anyway, it's not suppose to be uint8 anyway, but bool or enum.

->We will choose the best datatype.


Best regards,
Krzysztof





[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux