Re: [PATCH 2/3] iio: accel: kionix-kx022a: Add chip_info structure

From: Mehdi Djait
Date: Sat Mar 18 2023 - 12:12:12 EST


Hi Andy,

On Fri, Mar 17, 2023 at 02:06:39PM +0200, Andy Shevchenko wrote:
> On Fri, Mar 17, 2023 at 12:48:36AM +0100, Mehdi Djait wrote:
> > Refactor the kx022a driver implementation to make it more
> > generic and extensible.
> > Add the chip_info structure will to the driver's private
> > data to hold all the device specific infos.
> > Move the enum, struct and constants definitions to the header
> > file.
>
> Please, compile and test before sending.

My bad, I ignored the warnings...
I will fix it.

>
> ...
>
> > .driver = {
> > - .name = "kx022a-spi",
> > + .name = "kx022a-spi",
> > .of_match_table = kx022a_of_match,
> > },
>
> What was changed here?

Nothing. I will fix it

>
> ...
>
> > - .id_table = kx022a_id,
> > + .id_table = kx022a_spi_id,
>
> Why do we need this change?
>

For consistency:
i2c: .id_table = kx022a_i2c_id,
spi: .id_table = kx022a_spi_id,

> ...
>
> > - name = devm_kasprintf(data->dev, GFP_KERNEL, "%s-kx022a",
> > + name = devm_kasprintf(data->dev, GFP_KERNEL, "%s-accel",
> > dev_name(data->dev));
>
> Shouldn't you use the name from chip info?

I can use the name from chip info.
dev_name(data->dev) is the original implementation

>
> ...
>
> > +#define KX_MASK_BRES16 BIT(6)
> > +
> > +
>
> One blank line is enough.

I will change it in v2

--
Kind Regards
Mehdi Djait