[PATCH] iio: adc: xilinx-ams: Replace spin_lock() and unlock() calls with guard(spinlock*)()

Maxwell Doose m32285159 at gmail.com
Wed May 6 09:15:01 PDT 2026


On Wed, May 6, 2026 at 10:51 AM Jonathan Cameron <jic23 at kernel.org> wrote:
>
> On Mon,  4 May 2026 16:46:12 -0500
> Maxwell Doose <m32285159 at gmail.com> wrote:
>
> > Include linux/cleanup.h to take advantage of RAII macros.
> >
> > Replace spin_lock() and unlock() calls with their RAII macro
> > counterparts. This will help modernize the code and increase readability.
> >
> > Remove "flags" variables where spin_lock_irqsave() has been replaced
> > with guard(spinlock_irqsave)()
> >
> > Signed-off-by: Maxwell Doose <m32285159 at gmail.com>
>
> Hi Maxwell
>
> One thing inline.
>
> Thanks,
>
> Jonathan
>
> >  static void ams_enable_channel_sequence(struct iio_dev *indio_dev)
> > @@ -1060,9 +1058,8 @@ static void ams_unmask_worker(struct work_struct *work)
> >  {
> >       struct ams *ams = container_of(work, struct ams, ams_unmask_work.work);
> >
> > -     spin_lock_irq(&ams->intr_lock);
> > +     guard(spinlock_irq)(&ams->intr_lock);
>
> This increases the scope to include scheduling delayed work. Seems unwise
> in general and should definitely be mentioned in the commit message.
> Use a scoped_guard() here probably or leave it alone.
>

Will add tonight.

best regards,
max



> >       ams_unmask(ams);
> > -     spin_unlock_irq(&ams->intr_lock);
> >
> >       /* If still pending some alarm re-trigger the timer */
> >       if (ams->current_masked_alarm)
>
>



More information about the linux-arm-kernel mailing list