Skip to content

Commit 2963b74

Browse files
committed
HID: transport: spi: Check status message after transmits
Probably pointless but might be helpful to debug issues. Gets rid of 'spi_hid_apple_status_ok' is unused compiler warning. Signed-off-by: Janne Grunau <j@jannau.net>
1 parent df6af1c commit 2963b74

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

drivers/hid/spi-hid/spi-hid-apple-core.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,17 @@ static int spihid_apple_request(struct spihid_apple *spihid, u8 target, u8 unk0,
248248
pkt->crc16 = cpu_to_le16(crc16(0, spihid->tx_buf,
249249
offsetof(struct spihid_transfer_packet, crc16)));
250250

251+
memset(spihid->status_buf, 0, sizeof(spi_hid_apple_status_ok));
252+
251253
err = spi_sync(spihid->spidev, &spihid->tx_msg);
254+
255+
if (memcmp(spihid->status_buf, spi_hid_apple_status_ok,
256+
sizeof(spi_hid_apple_status_ok))) {
257+
u8 *b = spihid->status_buf;
258+
dev_warn_ratelimited(&spihid->spidev->dev, "status message "
259+
"mismatch: %02x %02x %02x %02x\n",
260+
b[0], b[1], b[2], b[3]);
261+
}
252262
mutex_unlock(&spihid->tx_lock);
253263
if (err < 0)
254264
return err;

0 commit comments

Comments
 (0)