lkml.org 
[lkml]   [2021]   [Apr]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 25/78] media: i2c: ccs-core: use pm_runtime_resume_and_get()
    Date
    Commit dd8088d5a896 ("PM: runtime: Add pm_runtime_resume_and_get to deal with usage counter")
    added pm_runtime_resume_and_get() in order to automatically handle
    dev->power.usage_count decrement on errors.

    Use the new API, in order to cleanup the error check logic.

    Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
    ---
    drivers/media/i2c/ccs/ccs-core.c | 11 +++++------
    1 file changed, 5 insertions(+), 6 deletions(-)

    diff --git a/drivers/media/i2c/ccs/ccs-core.c b/drivers/media/i2c/ccs/ccs-core.c
    index 9dc3f45da3dc..1441ddcc9b35 100644
    --- a/drivers/media/i2c/ccs/ccs-core.c
    +++ b/drivers/media/i2c/ccs/ccs-core.c
    @@ -1880,12 +1880,11 @@ static int ccs_pm_get_init(struct ccs_sensor *sensor)
    struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd);
    int rval;

    - rval = pm_runtime_get_sync(&client->dev);
    - if (rval < 0) {
    - pm_runtime_put_noidle(&client->dev);
    -
    + rval = pm_runtime_resume_and_get(&client->dev);
    + if (rval < 0)
    return rval;
    - } else if (!rval) {
    +
    + if (!rval) {
    rval = v4l2_ctrl_handler_setup(&sensor->pixel_array->
    ctrl_handler);
    if (rval)
    @@ -3089,7 +3088,7 @@ static int __maybe_unused ccs_suspend(struct device *dev)
    bool streaming = sensor->streaming;
    int rval;

    - rval = pm_runtime_get_sync(dev);
    + rval = pm_runtime_resume_and_get(dev);
    if (rval < 0) {
    pm_runtime_put_noidle(dev);

    --
    2.30.2
    \
     
     \ /
      Last update: 2021-04-24 08:48    [W:4.193 / U:0.104 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site