public inbox for linux-iio@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Junxiao Chang <junxiao.chang@intel.com>
Cc: jic23@kernel.org, dlechner@baylibre.com, nuno.sa@analog.com,
	andy@kernel.org, gye976@gmail.com, linux-iio@vger.kernel.org,
	linux-kernel@vger.kernel.org, lars@metafoo.de
Subject: Re: [PATCH] iio: buffer: fix warning in requesting threaded irq
Date: Fri, 17 Apr 2026 10:35:04 +0300	[thread overview]
Message-ID: <aeHiqJ5WZp4tT-xa@ashevche-desk.local> (raw)
In-Reply-To: <aeHgVChKIZpz541S@ashevche-desk.local>

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



  reply	other threads:[~2026-04-17  7:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-18  0:23 [PATCH] iio: buffer: fix warning in requesting threaded irq Junxiao Chang
2026-04-17  7:25 ` Andy Shevchenko
2026-04-17  7:35   ` Andy Shevchenko [this message]
2026-04-18  8:51 ` [PATCH v2] " Junxiao Chang
2026-04-17 11:30   ` Andy Shevchenko
2026-04-17 12:50     ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aeHiqJ5WZp4tT-xa@ashevche-desk.local \
    --to=andriy.shevchenko@intel.com \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=gye976@gmail.com \
    --cc=jic23@kernel.org \
    --cc=junxiao.chang@intel.com \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox