media: amphion: fix an issue that using pm_runtime_get_sync incorrectly
authorMing Qian <ming.qian@nxp.com>
Thu, 10 Mar 2022 06:38:56 +0000 (07:38 +0100)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Fri, 18 Mar 2022 06:29:58 +0000 (07:29 +0100)
pm_runtime_get_sync() also returns 1 on success.
The documentation for pm_runtime_get_sync() suggests using
pm_runtime_resume_and_get() instead

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/media/platform/amphion/vpu_core.c
drivers/media/platform/amphion/vpu_dbg.c
drivers/media/platform/amphion/vpu_drv.c

index 1da2033..24a5a4d 100644 (file)
@@ -359,7 +359,7 @@ struct vpu_core *vpu_request_core(struct vpu_dev *vpu, enum vpu_core_type type)
                goto exit;
 
        mutex_lock(&core->lock);
-       pm_runtime_get_sync(core->dev);
+       pm_runtime_resume_and_get(core->dev);
 
        if (core->state == VPU_CORE_DEINIT) {
                ret = vpu_core_boot(core, true);
@@ -658,7 +658,7 @@ static int vpu_core_probe(struct platform_device *pdev)
        vpu_iface_set_log_buf(core, &core->log);
 
        pm_runtime_enable(dev);
-       ret = pm_runtime_get_sync(dev);
+       ret = pm_runtime_resume_and_get(dev);
        if (ret) {
                pm_runtime_put_noidle(dev);
                pm_runtime_set_suspended(dev);
@@ -690,7 +690,7 @@ static int vpu_core_remove(struct platform_device *pdev)
        int ret;
 
        vpu_core_remove_dbgfs_file(core);
-       ret = pm_runtime_get_sync(dev);
+       ret = pm_runtime_resume_and_get(dev);
        WARN_ON(ret < 0);
 
        vpu_core_shutdown(core);
@@ -754,7 +754,7 @@ static int __maybe_unused vpu_core_resume(struct device *dev)
        int ret = 0;
 
        mutex_lock(&core->lock);
-       pm_runtime_get_sync(dev);
+       pm_runtime_resume_and_get(dev);
        vpu_core_get_vpu(core);
        if (core->state != VPU_CORE_SNAPSHOT)
                goto exit;
index 3c12320..376196b 100644 (file)
@@ -344,7 +344,7 @@ static ssize_t vpu_dbg_core_write(struct file *file,
        struct seq_file *s = file->private_data;
        struct vpu_core *core = s->private;
 
-       pm_runtime_get_sync(core->dev);
+       pm_runtime_resume_and_get(core->dev);
        mutex_lock(&core->lock);
        if (core->state != VPU_CORE_DEINIT && !core->instance_mask) {
                dev_info(core->dev, "reset\n");
index 834ec39..f19f823 100644 (file)
@@ -118,11 +118,6 @@ static int vpu_probe(struct platform_device *pdev)
                return -ENODEV;
 
        pm_runtime_enable(dev);
-       ret = pm_runtime_get_sync(dev);
-       if (ret)
-               goto err_runtime_disable;
-
-       pm_runtime_put_sync(dev);
 
        ret = v4l2_device_register(dev, &vpu->v4l2_dev);
        if (ret)
@@ -149,7 +144,6 @@ err_vpu_media:
        vpu_remove_func(&vpu->decoder);
        v4l2_device_unregister(&vpu->v4l2_dev);
 err_vpu_deinit:
-err_runtime_disable:
        pm_runtime_set_suspended(dev);
        pm_runtime_disable(dev);