OSDN Git Service

media: mtk-jpeg: use pm_runtime_resume_and_get()
authorMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Fri, 23 Apr 2021 15:19:18 +0000 (17:19 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Wed, 19 May 2021 07:51:42 +0000 (09:51 +0200)
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/platform/mtk-jpeg/mtk_jpeg_core.c

index 88a23bc..a89c7b2 100644 (file)
@@ -920,7 +920,7 @@ static void mtk_jpeg_enc_device_run(void *priv)
        src_buf = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx);
        dst_buf = v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx);
 
-       ret = pm_runtime_get_sync(jpeg->dev);
+       ret = pm_runtime_resume_and_get(jpeg->dev);
        if (ret < 0)
                goto enc_end;
 
@@ -973,7 +973,7 @@ static void mtk_jpeg_dec_device_run(void *priv)
                return;
        }
 
-       ret = pm_runtime_get_sync(jpeg->dev);
+       ret = pm_runtime_resume_and_get(jpeg->dev);
        if (ret < 0)
                goto dec_end;