From d89971bae034b73f101b8ed7b9021b99474c624b Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Fri, 30 May 2014 18:18:09 +0200 Subject: [PATCH] spi/pxa2xx: fix runtime PM enabling order In commit 0628ddf4217bcfc30ce2bb5587b3e376eb332780 (spi/pxa2xx: Convert to core runtime PM) master->auto_runtime_pm was set to true. In this case pm_runtime_enable() must be called *before* spi_register_master(), otherwise the kernel hangs with this error message: spi_master spi0: Failed to power device: -13 A similar fix, but for spi/hspi, was applied in 790f795a555c11ddbb829a3a7a46e8e46b194f78. Signed-off-by: Antonio Ospite Signed-off-by: Mark Brown --- drivers/spi/spi-pxa2xx.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index 41185d0557fa5..a07b758144423 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -1202,6 +1202,11 @@ static int pxa2xx_spi_probe(struct platform_device *pdev) tasklet_init(&drv_data->pump_transfers, pump_transfers, (unsigned long)drv_data); + pm_runtime_set_autosuspend_delay(&pdev->dev, 50); + pm_runtime_use_autosuspend(&pdev->dev); + pm_runtime_set_active(&pdev->dev); + pm_runtime_enable(&pdev->dev); + /* Register with the SPI framework */ platform_set_drvdata(pdev, drv_data); status = devm_spi_register_master(&pdev->dev, master); @@ -1210,11 +1215,6 @@ static int pxa2xx_spi_probe(struct platform_device *pdev) goto out_error_clock_enabled; } - pm_runtime_set_autosuspend_delay(&pdev->dev, 50); - pm_runtime_use_autosuspend(&pdev->dev); - pm_runtime_set_active(&pdev->dev); - pm_runtime_enable(&pdev->dev); - return status; out_error_clock_enabled: -- 2.39.5