Re: [PATCH v2 1/2] iio: accel: fxls8962af: Fix temperature calculation

From: Jonathan Cameron
Date: Sun May 04 2025 - 11:47:09 EST


On Fri, 2 May 2025 17:19:44 +0300
Andy Shevchenko <andy.shevchenko@xxxxxxxxx> wrote:

> On Fri, May 2, 2025 at 9:15 AM Sean Nyekjaer <sean@xxxxxxxxxx> wrote:
> >
> > According to spec temperature should be returned in milli degrees Celsius.
> > Add in_temp_scale to calculate from Celsius to milli Celsius.
>
> ...
>
> > +/* Raw temp channel scale */
> > +#define FXLS8962AF_TEMP_SCALE 1000
>
> Wouldn't constants from units.h be helpful here?

Whilst you are just continuing local style, I'm not sure
these defines really bring much at all given the TEMP_SCALE
one for instance is only used in one place which is
explicitly getting the temperature scale. It's not a magic
number that needs a define. It's a number that means it's own
value :)

Using MILLI there would be a nice bit of self documentation
though.
>
> > #define FXLS8962AF_AUTO_SUSPEND_DELAY_MS 2000
>
> (2 * MSEC_PER_SEC)
>
> This gives immediately that we want 2 seconds of delay.
>
True but not part of this patch so that would be a nice
little follow up. Possibly dropping this define in favour
of using that inline.

Jonathan