Re: [PATCH 1/5] HID: intel-thc-hid: intel-thc: keep TxDMA write errors

From
sashiko-bot@kernel.org
Date
2026-11-16 13:49:41
Reply to
Emfox Zhou, 2026-11-16
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Medium] HID: intel-thc-hid: synchronous block in
  quicki2c_hid_output_report() [1]
--

commit 7d6243e52aaa280fbfaad43053698624190f219b
Author: Emfox Zhou [off-list ref]

HID: intel-thc-hid: intel-thc: keep TxDMA write errors

This commit waits uninterruptibly for TxDMA completion in thc_dma_write(),
wakes all waiters on write_complete_wait, and preserves the write error code
when unquiescing interrupts during cleanup.
quoted hunk ↗ jump to hunk
diff --git a/drivers/hid/intel-thc-hid/intel-thc/intel-thc-dma.c b/drivers/hid/intel-thc-hid/intel-thc/intel-thc-dma.c
index c80ef8c205742..c0dc44e26e0ac 100644
--- a/drivers/hid/intel-thc-hid/intel-thc/intel-thc-dma.c
+++ b/drivers/hid/intel-thc-hid/intel-thc/intel-thc-dma.c
@@ -1045,8 +1045,9 @@ int thc_dma_write(struct thc_device *dev, void *buffer, size_t buf_len)
 
 	dma_set_start_bit(dev, &dev->dma_ctx->dma_config[THC_TXDMA]);
 
-	ret = wait_event_interruptible_timeout(dev->write_complete_wait, dev->write_done, 1 * HZ);
-	if (ret <= 0 || !dev->write_done) {
+	ret = wait_event_timeout(dev->write_complete_wait,
+				 dev->write_done, 1 * HZ);
[Severity: Medium]
This problem wasn't introduced by this patch, but does calling
thc_dma_write() from quicki2c_hid_output_report() violate the HID
output_report contract [1] by blocking the caller?

The HID subsystem requires the .output_report callback to be asynchronous,
yet quicki2c_hid_output_report() -> quicki2c_output_report() ->
thc_dma_write() acquires dev->thc_bus_lock and blocks on
dev->write_complete_wait for up to a second, stalling the calling HID core
workqueue or thread.

[1] https://sashiko.dev/#/bug/linux-84fcc3fd-7b0c-485b-9da1-a71ea67e4f5e

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261116133132.1282020-1-emfox@debian.org?part=1
Thread (8 messages) 8 messages, 2 authors, last reply 5d ago
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help