From: Lee Jones <lee@kernel.org>
To: shao.mingyin@zte.com.cn
Cc: mfd@lists.linux.dev, tony@atomide.com,
linux-omap@vger.kernel.org, tharvey@gateworks.com,
support.opensource@diasemi.com, patches@opensource.cirrus.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/5] mfd: da9052: Disable IRQ wake on device removal
Date: Wed, 18 Nov 2026 17:57:22 +0000 [thread overview]
Message-ID: <179442121138.44545.365837636476170108@kernel.org> (raw)
In-Reply-To: <20261107160747079LomNfOJeeu6knwkNqJYTx@zte.com.cn>
On Sat, 07 Nov 2026, shao.mingyin@zte.com.cn wrote:
> From: Shao Mingyin <shao.mingyin@zte.com.cn>
>
> da9052_irq_init() calls enable_irq_wake() on the chip IRQ but neither the
> error path (when requesting the ADC_EOM IRQ fails) nor da9052_irq_exit()
> (the removal path reached from da9052_i2c_remove()/da9052_spi_remove())
> ever calls disable_irq_wake(). The wakeup configuration is therefore left
> behind when the device is unbound; the IRQ line keeps being treated as a
> wakeup source and, should the descriptor be reused by another device later,
> the stale wake setting persists.
>
> Track whether the wake source was successfully enabled and disable it
> symmetrically on both the probe failure path and in da9052_irq_exit().
>
> Fixes: ed05be56643e ("mfd: da9052: Register ability of device to cause a wake-up interrupt")
> Signed-off-by: Shao Mingyin <shao.mingyin@zte.com.cn>
> ---
> diff --git a/drivers/mfd/da9052-irq.c b/drivers/mfd/da9052-irq.c
> index abbdbf0337e2..da5bac424efc 100644
> --- a/drivers/mfd/da9052-irq.c
> +++ b/drivers/mfd/da9052-irq.c
> @@ -259,7 +259,8 @@ int da9052_irq_init(struct da9052 *da9052)
> goto regmap_err;
> }
>
> - enable_irq_wake(da9052->chip_irq);
> + if (!enable_irq_wake(da9052->chip_irq))
In general, I'm not a fan of stuffing functions into if()s.
> + da9052->irq_wake_enabled = true;
Can't this be called after da9052_request_irq()?
Doing so avoids all of this craziness.
> ret = da9052_request_irq(da9052, DA9052_IRQ_ADC_EOM, "adc-irq",
> da9052_auxadc_irq, da9052);
> @@ -272,6 +273,10 @@ int da9052_irq_init(struct da9052 *da9052)
> return 0;
>
> request_irq_err:
> + if (da9052->irq_wake_enabled) {
> + disable_irq_wake(da9052->chip_irq);
> + da9052->irq_wake_enabled = false;
> + }
> regmap_del_irq_chip(da9052->chip_irq, da9052->irq_data);
> regmap_err:
> return ret;
> @@ -281,6 +286,10 @@ int da9052_irq_init(struct da9052 *da9052)
> int da9052_irq_exit(struct da9052 *da9052)
> {
> da9052_free_irq(da9052, DA9052_IRQ_ADC_EOM, da9052);
> + if (da9052->irq_wake_enabled) {
> + disable_irq_wake(da9052->chip_irq);
> + da9052->irq_wake_enabled = false;
> + }
> regmap_del_irq_chip(da9052->chip_irq, da9052->irq_data);
>
> return 0;
> diff --git a/include/linux/mfd/da9052/da9052.h b/include/linux/mfd/da9052/da9052.h
> index 9cb2fc2938ce..d7dd36891539 100644
> --- a/include/linux/mfd/da9052/da9052.h
> +++ b/include/linux/mfd/da9052/da9052.h
> @@ -93,6 +93,8 @@ struct da9052 {
>
> int chip_irq;
>
> + bool irq_wake_enabled;
If the above is not possible, why not call disable_irq_wake()
regardless? It's safe to do so, right?
> +
> int fault_log;
>
> /* SOC I/O transfer related fixes for DA9052/53 */
--
Lee Jones
next prev parent reply other threads:[~2026-11-18 17:57 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-07 8:07 [PATCH 0/5] mfd: Fix an out-of-bounds IRQ map and error-path bugs shao.mingyin
2026-11-07 8:07 ` [PATCH 1/5] mfd: tps65219: Fix out-of-bounds access in tps65214 IRQ map shao.mingyin
2026-11-18 17:46 ` Lee Jones
2026-11-07 8:07 ` [PATCH 2/5] mfd: twl6030-irq: Don't write garbage to interrupt mask on read failure shao.mingyin
2026-11-07 8:07 ` [PATCH 3/5] mfd: arizona: Free info IRQs on probe failure shao.mingyin
2026-11-18 17:50 ` Lee Jones
2026-11-07 8:07 ` [PATCH 4/5] mfd: da9052: Disable IRQ wake on device removal shao.mingyin
2026-11-18 17:57 ` Lee Jones [this message]
2026-11-07 8:07 ` [PATCH 5/5] mfd: gateworks-gsc: Check firmware CRC reads for errors shao.mingyin
2026-11-18 18:22 ` Lee Jones
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=179442121138.44545.365837636476170108@kernel.org \
--to=lee@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=mfd@lists.linux.dev \
--cc=patches@opensource.cirrus.com \
--cc=shao.mingyin@zte.com.cn \
--cc=support.opensource@diasemi.com \
--cc=tharvey@gateworks.com \
--cc=tony@atomide.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
all inboxes | Powered by JetHome®