RE: [PATCH 2/2] iio: temperature: ltc2983: Add support for ADT7604
From: Stan, Liviu
Date: Tue May 12 2026 - 03:13:35 EST
On Mon, Apr 27, 2026 Andy Shevchenko wrote:
...
> > #define LTC2983_CHAN_START_ADDR(chan) \
> > (((chan - 1) * 4) +
> LTC2983_CHAN_ASSIGN_START_REG)
> > -#define LTC2983_CHAN_RES_ADDR(chan) \
> > - (((chan - 1) * 4) + LTC2983_TEMP_RES_START_REG)
> > +#define LTC2983_CHAN_RES_ADDR(chan, base) \
> > + ((((chan) - 1) * 4) + (base))
>
> For the sake of consistency I would see (base) also to be in the _START_ADDR()
> macro.
I said I would change this in v2, but on second look, I think it would be better
to keep LTC2983_CHAN_START_ADDR without a (base) parameter. The base
parameter in LTC2983_CHAN_RES_ADDR exists because the ADT7604 adds a
second result register bank, so the base genuinely varies. For channel assignment
there is only one bank, so adding a base parameter would make the macro look
configurable when it isn't and force callers to always pass
LTC2983_CHAN_ASSIGN_START_REG. Happy to change if you still prefer
consistency.
Thanks,
Liviu