From: Emfox Zhou <emfox@debian.org>
To: Even Xu <even.xu@intel.com>, Xinpeng Sun <xinpeng.sun@intel.com>,
Jiri Kosina <jikos@kernel.org>,
Benjamin Tissoires <bentiss@kernel.org>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v7 2/2] HID: intel-thc-hid: quickspi, quicki2c: skip an empty read
Date: Tue, 17 Nov 2026 18:54:27 +0800 [thread overview]
Message-ID: <20261117105427.319242-3-emfox@debian.org> (raw)
In-Reply-To: <20261117105427.319242-1-emfox@debian.org>
A drain ends when the ring holds no frame, and thc_rxdma_read() reports
that as a successful read of zero bytes. Both handlers go by the buffer
instead of the length: quickspi hands the zero on and its own length check
then rejects the frame still left in the buffer, while quicki2c reads
pkt->len from the previous frame and sends that report again.
Tell the two cases apart by the length. A frame with an empty payload is
still a frame, and quicki2c needs that one for its reset ack.
Fixes: 4138f21115ae ("HID: intel-thc-hid: intel-quickspi: Complete THC QuickSPI driver")
Fixes: 66b59bfce6d9 ("HID: intel-thc-hid: intel-quicki2c: Complete THC QuickI2C driver")
Signed-off-by: Emfox Zhou <emfox@debian.org>
---
drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c | 3 +++
drivers/hid/intel-thc-hid/intel-quickspi/pci-quickspi.c | 3 +++
2 files changed, 6 insertions(+)
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 29319b622..8e3f7f3f6 100644
--- a/drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c
+++ b/drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c
@@ -298,6 +298,9 @@ static int handle_input_report(struct quicki2c_device *qcdev)
if (ret)
return ret;
+ if (!report_len)
+ continue;
+
if (!pkt->len) {
if (qcdev->state == QUICKI2C_RESETING) {
qcdev->reset_ack = true;
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 bf49d8ce5..812f743f6 100644
--- a/drivers/hid/intel-thc-hid/intel-quickspi/pci-quickspi.c
+++ b/drivers/hid/intel-thc-hid/intel-quickspi/pci-quickspi.c
@@ -331,6 +331,9 @@ static irqreturn_t quickspi_irq_thread_handler(int irq, void *dev_id)
goto end;
}
+ if (!input_len)
+ continue;
+
quickspi_handle_input_data(qsdev, input_len);
}
}
prev parent reply other threads:[~2026-11-17 10:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 10:54 [PATCH v7 0/2] HID: intel-thc-hid: PRD tables under a drain Emfox Zhou
2026-11-17 10:54 ` [PATCH v7 1/2] HID: intel-thc-hid: intel-thc: restore PRD table capacity Emfox Zhou
2026-11-17 10:54 ` Emfox Zhou [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=20261117105427.319242-3-emfox@debian.org \
--to=emfox@debian.org \
--cc=bentiss@kernel.org \
--cc=even.xu@intel.com \
--cc=jikos@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=xinpeng.sun@intel.com \
/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