From: sashiko-bot@kernel.org
To: "Emfox Zhou" <emfox@debian.org>
Cc: linux-input@vger.kernel.org, dmitry.torokhov@gmail.com
Subject: Re: [PATCH v9 4/5] HID: intel-thc-hid: intel-ipts: handle system sleep
Date: Thu, 19 Nov 2026 09:24:07 +0000 [thread overview]
Message-ID: <sashiko-outbox-222824@kernel.org> (raw)
In-Reply-To: <20261119091152.470384-5-emfox@debian.org>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] HID: intel-thc-hid: intel-ipts: late IRQ mask in
thc_ipts_resume()
--
commit cb9fd08378f4c4d0b714f43fe49b9631edab5ac4
Author: Emfox Zhou <emfox@debian.org>
HID: intel-thc-hid: intel-ipts: handle system sleep
This commit adds system sleep and hibernation power management callbacks for
the Intel THC IPTS PCI driver, stopping the port on suspend and restarting it
on resume.
> diff --git a/drivers/hid/intel-thc-hid/intel-ipts/pci-ipts.c b/drivers/hid/intel-thc-hid/intel-ipts/pci-ipts.c
> index 5aa0ad6fb19cb..4bf64e5359755 100644
> --- a/drivers/hid/intel-thc-hid/intel-ipts/pci-ipts.c
> +++ b/drivers/hid/intel-thc-hid/intel-ipts/pci-ipts.c
> @@ -143,6 +143,38 @@ static void thc_ipts_remove(struct pci_dev *pci)
> pci_clear_master(pci);
> }
>
> +static int thc_ipts_suspend(struct device *dev)
> +{
> + struct thc_ipts *idev = dev_get_drvdata(dev);
> +
> + thc_ipts_port_stop(idev);
> +
> + return 0;
> +}
> +
> +static int thc_ipts_resume(struct device *dev)
> +{
> + struct thc_ipts *idev = dev_get_drvdata(dev);
> + int ret;
> +
> + /*
> + * A restore can bring the global enable back with it, as firmware
> + * leaves it at probe. The line is shared and level triggered, and the
> + * handler has nothing to mask it with until the engines are up, so
> + * mask it here as probe does.
> + */
> + thc_interrupt_enable(idev->thc, false);
> +
> + ret = thc_ipts_port_start(idev);
> + if (ret)
> + thc_ipts_port_stop(idev);
> +
> + return ret;
> +}
> +
> +static DEFINE_SIMPLE_DEV_PM_OPS(thc_ipts_pm_ops, thc_ipts_suspend,
> + thc_ipts_resume);
[Severity: Medium]
Does masking THC_M_PRT_INT_EN_GBL_INT_EN in thc_ipts_resume() happen too
late to prevent an unhandled interrupt storm on the shared line?
DEFINE_SIMPLE_DEV_PM_OPS() wires thc_ipts_resume() to .resume and .restore,
leaving .resume_noirq and .restore_noirq unset. During resume or restore,
dpm_resume_noirq() puts the PCI device back into D0, restores PCI_COMMAND,
and calls resume_device_irqs() before .resume or .restore runs.
At that point idev->dma_ready is still false from thc_ipts_suspend() ->
thc_ipts_port_stop() -> thc_ipts_dma_stop(), so thc_ipts_hardirq() returns
without masking the controller:
drivers/hid/intel-thc-hid/intel-ipts/ipts.c:thc_ipts_hardirq() {
if (!READ_ONCE(idev->dma_ready))
return IRQ_NONE;
/* Level triggered and shared: mask first, or it stays asserted. */
thc_interrupt_enable(idev->thc, false);
...
}
If firmware leaves the global interrupt enable set with a pending level
interrupt across restore, the IRQ fires as soon as resume_device_irqs()
unmasks the line and repeatedly returns IRQ_NONE until the IRQ core
disables the shared line before thc_ipts_resume() is reached. Should
thc_interrupt_enable(idev->thc, false) run in a noirq resume/restore
callback before resume_device_irqs()?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261119091152.470384-1-emfox@debian.org?part=4
next prev parent reply other threads:[~2026-11-19 9:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 9:11 [PATCH v9 0/5] HID: intel-thc-hid: intel-ipts: support THC IPTS ports Emfox Zhou
2026-11-19 9:11 ` [PATCH v9 1/5] HID: intel-thc-hid: intel-ipts: bring up the port Emfox Zhou
2026-11-19 9:11 ` [PATCH v9 2/5] HID: intel-thc-hid: intel-ipts: receive reports Emfox Zhou
2026-11-19 9:31 ` sashiko-bot
2026-11-19 9:11 ` [PATCH v9 3/5] HID: intel-thc-hid: intel-ipts: add the HID device Emfox Zhou
2026-11-19 9:11 ` [PATCH v9 4/5] HID: intel-thc-hid: intel-ipts: handle system sleep Emfox Zhou
2026-11-19 9:24 ` sashiko-bot [this message]
2026-11-19 9:11 ` [PATCH v9 5/5] HID: intel-thc-hid: intel-ipts: document the IPTS mode Emfox Zhou
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-222824@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=emfox@debian.org \
--cc=linux-input@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox