Common runtime PM calls, like pm_runtime_[enable|disable] have been
moved to PCI bus driver. Calling the same functions again in individual
drivers will result in various issues, like "Unbalanced pm_runtime_enable".
Following the example of e1000e driver pointed out by Rafael, add calls to
pm_runtime_put_noidle and pm_runtime_get_noresume appropriately. In addition,
this patch allows auto runtime suspend by default.

Signed-off-by: Yong Wang <[email protected]>
---
 drivers/i2c/busses/i2c-designware-pci.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/i2c/busses/i2c-designware-pci.c 
b/drivers/i2c/busses/i2c-designware-pci.c
index bea467e..8f750ce 100644
--- a/drivers/i2c/busses/i2c-designware-pci.c
+++ b/drivers/i2c/busses/i2c-designware-pci.c
@@ -321,7 +321,9 @@ const struct pci_device_id *id)
                goto err_free_irq;
        }
 
-       pm_runtime_enable(&pdev->dev);
+       pm_runtime_put_noidle(&pdev->dev);
+       pm_runtime_allow(&pdev->dev);
+
        return 0;
 
 err_free_irq:
@@ -341,9 +343,8 @@ static void __devexit i2c_dw_pci_remove(struct pci_dev 
*pdev)
 {
        struct dw_i2c_dev *dev = pci_get_drvdata(pdev);
 
-       pm_runtime_get_noresume(&pdev->dev);
        pm_runtime_forbid(&pdev->dev);
-       pm_runtime_disable(&pdev->dev);
+       pm_runtime_get_noresume(&pdev->dev);
 
        i2c_dw_disable(dev);
        pci_set_drvdata(pdev, NULL);
-- 
1.5.5.1

_______________________________________________
MeeGo-kernel mailing list
[email protected]
http://lists.meego.com/listinfo/meego-kernel

Reply via email to