lkml.org 
[lkml]   [2016]   [Jan]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 3.19.y-ckt 124/160] i2c: rcar: disable runtime PM correctly in slave mode
    Date
    3.19.8-ckt13 -stable review patch.  If anyone has any objections, please let me know.

    ---8<------------------------------------------------------------

    From: Wolfram Sang <wsa+renesas@sang-engineering.com>

    commit b4cd08aa1f53c831e67dc5c6bc9f9acff27abcba upstream.

    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>
    Signed-off-by: Kamal Mostafa <kamal@canonical.com>
    ---
    drivers/i2c/busses/i2c-rcar.c | 4 ++--
    1 file changed, 2 insertions(+), 2 deletions(-)

    diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
    index 7a37ea1..ac72b21 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)
    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);
    @@ -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;
    }
    --
    1.9.1

    \
     
     \ /
      Last update: 2016-01-20 03:01    [W:4.130 / U:0.428 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site