Regression in next with spi return from transfer_one()
Hi,
Commit 810923f3bf06 ("spi: Deal with slaves that return from transfer_one() unfinished") causes a regression at least on droid 4 with SPI PMIC and regulators on the PMIC. During boot the device just hangs there waiting for rootfs to appear on MMC. Reverting 810923f3bf06 makes things work again.
Any ideas why this might be?
Regards,
Tony
Mark Brown
maintainerQuoted 7 lines · Tony Lindgren
Commit
810923f3bf06("spi: Deal with slaves that return fromtransfer_one()unfinished") causes a regression at least on droid 4 with SPI PMIC and regulators on the PMIC. During boot the device just hangs there waiting for rootfs to appear on MMC. Reverting810923f3bf06makes things work again.Any ideas why this might be?
Wow, that's not obvious... as far as I can tell the code in the !slave
case is identical so unless the controller is somehow getting mistakenly
flagged as a slave it looks like it should be something to do with it
being pushed into a function. Could you try logging what the timeout
ends up getting set to?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20181115/dbd71646/attachment.sig>
Quoted 8 lines · Mark Brown
Quoted 5 lines · Tony Lindgren
Commit
810923f3bf06("spi: Deal with slaves that return fromtransfer_one()unfinished") causes a regression at least on droid 4 with SPI PMIC and regulators on the PMIC. During boot the device just hangs there waiting for rootfs to appear on MMC. Reverting810923f3bf06makes things work again.
Quoted 7 lines
Quoted 1 line
Any ideas why this might be?
Wow, that's not obvious... as far as I can tell the code in the !slave case is identical so unless the controller is somehow getting mistakenly flagged as a slave it looks like it should be something to do with it being pushed into a function. Could you try logging what the timeout ends up getting set to?
It seems to be caused because of the now missing "if (ret > 0) {" line somehow that was there earlier. New code sets ms to 200 it seems, then dmesg shows:
SPI transfer timed out
The old code is not updating ms and it's set to 1.
Regards,
Tony
Mark Brown
maintainerQuoted 3 lines · Tony Lindgren
It seems to be caused because of the now missing "if (ret > 0) {" line somehow that was there earlier. New code sets ms to 200 it seems, then dmesg shows:
Doh, of course :( Sorry I missed that.
Quoted 1 line
The old code is not updating ms and it's set to 1.
Right, and not waiting either which should be the issue. Does the following work:
drivers/spi/spi.c +5 -3
@@ -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,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20181115/213c9a1f/attachment.sig>
Tony Lindgren
Tested-byQuoted 6 lines · Mark Brown
Quoted 3 lines · Tony Lindgren
It seems to be caused because of the now missing "if (ret > 0) {" line somehow that was there earlier. New code sets ms to 200 it seems, then dmesg shows:
Quoted 6 lines
Doh, of course :( Sorry I missed that.
Quoted 1 line
The old code is not updating ms and it's set to 1.
Right, and not waiting either which should be the issue. Does the following work:
And it's recalculating the timeout every time now too :) Yup that fix works and the problem makes sense now:
Quoted 19 lines
drivers/spi/spi.c +5
-3@@ -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,
Quoted 11 lines · Tony Lindgren
Quoted 10 lines · Mark Brown
Quoted 3 lines · Tony Lindgren
It seems to be caused because of the now missing "if (ret > 0) {" line somehow that was there earlier. New code sets ms to 200 it seems, then dmesg shows:
Doh, of course :( Sorry I missed that.
Quoted 1 line
The old code is not updating ms and it's set to 1.
Quoted 7 lines
Quoted 2 lines
Right, and not waiting either which should be the issue. Does the following work:
And it's recalculating the timeout every time now too :) Yup that fix works and the problem makes sense now:
Tested-by Tony Lindgren <[email protected]>
My bad obviously. Sorry.
I'm grateful that you identified and fixed the problem so quickly.
Thanks,
Lubo
Quoted 24 lines
Quoted 22 lines
drivers/spi/spi.c +5
-3@@ -1114,9 +1114,11 @@ static int spi_transfer_one_message(structspi_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 {drivers/spi/spi.c +0
-0if (xfer->len) dev_err(&msg->spi->dev,