Re: [PATCH v1 01/12] iio: accel: adxl345: migrate constants to core

From: Jonathan Cameron
Date: Tue Feb 04 2025 - 09:47:10 EST


On Tue, 4 Feb 2025 15:13:34 +0100
Lothar Rubusch <l.rubusch@xxxxxxxxx> wrote:

> Hi Jonathan,
>
> On Sat, Feb 1, 2025 at 5:36 PM Jonathan Cameron <jic23@xxxxxxxxxx> wrote:
> >
> > On Tue, 28 Jan 2025 12:00:49 +0000
> > Lothar Rubusch <l.rubusch@xxxxxxxxx> wrote:
> >
> > > The set of constants does not need to be exposed. Move constants to core
> > > to reduce namespace polution.
> > >
> > > Signed-off-by: Lothar Rubusch <l.rubusch@xxxxxxxxx>
> > Hi Lothar,
> >
> >
> > > -#define ADXL345_REG_INT_MAP 0x2F
> > > -#define ADXL345_REG_INT_SOURCE 0x30
> > > -#define ADXL345_REG_INT_SOURCE_MSK 0xFF
> > > #define ADXL345_REG_DATA_FORMAT 0x31
> >
> > Normally I'd be entirely in favour of this, but...
> > I'm not sure we want to leave one random register here
> > and move the rest.
> >
> > Se can move the stuff that isn't register related, but
> > for the registers I'd prefer to keep them in one place
> > and I can't see a clean way to move them all to the core.c
> > file. Even separating reg address and fields within it
> > makes for a harder check against a datasheet etc.
> >
> > So I think all we can move is the fifo size :(
> >
>
> I understood that it could be one of the first follow up patches to move those
> defines (parts of them?) over to core, as here in this mail:
> https://lore.kernel.org/linux-iio/20241214123926.0b42ea59@jic23-huawei/
> Anyway, I already had presented moving the constants before, when you
> had decided to keep them in the header. I thought you changed your mind
> on that, but I don't want to bother you with the same issue over and over
> again, probably I missunderstood that here.

I'd failed to realize we had to leave one behind :(

Sorry for the misdirection!

Jonathan
>
> I leave the constants in the .h file then, no problem. :) I can understand the
> intention to keep the things rather together in one place. There seem to be
> pros & cons for both.
>
> >
> > > -#define ADXL345_REG_XYZ_BASE 0x32
> > > -#define ADXL345_REG_DATA_AXIS(index) \
> > > - (ADXL345_REG_XYZ_BASE + (index) * sizeof(__le16))
> >
>