From 0cd12bf08c6d08771e493342c704de60830785cf Mon Sep 17 00:00:00 2001
From: Hebbar, Gururaja <gururaja.hebbar@ti.com>
Date: Mon, 24 Oct 2011 15:50:27 +0530
Subject: [PATCH 4/5] arm:omap:mcspi: follow proper pm_runtime enable/disable sequence

omap mcspi probe() doesnt call pm_runtime put & disable functions
in case of failure. remove() doesnt 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>
---
 drivers/spi/spi-omap2-mcspi.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
index f757a8e..7a8e19e 100644
--- a/drivers/spi/spi-omap2-mcspi.c
+++ b/drivers/spi/spi-omap2-mcspi.c
@@ -1209,6 +1209,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));
@@ -1230,6 +1232,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));
 
-- 
1.7.2.5

