From: Jean-Jacques Hiblot Date: Tue, 31 May 2016 15:56:23 +0000 (+0200) Subject: spi: spi-ti-qspi: Suspend the queue before removing the device X-Git-Tag: MMI-PSA29.97-13-9~7628^2^5 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=3ac066e2227cb272c097f34475247fa0a6cdd2ff;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git spi: spi-ti-qspi: Suspend the queue before removing the device Before disabling the pm_runtime, we must ensure that there is no transfer in progress nor will a new one be started. Otherwise the message pump will fail and in the end, the process requesting the transfer will be stuck. This behavior has been observed when transferring data from a SPI flash with dd while removing the module on a DRA7x-evm. Signed-off-by: Jean-Jacques Hiblot Signed-off-by: Mark Brown --- diff --git a/drivers/spi/spi-ti-qspi.c b/drivers/spi/spi-ti-qspi.c index 443f664534e1..29ea8d2f9824 100644 --- a/drivers/spi/spi-ti-qspi.c +++ b/drivers/spi/spi-ti-qspi.c @@ -646,6 +646,13 @@ free_master: static int ti_qspi_remove(struct platform_device *pdev) { + struct ti_qspi *qspi = platform_get_drvdata(pdev); + int rc; + + rc = spi_master_suspend(qspi->master); + if (rc) + return rc; + pm_runtime_put_sync(&pdev->dev); pm_runtime_disable(&pdev->dev);