All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: jianfeng.gao@intel.com
Cc: linux-usb@vger.kernel.org
Subject: Re: [PATCH] usb: typec: tipd: mask interrupt across suspend to fix IRQ storm
Date: Tue, 01 Dec 2026 09:00:57 +0000	[thread overview]
Message-ID: <sashiko-outbox-242904@kernel.org> (raw)
In-Reply-To: <20261201084650.3697134-1-jianfeng.gao@intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] usb: typec: tipd: unbalanced disable_irq() on error in
  tps6598x_resume()
It also noticed 1 related pre-existing issue this patch does not
introduce:
- [High] usb: typec: tipd: shared IRQ line globally disabled in
  tps6598x_suspend() [1]
--

commit bad1fa24a640cc758aca2387c46de94a7477d077
Author: JianFeng Gao <jianfeng.gao@intel.com>

usb: typec: tipd: mask interrupt across suspend to fix IRQ storm

This commit disables client->irq unconditionally in tps6598x_suspend() and
re-enables it in tps6598x_resume() to prevent an interrupt storm when the
parent I2C controller suspends while tps->wakeup is false.

> diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c
> index 67471c363a687..28a4f60629dfa 100644
> --- a/drivers/usb/typec/tipd/core.c
> +++ b/drivers/usb/typec/tipd/core.c
> @@ -1973,12 +1973,19 @@ static int __maybe_unused tps6598x_suspend(struct device *dev)
>  	struct i2c_client *client = to_i2c_client(dev);
>  	struct tps6598x *tps = i2c_get_clientdata(client);
>  
> -	if (tps->wakeup) {
> +	/*
> +	 * Mask the interrupt before the parent I2C controller is suspended:
> +	 * otherwise a still-asserted level IRQ keeps re-entering the handler,
> +	 * whose register reads then fail with -ESHUTDOWN, producing an
> +	 * interrupt storm until the noirq phase globally disables interrupts.
> +	 */
> +	if (client->irq)
>  		disable_irq(client->irq);

[Severity: High]
This problem wasn't introduced by this patch, but calling
disable_irq(client->irq) here globally masks a shared interrupt line at the
interrupt controller [1].  Because the driver requests client->irq
with IRQF_SHARED, masking the line across suspend starves any other devices
sharing the IRQ during their suspend sequence and prevents them from waking
the system.

> +
> +	if (tps->wakeup)
>  		enable_irq_wake(client->irq);
> -	} else if (tps->reset) {
> +	else if (tps->reset)
>  		gpiod_set_value_cansleep(tps->reset, 1);
> -	}
>  
>  	if (!client->irq)
>  		cancel_delayed_work_sync(&tps->wq_poll);
> @@ -2004,12 +2011,15 @@ static int __maybe_unused tps6598x_resume(struct device *dev)
>  
>  	if (tps->wakeup) {
>  		disable_irq_wake(client->irq);
> -		enable_irq(client->irq);
>  	} else if (tps->reset) {
>  		gpiod_set_value_cansleep(tps->reset, 0);
>  		msleep(TPS_SETUP_MS);
>  	}
>  
> +	/* Balance the unconditional disable_irq() in tps6598x_suspend() */
> +	if (client->irq)
> +		enable_irq(client->irq);

[Severity: Medium]
Can an early error return in tps6598x_resume() leave client->irq disabled?

Before reaching enable_irq(client->irq), tps6598x_resume() returns early if
tps6598x_check_mode() or tps->data->init() fails:

drivers/usb/typec/tipd/core.c:tps6598x_resume() {
	ret = tps6598x_check_mode(tps);
	if (ret < 0)
		return ret;

	if (ret == TPS_MODE_PTCH) {
		ret = tps->data->init(tps);
		if (ret)
			return ret;
	}
	...
}

In particular, when tps->wakeup is false and tps->reset is present,
tps6598x_suspend() now disables client->irq and asserts reset, and
tps6598x_resume() runs tps6598x_check_mode() over I2C while the chip is
still held in reset before de-asserting tps->reset.  When that read (or any
resume I2C transfer) fails, client->irq stays disabled so Type-C events are
no longer serviced, and later suspend cycles call disable_irq() again and
increase the disable depth.

[1] https://sashiko.dev/#/bug/linux-c47210b1-54f4-4549-9e9f-d91fbab89bb8

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261201084650.3697134-1-jianfeng.gao@intel.com?part=1

  reply	other threads:[~2026-12-01  9:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01  8:46 [PATCH] usb: typec: tipd: mask interrupt across suspend to fix IRQ storm jianfeng.gao
2026-12-01  9:00 ` sashiko-bot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-09-18  5:18 jianfeng.gao

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=sashiko-outbox-242904@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=jianfeng.gao@intel.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.