spi: tegra: do not start transfer if runtime pm fails to resume
Johnny Qiu [Mon, 18 Jun 2012 07:11:23 +0000 (15:11 +0800)]
Bug 995706

During device shutdown/rebooting, runtime PM is disabled. SPI bus
driver will fail to call tegra_spi_runtime_resume() to resume the
clock needed by tranferring. In this case, do not start transferring.

Change-Id: I42cc0763f55b6c90df00fbad68794939e903199a
Signed-off-by: Johnny Qiu <joqiu@nvidia.com>
Reviewed-on: http://git-master/r/109458
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>

drivers/spi/spi-tegra.c

index d4b9c33..33e2004 100644 (file)
@@ -736,7 +736,12 @@ static void spi_tegra_start_transfer(struct spi_device *spi,
 
        command2 = tspi->def_command2_reg;
        if (is_first_of_msg) {
-               pm_runtime_get_sync(&tspi->pdev->dev);
+               if ((ret = pm_runtime_get_sync(&tspi->pdev->dev)) < 0) {
+                       dev_err(&tspi->pdev->dev,
+                               "%s: pm_runtime_get_sync() returns %d\n",
+                               __func__, ret);
+                       return;
+               }
 
                spi_tegra_clear_status(tspi);