Skip to content

Commit 129bdb3

Browse files
committed
Merge tag 'spi-fix-v5.19-rc0' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi
Pull spi fixes from Mark Brown: "A couple of fixes that came in during the merge window: a driver fix for spurious timeouts in the fsi driver and an improvement to make the core display error messages for transfer_one_message() to help people debug things" * tag 'spi-fix-v5.19-rc0' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: spi: core: Display return code when failing to transfer message spi: fsi: Fix spurious timeout
2 parents 2380dd6 + ebf2a35 commit 129bdb3

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

drivers/spi/spi-fsi.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -319,12 +319,12 @@ static int fsi_spi_transfer_data(struct fsi_spi *ctx,
319319

320320
end = jiffies + msecs_to_jiffies(SPI_FSI_STATUS_TIMEOUT_MS);
321321
do {
322+
if (time_after(jiffies, end))
323+
return -ETIMEDOUT;
324+
322325
rc = fsi_spi_status(ctx, &status, "TX");
323326
if (rc)
324327
return rc;
325-
326-
if (time_after(jiffies, end))
327-
return -ETIMEDOUT;
328328
} while (status & SPI_FSI_STATUS_TDR_FULL);
329329

330330
sent += nb;
@@ -337,12 +337,12 @@ static int fsi_spi_transfer_data(struct fsi_spi *ctx,
337337
while (transfer->len > recv) {
338338
end = jiffies + msecs_to_jiffies(SPI_FSI_STATUS_TIMEOUT_MS);
339339
do {
340+
if (time_after(jiffies, end))
341+
return -ETIMEDOUT;
342+
340343
rc = fsi_spi_status(ctx, &status, "RX");
341344
if (rc)
342345
return rc;
343-
344-
if (time_after(jiffies, end))
345-
return -ETIMEDOUT;
346346
} while (!(status & SPI_FSI_STATUS_RDR_FULL));
347347

348348
rc = fsi_spi_read_reg(ctx, SPI_FSI_DATA_RX, &in);

drivers/spi/spi.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1672,7 +1672,8 @@ static void __spi_pump_messages(struct spi_controller *ctlr, bool in_kthread)
16721672
ret = ctlr->transfer_one_message(ctlr, msg);
16731673
if (ret) {
16741674
dev_err(&ctlr->dev,
1675-
"failed to transfer one message from queue\n");
1675+
"failed to transfer one message from queue: %d\n",
1676+
ret);
16761677
goto out;
16771678
}
16781679

0 commit comments

Comments
 (0)