summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2022-06-01 10:30:18 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2022-06-01 10:30:18 -0700
commit129bdb30fb054875f2068ccce376b865076d9934 (patch)
tree1ff336b93836dec48268429bfcd0573ef40b79f4 /drivers
parent2380dd691e1fe1ebe3f346d0ce54f8fc7eacc167 (diff)
parentebf2a3521738520e12849b221fea24928b3f61ff (diff)
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
Diffstat (limited to 'drivers')
-rw-r--r--drivers/spi/spi-fsi.c12
-rw-r--r--drivers/spi/spi.c3
2 files changed, 8 insertions, 7 deletions
diff --git a/drivers/spi/spi-fsi.c b/drivers/spi/spi-fsi.c
index d403a7a3021d..72ab066ce552 100644
--- a/drivers/spi/spi-fsi.c
+++ b/drivers/spi/spi-fsi.c
@@ -319,12 +319,12 @@ static int fsi_spi_transfer_data(struct fsi_spi *ctx,
end = jiffies + msecs_to_jiffies(SPI_FSI_STATUS_TIMEOUT_MS);
do {
+ if (time_after(jiffies, end))
+ return -ETIMEDOUT;
+
rc = fsi_spi_status(ctx, &status, "TX");
if (rc)
return rc;
-
- if (time_after(jiffies, end))
- return -ETIMEDOUT;
} while (status & SPI_FSI_STATUS_TDR_FULL);
sent += nb;
@@ -337,12 +337,12 @@ static int fsi_spi_transfer_data(struct fsi_spi *ctx,
while (transfer->len > recv) {
end = jiffies + msecs_to_jiffies(SPI_FSI_STATUS_TIMEOUT_MS);
do {
+ if (time_after(jiffies, end))
+ return -ETIMEDOUT;
+
rc = fsi_spi_status(ctx, &status, "RX");
if (rc)
return rc;
-
- if (time_after(jiffies, end))
- return -ETIMEDOUT;
} while (!(status & SPI_FSI_STATUS_RDR_FULL));
rc = fsi_spi_read_reg(ctx, SPI_FSI_DATA_RX, &in);
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index fe252a8075a7..b9e2c7e7c580 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -1672,7 +1672,8 @@ static void __spi_pump_messages(struct spi_controller *ctlr, bool in_kthread)
ret = ctlr->transfer_one_message(ctlr, msg);
if (ret) {
dev_err(&ctlr->dev,
- "failed to transfer one message from queue\n");
+ "failed to transfer one message from queue: %d\n",
+ ret);
goto out;
}