Re: [PATCH v5 03/12] iio: dac: ad5686: acquire lock when doing powerdown control
From: Jonathan Cameron
Date: Tue May 05 2026 - 08:09:55 EST
On Tue, 5 May 2026 12:16:09 +0100
Rodrigo Alencar <455.rodrigo.alencar@xxxxxxxxx> wrote:
> On 26/05/05 12:05PM, Jonathan Cameron wrote:
> > On Fri, 01 May 2026 10:14:56 +0100
> > Rodrigo Alencar via B4 Relay <devnull+rodrigo.alencar.analog.com@xxxxxxxxxx> wrote:
> >
> > > From: Rodrigo Alencar <rodrigo.alencar@xxxxxxxxxx>
> > >
> > > Protect write access of pwr_down_mode and pwr_down_mask fields with
> > > existing mutex lock. Each channel exposes their own attributes for
> > > controlling powerdown modes and powerdown state. This fixes potential
> > > race conditions as those functions perform non-atomic read-modify-write
> > > operations to those pwr_down_* fields. This issue exists since the
> > > ad5686 driver was first introduced.
> > >
> > > Fixes: c2f37c8dcadc ("iio: dac: New driver for AD5686R, AD5685R, AD5684R Digital to analog converters")
> > > Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxx>
> > > Signed-off-by: Rodrigo Alencar <rodrigo.alencar@xxxxxxxxxx>
> > https://sashiko.dev/#/patchset/20260501-ad5686-fixes-v5-0-0b2f45488418%40analog.com
> >
> > Reasonable concern about possible races in the read path leading to
> > -EPERM rather than simply the wrong value.
> >
> > The other bit about not updating hardware is true but I think it's fine not to change
> > what powerdown mode we are in whilst powered down.
>
> True! I've seen sashiko review for this, I have a v6 ready with its feeback.
> Just waiting for some more reviews (like yours). I might be sending to many new versions
> for this one in a short amount of time!
>
Cool. In cases like this it is useful to reply with a 'review' of your own
patch. Saves other reviewers from commenting on things you've already dealt
with.
Anyhow, good to hear you already have it in hand
Thanks,
Jonathan