Re: [PATCH v3 8/8] iio: adc: ti-ads112c14: add measurement channel support

From: Andy Shevchenko

Date: Mon Jul 13 2026 - 21:04:52 EST


On Mon, Jul 13, 2026 at 02:40:27PM -0500, David Lechner wrote:
> On 7/11/26 8:00 AM, Andy Shevchenko wrote:
> > On Fri, Jul 10, 2026 at 05:50:41PM -0500, David Lechner (TI) wrote:

...

> >> +struct ads112c14_measurement {
> >> + const char *label;
> >> + u32 vref_source;
> >> + u8 iunit;
> >> + u8 idac1_mag;
> >> + u8 idac2_mag;
> >> + u8 idac1_mux;
> >> + u8 idac2_mux;
> >
> > I would group this slightly differently:
> >
> > u8 idac1_mag;
> > u8 idac2_mag;
> > u8 idac1_mux;
> > u8 idac2_mux;
> > u8 iunit;
> >
> > I haven't seen the code, but names suggest that most likely one would read
> > *[12] together or close enough, and less probably mixed with 'iunit' reads.
> > Current layout might lead to interesting code generation complications on
> > the unaligned-intolerable architectures.
>
> iunit is scaling factor for *_mag, so logically gets grouped with
> those. (These are all datasheet register field names.)

Then it can be

u8 idac1_mux;
u8 idac2_mux;
u8 idac1_mag;
u8 idac2_mag;
u8 iunit;


> >> + u8 iadc_count;
> >> + u8 gain_val;
> >> + u8 burnout;
> >> + bool global_chop;
> >> + bool bipolar;
> >
> >> + s64 scale_available[ARRAY_SIZE(ads112c14_pga_gains_x10)];
> >
> > Also this can be moved upper, but I think it won't save any bytes in this
> > layout.
> >
> >> +};

--
With Best Regards,
Andy Shevchenko