aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWolfram Sang <wsa+renesas@sang-engineering.com>2015-12-16 14:05:18 -0500
committerWolfram Sang <wsa@the-dreams.de>2015-12-19 06:00:37 -0500
commitb4cd08aa1f53c831e67dc5c6bc9f9acff27abcba (patch)
tree58141870b6398365cb1a4b7a98e0b94161e0c0b3
parente79e72c5a242fa21c971cfb40017f1039daf4d77 (diff)
i2c: rcar: disable runtime PM correctly in slave mode
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
-rw-r--r--drivers/i2c/busses/i2c-rcar.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
index b0ae560b38c3..599c0d7bd906 100644
--- a/drivers/i2c/busses/i2c-rcar.c
+++ b/drivers/i2c/busses/i2c-rcar.c
@@ -576,7 +576,7 @@ static int rcar_reg_slave(struct i2c_client *slave)
576 if (slave->flags & I2C_CLIENT_TEN) 576 if (slave->flags & I2C_CLIENT_TEN)
577 return -EAFNOSUPPORT; 577 return -EAFNOSUPPORT;
578 578
579 pm_runtime_forbid(rcar_i2c_priv_to_dev(priv)); 579 pm_runtime_get_sync(rcar_i2c_priv_to_dev(priv));
580 580
581 priv->slave = slave; 581 priv->slave = slave;
582 rcar_i2c_write(priv, ICSAR, slave->addr); 582 rcar_i2c_write(priv, ICSAR, slave->addr);
@@ -598,7 +598,7 @@ static int rcar_unreg_slave(struct i2c_client *slave)
598 598
599 priv->slave = NULL; 599 priv->slave = NULL;
600 600
601 pm_runtime_allow(rcar_i2c_priv_to_dev(priv)); 601 pm_runtime_put(rcar_i2c_priv_to_dev(priv));
602 602
603 return 0; 603 return 0;
604} 604}