Re: [PATCH v5 5/7] iio: accel: kionix-kx022a: Refactor driver and add chip_info structure

From: Mehdi Djait
Date: Mon Jun 12 2023 - 12:32:03 EST


Hello Andy,

On Mon, Jun 12, 2023 at 06:54:34PM +0300, Andy Shevchenko wrote:
> On Mon, Jun 12, 2023 at 04:22:08PM +0200, Mehdi Djait wrote:
> > Add the chip_info structure to the driver's private data to hold all
> > the device specific infos.
> > Refactor the kx022a driver implementation to make it more generic and
> > extensible.
>
> ...
>
> > + chip_info = spi_get_device_match_data(spi);
>
> Missing check. You addressed only I²C case. Is there any explanation?

I will add the check for the SPI case

>
> ...
>
> > struct kx022a_data {
> > + const struct kx022a_chip_info *chip_info;
> > struct regmap *regmap;
>
> I would suggest to run bloat-o-meter with this version and if you place
> chip_info after regmap. Does it gain us some memory?

I used the bloat-o-meter on the two .ko files (this version and the the
one where chip_info after regamp) Is this what you asked for ?

add/remove: 0/0 grow/shrink: 0/5 up/down: 0/-20 (-20)
Function old new delta
kx132_get_fifo_bytes 148 144 -4
kx022a_trigger_set_state 352 348 -4
kx022a_read_raw 380 376 -4
kx022a_buffer_predisable 248 244 -4
kx022a_buffer_postenable 296 292 -4
Total: Before=11244, After=11224, chg -0.18%

--
Kind Regards
Mehdi Djait