Re: [PATCH 07/11] I2C: OMAP: Handle error check for pm runtime
On Wed, Jun 27, 2012 at 7:13 AM, Kevin Hilman khil...@ti.com wrote: Shubhrajyoti D shubhrajy...@ti.com writes: 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 khil...@ti.com Signed-off-by: Shubhrajyoti D shubhrajy...@ti.com This patch introduced a regression where the runtime PM usecount will never reach zero and so CORE retention is prevented after any xfer failures... --- -v10 Use IS_ERR_VALUE -v9 Fix the error handling drivers/i2c/busses/i2c-omap.c | 14 +++--- 1 files changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index 44e8cfa..c39b72f 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) int i; int r; - pm_runtime_get_sync(dev-dev); + r = pm_runtime_get_sync(dev-dev); + if (IS_ERR_VALUE(r)) + return r; This return should be 'goto out' so the runtime PM usecount is decremented by the 'put'. Otherwise, after failure, the usecount remains non-zero, so the device is considered 'active' and keeps the containing power domain active. I found this on a 3730/OveroSTORM where the suspend/resume of MMC fails because I2C is already suspended. After the suspend though, the CORE powerdomain never again hits retention, and I tracked it down to this. I'll send a separate patch to fix this shortly. Thanks, Kevin -- To unsubscribe from this list: send the line unsubscribe linux-i2c in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 07/11] I2C: OMAP: Handle error check for pm runtime
Shubhrajyoti D shubhrajy...@ti.com writes: 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 khil...@ti.com Signed-off-by: Shubhrajyoti D shubhrajy...@ti.com This patch introduced a regression where the runtime PM usecount will never reach zero and so CORE retention is prevented after any xfer failures... --- -v10 Use IS_ERR_VALUE -v9 Fix the error handling drivers/i2c/busses/i2c-omap.c | 14 +++--- 1 files changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index 44e8cfa..c39b72f 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) int i; int r; - pm_runtime_get_sync(dev-dev); + r = pm_runtime_get_sync(dev-dev); + if (IS_ERR_VALUE(r)) + return r; This return should be 'goto out' so the runtime PM usecount is decremented by the 'put'. Otherwise, after failure, the usecount remains non-zero, so the device is considered 'active' and keeps the containing power domain active. I found this on a 3730/OveroSTORM where the suspend/resume of MMC fails because I2C is already suspended. After the suspend though, the CORE powerdomain never again hits retention, and I tracked it down to this. I'll send a separate patch to fix this shortly. Kevin -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 07/11] 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 khil...@ti.com Signed-off-by: Shubhrajyoti D shubhrajy...@ti.com --- -v10 Use IS_ERR_VALUE -v9 Fix the error handling drivers/i2c/busses/i2c-omap.c | 14 +++--- 1 files changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index 44e8cfa..c39b72f 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) int i; int r; - pm_runtime_get_sync(dev-dev); + r = pm_runtime_get_sync(dev-dev); + if (IS_ERR_VALUE(r)) + return r; r = omap_i2c_wait_for_bb(dev); if (r 0) @@ -1011,7 +1013,9 @@ omap_i2c_probe(struct platform_device *pdev) dev-regs = (u8 *)reg_map_ip_v1; pm_runtime_enable(dev-dev); - pm_runtime_get_sync(dev-dev); + r = pm_runtime_get_sync(dev-dev); + if (IS_ERR_VALUE(r)) + goto err_free_mem; dev-rev = omap_i2c_read_reg(dev, OMAP_I2C_REV_REG) 0xff; @@ -1103,12 +1107,16 @@ omap_i2c_remove(struct platform_device *pdev) { struct omap_i2c_dev *dev = platform_get_drvdata(pdev); struct resource *mem; + int ret; platform_set_drvdata(pdev, NULL); free_irq(dev-irq, dev); i2c_del_adapter(dev-adapter); - pm_runtime_get_sync(pdev-dev); + ret = pm_runtime_get_sync(pdev-dev); + if (IS_ERR_VALUE(ret)) + return ret; + omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0); pm_runtime_put(pdev-dev); pm_runtime_disable(pdev-dev); -- 1.7.5.4 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html