aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAndy Gross <agross@codeaurora.org>2014-09-29 18:00:51 -0400
committerWolfram Sang <wsa@the-dreams.de>2014-10-02 21:20:47 -0400
commit86b59bbfae2a895aa26b3d15f31b1a705dbfede1 (patch)
tree83f5493517b86e852c97faa13f7403c950617e5d /drivers
parentcf27020d2f253bac6457d6833b97141030f0122a (diff)
i2c: qup: Fix order of runtime pm initialization
The runtime pm calls need to be done before populating the children via the i2c_add_adapter call. If this is not done, a child can run into issues trying to do i2c read/writes due to the pm_runtime_sync failing. Signed-off-by: Andy Gross <agross@codeaurora.org> Reviewed-by: Felipe Balbi <balbi@ti.com> Acked-by: Bjorn Andersson <bjorn.andersson@sonymobile.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Cc: stable@kernel.org
Diffstat (limited to 'drivers')
-rw-r--r--drivers/i2c/busses/i2c-qup.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/i2c/busses/i2c-qup.c b/drivers/i2c/busses/i2c-qup.c
index 3a4d64e1dfb1..092d89bd3224 100644
--- a/drivers/i2c/busses/i2c-qup.c
+++ b/drivers/i2c/busses/i2c-qup.c
@@ -674,16 +674,20 @@ static int qup_i2c_probe(struct platform_device *pdev)
674 qup->adap.dev.of_node = pdev->dev.of_node; 674 qup->adap.dev.of_node = pdev->dev.of_node;
675 strlcpy(qup->adap.name, "QUP I2C adapter", sizeof(qup->adap.name)); 675 strlcpy(qup->adap.name, "QUP I2C adapter", sizeof(qup->adap.name));
676 676
677 ret = i2c_add_adapter(&qup->adap);
678 if (ret)
679 goto fail;
680
681 pm_runtime_set_autosuspend_delay(qup->dev, MSEC_PER_SEC); 677 pm_runtime_set_autosuspend_delay(qup->dev, MSEC_PER_SEC);
682 pm_runtime_use_autosuspend(qup->dev); 678 pm_runtime_use_autosuspend(qup->dev);
683 pm_runtime_set_active(qup->dev); 679 pm_runtime_set_active(qup->dev);
684 pm_runtime_enable(qup->dev); 680 pm_runtime_enable(qup->dev);
681
682 ret = i2c_add_adapter(&qup->adap);
683 if (ret)
684 goto fail_runtime;
685
685 return 0; 686 return 0;
686 687
688fail_runtime:
689 pm_runtime_disable(qup->dev);
690 pm_runtime_set_suspended(qup->dev);
687fail: 691fail:
688 qup_i2c_disable_clocks(qup); 692 qup_i2c_disable_clocks(qup);
689 return ret; 693 return ret;