Skip to content

Commit

Permalink
i2c: rcar: disable runtime PM correctly in slave mode
Browse files Browse the repository at this point in the history
When we also are I2C slave, we need to disable runtime PM because the
address detection mechanism needs to be active all the time. However, we
can reenable runtime PM once the slave instance was unregistered. So,
use pm_runtime_get_sync/put to achieve this, since it has proper
refcounting. pm_runtime_allow/forbid is like a global knob controllable
from userspace which is unsuitable here.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Cc: stable@kernel.org
  • Loading branch information
Wolfram Sang authored and Wolfram Sang committed Dec 19, 2015
1 parent e79e72c commit b4cd08a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/i2c/busses/i2c-rcar.c
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ static int rcar_reg_slave(struct i2c_client *slave)
if (slave->flags & I2C_CLIENT_TEN)
return -EAFNOSUPPORT;

pm_runtime_forbid(rcar_i2c_priv_to_dev(priv));
pm_runtime_get_sync(rcar_i2c_priv_to_dev(priv));

priv->slave = slave;
rcar_i2c_write(priv, ICSAR, slave->addr);
Expand All @@ -598,7 +598,7 @@ static int rcar_unreg_slave(struct i2c_client *slave)

priv->slave = NULL;

pm_runtime_allow(rcar_i2c_priv_to_dev(priv));
pm_runtime_put(rcar_i2c_priv_to_dev(priv));

return 0;
}
Expand Down

0 comments on commit b4cd08a

Please sign in to comment.