Re: [PATCH v1 2/2] iio: temperature: ltc2983: Make use of device properties

From: Andy Shevchenko
Date: Mon Feb 07 2022 - 04:29:30 EST


On Sun, Feb 06, 2022 at 12:51:00PM +0000, Sa, Nuno wrote:
> > From: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
> > Sent: Saturday, February 5, 2022 7:24 PM
> > On Sat, Feb 05, 2022 at 05:14:54PM +0000, Jonathan Cameron wrote:
> > > On Thu, 3 Feb 2022 13:45:06 +0200
> > > Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:

...

> > > > +#include <asm/byteorder.h>
> > > > +#include <asm/unaligned.h>
> >
> > > This may well be a valid addition but it's not called out in the patch
> > > description.
> >
> > This is a side effect of the change. Below I will try to explain, tell me if
> > that is what you want to be added to the commit message (feel free to
> > correct
> > my English).
> >
> > The conversion slightly changes the logic behind property reading for
> > the
> > configuration values. Original code allocates just as much memory as
> > needed.
> > Then for each separate 32- or 64-bit value it reads it from the property
> > and converts to a raw one which will be fed to the sensor. In the new
> > code
> > we allocated the amount of memory needed to retrieve all values at
> > once from
> > the property and then convert them as required.
>
> Yeah, I understood what you are doing... We allocate some extra bytes so
> that we can simplify a lot the logic to get, convert and put back the properties
> in the table... And since we are only writing the __real__ table size into the device
> I'm fairly positive this works. However, I do agree with Jonathan and I would
> be more confident to give this a test before being applied...
>
> That said, I'm off till the end of the month (just doing minor stuff like replying
> to emails :)), so if we can hold this one, I will test it first thing I'm back in the
> office.

Will wait for your testing. Meanwhile I address all other comments and send v3
for further review.

--
With Best Regards,
Andy Shevchenko