From 1ee08ea3dd185eaba6d3bd812a7b9a1e57735200 Mon Sep 17 00:00:00 2001 From: Shrey Vijay Date: Wed, 14 Dec 2016 15:56:05 +0530 Subject: [PATCH] i2c-msm-v2:Synchronise runtime PM callback operations During system wakeup from suspend by connecting USB cable, runtime PM framework transitions from enabled to disabled state during i2c transaction. This causes asymmetric increment and decrement of device's usage counter which blocks runtime PM suspend callback. To avoid this, remove rumtime PM status check on suspend path to make it symmetric with the resume path. This takes care of unaccounted increment/decrement of device's usage counter. Change-Id: I47cfe2cd7d93ba5db57365cf250c600dac22bab1 Signed-off-by: Shrey Vijay --- drivers/i2c/busses/i2c-msm-v2.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/i2c/busses/i2c-msm-v2.c b/drivers/i2c/busses/i2c-msm-v2.c index a510490d28d6..04b1b62f85c3 100644 --- a/drivers/i2c/busses/i2c-msm-v2.c +++ b/drivers/i2c/busses/i2c-msm-v2.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2014-2015, The Linux Foundation. All rights reserved. +/* Copyright (c) 2014-2016, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -2236,12 +2236,12 @@ static void i2c_msm_pm_xfer_end(struct i2c_msm_ctrl *ctrl) i2c_msm_dma_free_channels(ctrl); i2c_msm_pm_clk_disable_unprepare(ctrl); - if (pm_runtime_enabled(ctrl->dev)) { - pm_runtime_mark_last_busy(ctrl->dev); - pm_runtime_put_autosuspend(ctrl->dev); - } else { + + if (!pm_runtime_enabled(ctrl->dev)) i2c_msm_pm_suspend(ctrl->dev); - } + + pm_runtime_mark_last_busy(ctrl->dev); + pm_runtime_put_autosuspend(ctrl->dev); mutex_unlock(&ctrl->xfer.mtx); }