Merge tag 'spi-fix-v5.19-rc0' of git://git.kernel.org/pub/scm/linux/kernel/git/brooni...
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 1 Jun 2022 17:30:18 +0000 (10:30 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 1 Jun 2022 17:30:18 +0000 (10:30 -0700)
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

drivers/spi/spi-fsi.c
drivers/spi/spi.c

index d403a7a3021d0067028d3aaba58a0ee4d3d7902b..72ab066ce552386b6a52ef2328528fc740a7907f 100644 (file)
@@ -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);
index fe252a8075a7d5e88cd6168bd8d22ee0171d3adc..b9e2c7e7c580d539ea8e585ae800a483a7f5244c 100644 (file)
@@ -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;
        }