arm:omap:mcspi: follow proper pm_runtime enable/disable sequence
authorHebbar, Gururaja <gururaja.hebbar@ti.com>
Mon, 24 Oct 2011 10:20:27 +0000 (15:50 +0530)
committerVaibhav Hiremath <hvaibhav@ti.com>
Mon, 23 Jan 2012 19:14:27 +0000 (00:44 +0530)
omap mcspi probe() doesn't call pm_runtime put & disable functions
in case of failure. remove() doesn't call pm_runtime disable. This could
lead to warnings as below on subsequent insmod.

root@arago-armv7:~# insmod /lib/modules/3.1.0-rc8/spi-omap2-mcspi.ko
[  255.383671] omap2_mcspi omap2_mcspi.1: Unbalanced pm_runtime_enable!
...

This patch adds the pm_runtime put() & disable() at aprropriate stages.

Signed-off-by: Hebbar, Gururaja <gururaja.hebbar@ti.com>
Signed-off-by: Vaibhav Hiremath <hvaibhav@ti.com>
drivers/spi/spi-omap2-mcspi.c

index bf666ffea9331b409eb0d3c69c497202c83d94d4..8edb71eb5a17bfdef836ceb97840db9d72c712f6 100644 (file)
@@ -1207,6 +1207,8 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev)
 err4:
        spi_master_put(master);
 err3:
+       pm_runtime_put_sync(&pdev->dev);
+       pm_runtime_disable(&pdev->dev);
        kfree(mcspi->dma_channels);
 err2:
        release_mem_region(r->start, resource_size(r));
@@ -1228,6 +1230,7 @@ static int __exit omap2_mcspi_remove(struct platform_device *pdev)
        dma_channels = mcspi->dma_channels;
 
        omap2_mcspi_disable_clocks(mcspi);
+       pm_runtime_disable(&pdev->dev);
        r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        release_mem_region(r->start, resource_size(r));