Re: [PATCH 2/2] iio: adc: Add rtq6056 support

From: ChiYuan Huang
Date: Thu Jun 23 2022 - 23:39:55 EST


Andy Shevchenko <andy.shevchenko@xxxxxxxxx> 於 2022年6月19日 週日 下午6:38寫道:
>
> On Sat, Jun 18, 2022 at 5:16 PM ChiYuan Huang <u0084500@xxxxxxxxx> wrote:
> > Andy Shevchenko <andy.shevchenko@xxxxxxxxx> 於 2022年6月18日 週六 凌晨1:08寫道:
> > > On Fri, Jun 17, 2022 at 11:37 AM cy_huang <u0084500@xxxxxxxxx> wrote:
>
> ...
>
> > > > +KernelVersion: 5.18.2
> > >
> > > Wrong version, this won't be part of a stable kernel.
> > >
> > From kernel.org, currently the stable kernel version is 5.18.5.
> > Change to 5.18.5?
>
> Nope. You need to use realistic kernel version, and as I said it can't
> be a stable one.
>
> ...
>
> > > But for sure you missed
>
> > > types.h
> > >
> > Ack in next. But for types.h, i2c.h already include device.h.
> > And device.h already include types.h.
> > Is it still needed to declare explicitly for types.h??
>
> Yes. You have to include all headers you are a direct user of, except
> the ones that are guaranteed to be included by others. The types.h is
> not guaranteed to be included by listed above.
>
> ...
>
> > > > + struct device *dev;
> > > > + struct regmap *regmap;
> > >
> > > Swapping these two might give less code in the generated binary. Have
> > > you run bloat-o-meter?
> > >
> > I never know about this tool.
> > I'll check it before I submit the next revision.
> > Thanks for the reminding.
> >
> > But from Jonathan's reply, I may remove 'struct regmap *regmap'.
> > If all function need the 'regmap', a local variable 'regmap' need to
> > be declared.
> > To use struct regmap *regmap = dev_get_regmap(dev, NULL) is more effective.
>
> It's fine, but you may experiment with bloat-o-meter even in that case
> out of curiosity.
>
I tred to only swap these two line for *dev and *regmap.
Check the below two cases
1. bloat-o-meter with rtq6056 as the builtin
add/remove: 0/0 grow/shrink: 0/0 up/down: 0/0 (0)
Function old new delta
Total: Before=24428680, After=24428680, chg +0.00%
2. size tool with rtq6056 as the kernel build
text data bss dec hex filename
5261 1155 0 6416 1910 drivers/iio/adc/rtq6056-adc.ko.old
text data bss dec hex filename
5261 1155 0 6416 1910 drivers/iio/adc/rtq6056-adc.ko

It's weird that there's no difference.

Do I misunderstand something?

> --
> With Best Regards,
> Andy Shevchenko