* [PATCH v3 0/2] HID: intel-thc-hid: quiesce IRQs during teardown
@ 2026-11-12 6:37 Myeonghun Pak
2026-11-12 6:37 ` [PATCH v3 1/2] HID: intel-thc-hid: quickspi: " Myeonghun Pak
2026-11-12 6:37 ` [PATCH v3 2/2] HID: intel-thc-hid: quicki2c: " Myeonghun Pak
0 siblings, 2 replies; 3+ messages in thread
From: Myeonghun Pak @ 2026-11-12 6:37 UTC (permalink / raw)
To: even.xu, xinpeng.sun, jikos, bentiss
Cc: srinivas.pandruvada, mpearson-lenovo, linux-input, linux-kernel,
ae878000
This resends v2 with the probe cleanup formatting requested by Even.
There are no functional changes from v2.
Changes in v3:
- Add blank lines in the probe error paths of both drivers (Even).
v2: https://lore.kernel.org/all/20261109-thc-rebase-v2-0-mhun512@gmail.com/
No hardware testing.
Myeonghun Pak (2):
HID: intel-thc-hid: quickspi: quiesce IRQs during teardown
HID: intel-thc-hid: quicki2c: quiesce IRQs during teardown
.../intel-quicki2c/pci-quicki2c.c | 32 ++++++++++++++++++++++++++------
.../intel-quickspi/pci-quickspi.c | 32 ++++++++++++++++++++++++++------
2 files changed, 52 insertions(+), 12 deletions(-)
base-commit: b3dfbde62cf1981c4638939c159dfd087b7a72e9
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v3 1/2] HID: intel-thc-hid: quickspi: quiesce IRQs during teardown
2026-11-12 6:37 [PATCH v3 0/2] HID: intel-thc-hid: quiesce IRQs during teardown Myeonghun Pak
@ 2026-11-12 6:37 ` Myeonghun Pak
2026-11-12 6:37 ` [PATCH v3 2/2] HID: intel-thc-hid: quicki2c: " Myeonghun Pak
1 sibling, 0 replies; 3+ messages in thread
From: Myeonghun Pak @ 2026-11-12 6:37 UTC (permalink / raw)
To: even.xu, xinpeng.sun, jikos, bentiss
Cc: srinivas.pandruvada, mpearson-lenovo, linux-input, linux-kernel,
ae878000
The managed IRQ can access HID/DMA buffers or queue recovery work while
remove or probe unwind tears down those resources.
Disable and synchronize the IRQ, drain recovery work, then mask THC
interrupts before freeing the IRQ and releasing HID/DMA resources.
Track IRQ/DMA initialization for conditional probe cleanup.
Disable the IRQ before shutdown deinit as well. Keep IRQ disabling and
release outside the shared hibernation helper.
Found by a static analysis tool under development.
Fixes: 4138f21115ae ("HID: intel-thc-hid: intel-quickspi: Complete THC QuickSPI driver")
Co-developed-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
---
Changes in v3:
- Add blank lines in the probe error path (Even).
drivers/hid/intel-thc-hid/intel-quickspi/pci-quickspi.c | 32 ++++++++++++++++++++++++++------
1 file changed, 26 insertions(+), 6 deletions(-)
diff --git a/drivers/hid/intel-thc-hid/intel-quickspi/pci-quickspi.c b/drivers/hid/intel-thc-hid/intel-quickspi/pci-quickspi.c
index bf49d8ce5f07..3aa0ae81053e 100644
--- a/drivers/hid/intel-thc-hid/intel-quickspi/pci-quickspi.c
+++ b/drivers/hid/intel-thc-hid/intel-quickspi/pci-quickspi.c
@@ -600,6 +600,8 @@
const struct pci_device_id *id)
{
struct quickspi_device *qsdev;
+ bool dma_initialized = false;
+ bool irq_requested = false;
void __iomem *mem_addr;
int ret;
@@ -652,6 +654,7 @@
qsdev);
if (ret)
goto dev_deinit;
+ irq_requested = true;
ret = reset_tic(qsdev);
if (ret) {
@@ -670,17 +673,18 @@
dev_err(&pdev->dev, "Setup THC DMA failed, ret= %d\n", ret);
goto dev_deinit;
}
+ dma_initialized = true;
ret = quickspi_get_report_descriptor(qsdev);
if (ret) {
dev_err(&pdev->dev, "Get report descriptor failed, ret = %d\n", ret);
- goto dma_deinit;
+ goto dev_deinit;
}
ret = quickspi_hid_probe(qsdev);
if (ret) {
dev_err(&pdev->dev, "Failed to register HID device, ret = %d\n", ret);
- goto dma_deinit;
+ goto dev_deinit;
}
qsdev->state = QUICKSPI_ENABLED;
@@ -695,10 +699,20 @@
return 0;
-dma_deinit:
- quickspi_dma_deinit(qsdev);
dev_deinit:
+ if (irq_requested) {
+ WRITE_ONCE(qsdev->recovery_disabled, true);
+ disable_irq(pdev->irq);
+ }
+
quickspi_dev_deinit(qsdev);
+
+ if (irq_requested)
+ devm_free_irq(&pdev->dev, pdev->irq, qsdev);
+
+ if (dma_initialized)
+ quickspi_dma_deinit(qsdev);
+
disable_pci_device:
pci_clear_master(pdev);
@@ -721,9 +735,12 @@
if (!qsdev)
return;
+ WRITE_ONCE(qsdev->recovery_disabled, true);
+ disable_irq(pdev->irq);
+ quickspi_dev_deinit(qsdev);
+ devm_free_irq(&pdev->dev, pdev->irq, qsdev);
+
quickspi_hid_remove(qsdev);
-
- quickspi_dev_deinit(qsdev);
quickspi_dma_deinit(qsdev);
@@ -749,6 +766,9 @@
qsdev = pci_get_drvdata(pdev);
if (!qsdev)
return;
+
+ WRITE_ONCE(qsdev->recovery_disabled, true);
+ disable_irq(pdev->irq);
quickspi_dev_deinit(qsdev);
base-commit: b3dfbde62cf1981c4638939c159dfd087b7a72e9
--
2.53.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v3 2/2] HID: intel-thc-hid: quicki2c: quiesce IRQs during teardown
2026-11-12 6:37 [PATCH v3 0/2] HID: intel-thc-hid: quiesce IRQs during teardown Myeonghun Pak
2026-11-12 6:37 ` [PATCH v3 1/2] HID: intel-thc-hid: quickspi: " Myeonghun Pak
@ 2026-11-12 6:37 ` Myeonghun Pak
1 sibling, 0 replies; 3+ messages in thread
From: Myeonghun Pak @ 2026-11-12 6:37 UTC (permalink / raw)
To: even.xu, xinpeng.sun, jikos, bentiss
Cc: srinivas.pandruvada, mpearson-lenovo, linux-input, linux-kernel,
ae878000
The managed IRQ can access HID/DMA buffers or queue recovery work while
remove or probe unwind tears down those resources.
Disable and synchronize the IRQ, drain recovery work, then mask THC
interrupts before freeing the IRQ and releasing HID/DMA resources.
Track IRQ/DMA initialization for conditional probe cleanup.
Disable the IRQ before shutdown deinit as well. Keep IRQ disabling and
release outside the shared hibernation helper.
Found by a static analysis tool under development.
Fixes: 66b59bfce6d9 ("HID: intel-thc-hid: intel-quicki2c: Complete THC QuickI2C driver")
Co-developed-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
---
Changes in v3:
- Add blank lines in the probe error path (Even).
drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c | 32 ++++++++++++++++++++++++++------
1 file changed, 26 insertions(+), 6 deletions(-)
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 29319b6227f3..84e458fdd69c 100644
--- a/drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c
+++ b/drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c
@@ -652,6 +652,8 @@
{
const struct quicki2c_ddata *ddata = (const struct quicki2c_ddata *)id->driver_data;
struct quicki2c_device *qcdev;
+ bool dma_initialized = false;
+ bool irq_requested = false;
void __iomem *mem_addr;
int ret;
@@ -704,6 +706,7 @@
qcdev);
if (ret)
goto dev_deinit;
+ irq_requested = true;
ret = quicki2c_get_device_descriptor(qcdev);
if (ret) {
@@ -722,6 +725,7 @@
dev_err(&pdev->dev, "Setup THC DMA failed, ret= %d\n", ret);
goto dev_deinit;
}
+ dma_initialized = true;
ret = thc_interrupt_quiesce(qcdev->thc_hw, false);
if (ret)
@@ -742,13 +746,13 @@
ret = quicki2c_get_report_descriptor(qcdev);
if (ret) {
dev_err(&pdev->dev, "Get report descriptor failed, ret = %d\n", ret);
- goto dma_deinit;
+ goto dev_deinit;
}
ret = quicki2c_hid_probe(qcdev);
if (ret) {
dev_err(&pdev->dev, "Failed to register HID device, ret = %d\n", ret);
- goto dma_deinit;
+ goto dev_deinit;
}
qcdev->state = QUICKI2C_ENABLED;
@@ -763,10 +767,20 @@
return 0;
-dma_deinit:
- quicki2c_dma_deinit(qcdev);
dev_deinit:
+ if (irq_requested) {
+ WRITE_ONCE(qcdev->recovery_disabled, true);
+ disable_irq(pdev->irq);
+ }
+
quicki2c_dev_deinit(qcdev);
+
+ if (irq_requested)
+ devm_free_irq(&pdev->dev, pdev->irq, qcdev);
+
+ if (dma_initialized)
+ quicki2c_dma_deinit(qcdev);
+
disable_pci_device:
pci_clear_master(pdev);
@@ -788,9 +802,12 @@
if (!qcdev)
return;
+ 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);
-
- quicki2c_dev_deinit(qcdev);
quicki2c_dma_deinit(qcdev);
@@ -814,6 +831,9 @@
qcdev = pci_get_drvdata(pdev);
if (!qcdev)
return;
+
+ WRITE_ONCE(qcdev->recovery_disabled, true);
+ disable_irq(pdev->irq);
quicki2c_dev_deinit(qcdev);
base-commit: b3dfbde62cf1981c4638939c159dfd087b7a72e9
--
2.53.0
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-12 6:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-12 6:37 [PATCH v3 0/2] HID: intel-thc-hid: quiesce IRQs during teardown Myeonghun Pak
2026-11-12 6:37 ` [PATCH v3 1/2] HID: intel-thc-hid: quickspi: " Myeonghun Pak
2026-11-12 6:37 ` [PATCH v3 2/2] HID: intel-thc-hid: quicki2c: " Myeonghun Pak
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®