Re: [PATCH v2] staging: iio: impedance-analyzer: ad5933: use guard(mutex) in ad5933_show()

From: Andy Shevchenko

Date: Mon Oct 26 2026 - 05:09:11 EST


On Mon, Oct 26, 2026 at 02:40:49AM +0000, Jonathan Cameron wrote:
> On Mon, 19 Oct 2026 22:09:12 +0300
> Andy Shevchenko <andriy.shevchenko@xxxxxxxxx> wrote:
> > On Mon, Oct 19, 2026 at 03:02:48PM +0000, Nithishvelan M wrote:

...

> > > case AD5933_IN_PGA_GAIN:
> > > - len = sysfs_emit(buf, "%s\n",
> > > - (st->ctrl_hb & AD5933_CTRL_PGA_GAIN_1) ?
> > > - "1" : "0.2");
> > > - break;
> > > + return sysfs_emit(buf, "%s\n",
> > > + st->ctrl_hb & AD5933_CTRL_PGA_GAIN_1 ? "1" : "0.2");
> >
> > You can (re-)use ridx here as well
> >
> > ridx = st->ctrl_hb & AD5933_CTRL_PGA_GAIN_1;
> > return sysfs_emit(buf, "%s\n", ridx ? "1" : "0.2");
>
> Maybe call it something else here as its not the range index that I can see.

True! I have no idea where the part of my thought went during the previous
reply as I definitely kept in mind and wanted to add something like "(and this
might need a variable renaming)".

--
With Best Regards,
Andy Shevchenko