diff mbox series

spi: Fix core transfer waits after slave support

Message ID 20181116001435.20465-1-broonie@kernel.org (mailing list archive)
State Accepted
Commit d57e79601bc587f140a9bbb102493ad86f648ae0
Headers show
Series spi: Fix core transfer waits after slave support | expand

Commit Message

Mark Brown Nov. 16, 2018, 12:14 a.m. UTC
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 | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comments

Geert Uytterhoeven Nov. 16, 2018, 8:11 a.m. UTC | #1
On Fri, Nov 16, 2018 at 1:14 AM Mark Brown <broonie@kernel.org> wrote:
> 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>

JFTR

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Sorry for missing that during the review.

Gr{oetje,eeting}s,

                        Geert
Mark Brown Nov. 17, 2018, 3:06 a.m. UTC | #2
On Fri, Nov 16, 2018 at 09:11:07AM +0100, Geert Uytterhoeven wrote:

> Sorry for missing that during the review.

I did too :/
diff mbox series

Patch

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 498d3b9bf3ae..430ad637c643 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -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,