aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShubhrajyoti D <shubhrajyoti@ti.com>2012-05-29 06:56:19 -0400
committerWolfram Sang <w.sang@pengutronix.de>2012-07-08 06:49:14 -0400
commit3b0fb97c8dc476935670706873c27a474191ccce (patch)
treeb40957fee2679e5824f64c55d4149421a2c15fcc
parent0861f430893e0b6fe980a71cdc5fb444b952b8e1 (diff)
I2C: OMAP: Handle error check for pm runtime
If PM runtime get_sync fails return with the error so that no further reads/writes goes through the interface. This will avoid possible abort. Add a error message in case of failure with the cause of the failure. Reviewed-by: Kevin Hilman <khilman@ti.com> Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
-rw-r--r--drivers/i2c/busses/i2c-omap.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 44e8cfa84dfe..c39b72f4a278 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -585,7 +585,9 @@ omap_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
585 int i; 585 int i;
586 int r; 586 int r;
587 587
588 pm_runtime_get_sync(dev->dev); 588 r = pm_runtime_get_sync(dev->dev);
589 if (IS_ERR_VALUE(r))
590 return r;
589 591
590 r = omap_i2c_wait_for_bb(dev); 592 r = omap_i2c_wait_for_bb(dev);
591 if (r < 0) 593 if (r < 0)
@@ -1011,7 +1013,9 @@ omap_i2c_probe(struct platform_device *pdev)
1011 dev->regs = (u8 *)reg_map_ip_v1; 1013 dev->regs = (u8 *)reg_map_ip_v1;
1012 1014
1013 pm_runtime_enable(dev->dev); 1015 pm_runtime_enable(dev->dev);
1014 pm_runtime_get_sync(dev->dev); 1016 r = pm_runtime_get_sync(dev->dev);
1017 if (IS_ERR_VALUE(r))
1018 goto err_free_mem;
1015 1019
1016 dev->rev = omap_i2c_read_reg(dev, OMAP_I2C_REV_REG) & 0xff; 1020 dev->rev = omap_i2c_read_reg(dev, OMAP_I2C_REV_REG) & 0xff;
1017 1021
@@ -1103,12 +1107,16 @@ omap_i2c_remove(struct platform_device *pdev)
1103{ 1107{
1104 struct omap_i2c_dev *dev = platform_get_drvdata(pdev); 1108 struct omap_i2c_dev *dev = platform_get_drvdata(pdev);
1105 struct resource *mem; 1109 struct resource *mem;
1110 int ret;
1106 1111
1107 platform_set_drvdata(pdev, NULL); 1112 platform_set_drvdata(pdev, NULL);
1108 1113
1109 free_irq(dev->irq, dev); 1114 free_irq(dev->irq, dev);
1110 i2c_del_adapter(&dev->adapter); 1115 i2c_del_adapter(&dev->adapter);
1111 pm_runtime_get_sync(&pdev->dev); 1116 ret = pm_runtime_get_sync(&pdev->dev);
1117 if (IS_ERR_VALUE(ret))
1118 return ret;
1119
1112 omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0); 1120 omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0);
1113 pm_runtime_put(&pdev->dev); 1121 pm_runtime_put(&pdev->dev);
1114 pm_runtime_disable(&pdev->dev); 1122 pm_runtime_disable(&pdev->dev);