On Tue, 21 Mar 2023 17:34:15 +0100 Mehdi Djait <mehdi.djait.k@xxxxxxxxx> wrote: > Hello Jonathan, > > On Sun, Mar 19, 2023 at 04:22:07PM +0000, Jonathan Cameron wrote: > > On Fri, 17 Mar 2023 00:48:37 +0100 > > Mehdi Djait <mehdi.djait.k@xxxxxxxxx> wrote: > > > > > Add support for the basic accelerometer features such as getting the > > > acceleration data via IIO. (raw reads, triggered buffer [data-ready] or > > > using the WMI IRQ). > > > > > > Datasheet: https://kionixfs.azureedge.net/en/document/KX132-1211-Technical-Reference-Manual-Rev-5.0.pdf > > > Signed-off-by: Mehdi Djait <mehdi.djait.k@xxxxxxxxx> > > > > Nothing much specific to this patch, most changes will be as a result > > of bringing this inline with the changes suggested for patch 2. > > > > thanks, > > > > Jonathan > > > > > > diff --git a/drivers/iio/accel/kionix-kx022a.h b/drivers/iio/accel/kionix-kx022a.h > > > index 3bb40e9f5613..7e43bdb37156 100644 > > > --- a/drivers/iio/accel/kionix-kx022a.h > > > +++ b/drivers/iio/accel/kionix-kx022a.h > > > @@ -90,8 +90,61 @@ > > > #define KX022A_REG_SELF_TEST 0x60 > > > #define KX022A_MAX_REGISTER 0x60 > > > > > > + > > > > Push these down into the c file. > > Do you mean all REG and MASK defines ? > Even kx022a defines them in the h file, or am I misunderstanding your > comment ? Hmm. Generally we only put reg defines in a header if they are accessed from multiple c files. Otherwise it's both noise and more code that has to be parsed when compiling (even if it's all unused / ignored). I'm fine with this patch set just continuing with local style given they are already there, but if you fancy moving the existing ones down to the C file as a precursor patch, then even better! > > > > > > +#define KX132_REG_WHO 0x13 > > > +#define KX132_ID 0x3d > > > + > > > +#define KX132_FIFO_LENGTH 86 > > > + > > > +#define KX132_REG_CNTL2 0x1c > > > +#define KX132_REG_CNTL 0x1b > > > +#define KX132_MASK_RES BIT(6) > > > +#define KX132_GSEL_2 0x0 > > > +#define KX132_GSEL_4 BIT(3) > > > +#define KX132_GSEL_8 BIT(4) > > > +#define KX132_GSEL_16 GENMASK(4, 3) > > > + > > > +#define KX132_REG_INS2 0x17 > > > +#define KX132_MASK_INS2_WMI BIT(5) > > > + > > > +#define KX132_REG_XADP_L 0x02 > > > +#define KX132_REG_XOUT_L 0x08 > > > +#define KX132_REG_YOUT_L 0x0a > > > +#define KX132_REG_ZOUT_L 0x0c > > > +#define KX132_REG_COTR 0x12 > > > +#define KX132_REG_TSCP 0x14 > > > +#define KX132_REG_INT_REL 0x1a > > > + > > > +#define KX132_REG_ODCNTL 0x21 > > > + > > > +#define KX132_REG_BTS_WUF_TH 0x4a > > > +#define KX132_REG_MAN_WAKE 0x4d > > > + > > > +#define KX132_REG_BUF_CNTL1 0x5e > > > +#define KX132_REG_BUF_CNTL2 0x5f > > > +#define KX132_REG_BUF_STATUS_1 0x60 > > > +#define KX132_REG_BUF_STATUS_2 0x61 > > > +#define KX132_MASK_BUF_SMP_LVL GENMASK(9, 0) > > > +#define KX132_REG_BUF_CLEAR 0x62 > > > +#define KX132_REG_BUF_READ 0x63 > > > +#define KX132_ODR_SHIFT 3 > > > +#define KX132_FIFO_MAX_WMI_TH 86 > > > + > > > +#define KX132_REG_INC1 0x22 > > > +#define KX132_REG_INC5 0x26 > > > +#define KX132_REG_INC6 0x27 > > > +#define KX132_IPOL_LOW 0 > > > +#define KX132_IPOL_HIGH KX_MASK_IPOL > > > +#define KX132_ITYP_PULSE KX_MASK_ITYP > > > + > > > +#define KX132_REG_INC4 0x25 > > > + > > > +#define KX132_REG_SELF_TEST 0x5d > > > +#define KX132_MAX_REGISTER 0x76 > > > + > > > enum kx022a_device_type { > > > KX022A, > > > + KX132, > > As mentioned in previous review, I think this would be neater > > done by just exporting the chip_info structures directly rather than > > putting them in an array. > > I gave the reason in a response to the previous review. If you strongly prefer the enum indexing array that's fine, but definitely don't use the enum for the data in the tables - that should be the pointer to the particular element of the array. > > -- > Kind Regards > Mehdi Djait