Re: [PATCH] iio: buffer: fix warning in requesting threaded irq
From: Andy Shevchenko
Date: Fri Apr 17 2026 - 03:39:17 EST
On Fri, Apr 17, 2026 at 10:25:08AM +0300, Andy Shevchenko wrote:
> On Sat, Apr 18, 2026 at 08:23:34AM +0800, Junxiao Chang wrote:
...
> > struct iio_buffer *buffer;
> > + unsigned long flags = 0;
>
> This is less maintainable. When the assigned value is used in a conditional,
> it's always better to have the assignment there.
>
> > int ret;
...
> > + if (thread)
> > + flags |= IRQF_ONESHOT;
>
> if (thread)
> flags = IRQF_ONESHOT;
> else
> flags = 0;
Note, alternatively you can completely drop this temporary variable and use
ternary directly in the call. I think it will be even better from readability
p.o.v.
--
With Best Regards,
Andy Shevchenko