From: Joshua Crofts <joshua.crofts1@gmail.com>
To: Moksh Panicker <mokshpanicker.7@gmail.com>
Cc: jic23@kernel.org, nuno.sa@analog.com,
Michael.Hennerich@analog.com, dlechner@baylibre.com,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org, skhan@linuxfoundation.org
Subject: Re: [PATCH] iio: adc: ad7779: Initialize completion before requesting IRQ
Date: Sat, 27 Jun 2026 19:26:38 +0200 [thread overview]
Message-ID: <20260627192638.5623df0e@systembl0wer> (raw)
In-Reply-To: <20260627112205.31409-1-mokshpanicker.7@gmail.com>
On Sat, 27 Jun 2026 11:22:05 +0000
Moksh Panicker <mokshpanicker.7@gmail.com> wrote:
> init_completion() is called after devm_request_irq() in
> ad7779_setup_trigger(). If the IRQ fires before init_completion()
> runs, the completion is in an undefined state.
This is probably impossible, as devm_request_irq() is called with
IRQF_NO_AUTOEN as a parameter, therefore IRQs are enabled manually
in the code.
> Move init_completion() before devm_request_irq() to ensure the
> completion is ready before the IRQ handler can signal it.
>
> Fixes: c9a3f8c7bfcb ("drivers: iio: adc: add support for ad777x family")
> Cc: stable@vger.kernel.org
> Signed-off-by: Moksh Panicker <mokshpanicker.7@gmail.com>
> ---
> drivers/iio/adc/ad7779.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/adc/ad7779.c b/drivers/iio/adc/ad7779.c
> index 695cc79e78da..db8f5f4c6d6a 100644
> --- a/drivers/iio/adc/ad7779.c
> +++ b/drivers/iio/adc/ad7779.c
> @@ -838,6 +838,8 @@ static int ad7779_setup_without_backend(struct ad7779_state *st, struct iio_dev
> st->trig->ops = &ad7779_trigger_ops;
>
> iio_trigger_set_drvdata(st->trig, st);
> + init_completion(&st->completion);
Is there really any point in having this when st->completion isn't
used anywhere in the driver? I'd rather be for removing this function
call and the struct completion from struct ad7779_state.
> +
>
> ret = devm_request_irq(dev, st->spi->irq, iio_trigger_generic_data_rdy_poll,
> IRQF_NO_THREAD | IRQF_NO_AUTOEN, indio_dev->name,
Unrelated, however the dev_err_probe() call below this is unnecessary,
as devm_request_irq already returns a dev_err_probe on failure. Consider
sending a patch for this as well.
--
Kind regards
CJD
next prev parent reply other threads:[~2026-06-27 17:26 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-27 11:22 Moksh Panicker
2026-06-27 17:26 ` Joshua Crofts [this message]
2026-06-28 7:14 ` [PATCH 1/2] iio: adc: ad7779: Remove unused completion field Moksh Panicker
2026-06-28 7:14 ` [PATCH 2/2] iio: adc: ad7779: Remove redundant dev_err_probe() after devm_request_irq() Moksh Panicker
2026-06-28 11:42 ` Joshua Crofts
2026-06-28 11:41 ` [PATCH 1/2] iio: adc: ad7779: Remove unused completion field Joshua Crofts
2026-06-28 14:34 ` David Lechner
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=20260627192638.5623df0e@systembl0wer \
--to=joshua.crofts1@gmail.com \
--cc=Michael.Hennerich@analog.com \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mokshpanicker.7@gmail.com \
--cc=nuno.sa@analog.com \
--cc=skhan@linuxfoundation.org \
--cc=stable@vger.kernel.org \
/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
all inboxes | Powered by JetHome®