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 <shreyv@codeaurora.org>
This commit is contained in:
Shrey Vijay 2016-12-14 15:56:05 +05:30 committed by Gerrit - the friendly Code Review server
parent e379f786aa
commit 1ee08ea3dd

View file

@ -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);
}