All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Myeonghun Pak" <mhun512@gmail.com>
Cc: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org
Subject: Re: [PATCH 2/2] HID: intel-thc-hid: quicki2c: quiesce IRQs during teardown
Date: Sun, 11 Oct 2026 22:20:23 +0000	[thread overview]
Message-ID: <sashiko-outbox-167473@kernel.org> (raw)
In-Reply-To: <20261011220531.2073892-3-mhun512@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] hid: intel-thc: 1s timeout on HID teardown commands due to early IRQ disable
--

commit 074bce22ab8075bef92df21dcd016a16b939a785
Author: Myeonghun Pak <mhun512@gmail.com>

HID: intel-thc-hid: quicki2c: quiesce IRQs during teardown

This commit disables and synchronizes the IRQ, drains recovery work, and
masks THC interrupts before freeing the IRQ and releasing HID/DMA resources.
It tracks IRQ/DMA initialization for conditional probe cleanup and disables
the IRQ during shutdown as well.

> diff --git a/drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c b/drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c
> index 7a913f717efaa..ac073be894817 100644
> --- a/drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c
> +++ b/drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c
[ ... ]
> @@ -788,9 +798,12 @@ static void quicki2c_remove(struct pci_dev *pdev)
>  	if (!qcdev)
>  		return;
>  
> -	quicki2c_hid_remove(qcdev);
> -
> +	WRITE_ONCE(qcdev->recovery_disabled, true);
> +	disable_irq(pdev->irq);
>  	quicki2c_dev_deinit(qcdev);
> +	devm_free_irq(&pdev->dev, pdev->irq, qcdev);
> +
> +	quicki2c_hid_remove(qcdev);

[Severity: Medium]
Could moving the IRQ disable/free and device deinit before
quicki2c_hid_remove() break any HID raw_requests issued during high-level
driver teardown?

High-level HID drivers (like hid-multitouch) often send final commands
(e.g., turning off LEDs or disabling features) during their remove
callback, which is triggered by hid_destroy_device() inside
quicki2c_hid_remove().

Since the patch moves disable_irq() and devm_free_irq() before
quicki2c_hid_remove(), thc_dma_write() in intel-thc-dma.c will block
for 1 second waiting for an IRQ completion that will never arrive:

	ret = wait_event_interruptible_timeout(dev->write_complete_wait, dev->write_done, 1 * HZ);
	if (ret <= 0 || !dev->write_done) {
		dev_err_once(dev->dev, "timeout for waiting TxDMA completion\n");
		ret = -ETIMEDOUT;
		goto end;
	}

This might unconditionally introduce a 1-second delay per command
during device unbind or system shutdown if the bound high-level HID driver
issues any hardware commands in its remove callback.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261011220531.2073892-1-mhun512@gmail.com?part=2

      reply	other threads:[~2026-10-11 22:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-11 22:05 [PATCH 0/2] HID: intel-thc-hid: quiesce interrupts before final teardown Myeonghun Pak
2026-10-11 22:05 ` [PATCH 1/2] HID: intel-thc-hid: quickspi: quiesce IRQs during teardown Myeonghun Pak
2026-10-11 22:21   ` sashiko-bot
2026-10-13  0:52   ` Xu, Even
2026-10-11 22:05 ` [PATCH 2/2] HID: intel-thc-hid: quicki2c: " Myeonghun Pak
2026-10-11 22:20   ` sashiko-bot [this message]

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-167473@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=mhun512@gmail.com \
    --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.