Re: [PATCH v8 4/4] iio: cdc: add Texas Instruments FDC1004 driver
From: Andy Shevchenko
Date: Wed Nov 11 2026 - 03:46:53 EST
On Tue, Nov 10, 2026 at 06:18:16PM -0600, Victor Chernyakin wrote:
...
> > > +static const int fdc1004_calibbias_decomposed[] = {
> > > + lower_32_bits(fdc1004_calibbias[0]), upper_32_bits(fdc1004_calibbias[0]),
> > > + lower_32_bits(fdc1004_calibbias[1]), upper_32_bits(fdc1004_calibbias[1]),
> > > + lower_32_bits(fdc1004_calibbias[2]), upper_32_bits(fdc1004_calibbias[2]),
> > > +};
> > > +
> > > +static const int fdc1004_calibscale_decomposed[] = {
> > > + lower_32_bits(fdc1004_calibscale[0]), upper_32_bits(fdc1004_calibscale[0]),
> > > + lower_32_bits(fdc1004_calibscale[1]), upper_32_bits(fdc1004_calibscale[1]),
> > > + lower_32_bits(fdc1004_calibscale[2]), upper_32_bits(fdc1004_calibscale[2]),
> > > +};
> >
> > Can we prepare them dynamically at runtime? Use global variables and a macro
> > from once.h to make the populate function a singleton, so we don't have as many
> > copies as devices on the system that are driven by this code. We can probably
> > do this later, though.
>
> Are you sure there's a separate copy for each device? In my understanding,
> these static variables are loaded along with the module, and the module
> is loaded only once and shared between all devices.
I started my paragraph with "Can we prepare them dynamically at runtime?"
which assumes that the rest of the paragraph is elaborating that idea.
--
With Best Regards,
Andy Shevchenko