spi: Fix core transfer waits after slave support
authorMark Brown <broonie@kernel.org>
Fri, 16 Nov 2018 00:08:32 +0000 (16:08 -0800)
committerMark Brown <broonie@kernel.org>
Fri, 16 Nov 2018 00:08:32 +0000 (16:08 -0800)
The refactoring done as part of adding the core support for handling
waiting for slave transfer dropped a conditional which meant that we
started waiting for completion of all transfers, not just those that the
controller asked for.  This caused hangs and massive delays on platforms
that don't need the core delay.  Re-add the delay to fix this.

Fixes: 810923f3bf06c11 (spi: Deal with slaves that return from transfer_one() unfinished)
Reported-by: Tony Lindgren <tony@atomide.com>
Tested-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi.c

index 498d3b9bf3aef66d0a60a22f9bd2905e535087ea..430ad637c643e664261503eda1fd5a8153c63007 100644 (file)
@@ -1114,9 +1114,11 @@ static int spi_transfer_one_message(struct spi_controller *ctlr,
                                goto out;
                        }
 
-                       ret = spi_transfer_wait(ctlr, msg, xfer);
-                       if (ret < 0)
-                               msg->status = ret;
+                       if (ret > 0) {
+                               ret = spi_transfer_wait(ctlr, msg, xfer);
+                               if (ret < 0)
+                                       msg->status = ret;
+                       }
                } else {
                        if (xfer->len)
                                dev_err(&msg->spi->dev,