Re: [PATCH v6 05/11] iio: adc: hx711: move scale computation to per-device storage

Jonathan Cameron
2026-05-04T16:00:50Z

On Mon, 4 May 2026 17:25:10 +0300
Andy Shevchenko <andriy.shevchenko@intel.com> wrote:

> On Sun, May 03, 2026 at 05:39:34PM +0530, Piyush Patle wrote:
> > The gain-to-scale table is global today, so probe-time scale updates for
> > one device overwrite the values used by any earlier device instance.
> >
> > Fix this by making the gain table const and storing the computed scale
> > values per device in hx711_data.
> >
> > No functional change for single-sensor configurations.
>
> ...
>
> > +static const struct hx711_gain_to_scale hx711_gain_to_scale[HX711_GAIN_MAX] = {
> > + { 128, 1, 0, },
> > + { 32, 2, 1, },
> > + { 64, 3, 0, },
>
> In such case the inner trailing commas are not needed. They are needed when the
> supplied lists are arrays and may be extended. Here it's a proper data type
> with fixed number of arguments. If you want to be even stricter and robust, move
> to C99 initialisers (but note, I'm fine with just trailing commas being removed).
>
> { 128, 1, 0 },
> { 32, 2, 1 },
> { 64, 3, 0 },
>
> > };
>
> ...
>
> > @@ -574,4 +575,3 @@ MODULE_AUTHOR("Andreas Klinger <ak@it-klinger.de>");
> > MODULE_DESCRIPTION("HX711 bitbanging driver - ADC for weight cells");
> > MODULE_LICENSE("GPL");
> > MODULE_ALIAS("platform:hx711-gpio");
> > -
>
> Stray change.
>
Given Andy commented on this a couple of times and it is still here,
let me just add that this change is fine, but not in a patch doing
anything other that white space cleanup. So spin a new patch for it
or don't make the change at all. This stuff is distracting noise.

Thanks,

Jonathan