From: Ming Qian Date: Thu, 10 Mar 2022 06:38:56 +0000 (+0100) Subject: media: amphion: fix an issue that using pm_runtime_get_sync incorrectly X-Git-Tag: v5.18-rc1~153^2~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f445014a2291fbee864754dfec8df42e2a44eb91;p=thirdparty%2Fkernel%2Flinux.git media: amphion: fix an issue that using pm_runtime_get_sync incorrectly 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 Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/platform/amphion/vpu_core.c b/drivers/media/platform/amphion/vpu_core.c index 1da20335bc45d..24a5a4d5af207 100644 --- a/drivers/media/platform/amphion/vpu_core.c +++ b/drivers/media/platform/amphion/vpu_core.c @@ -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; diff --git a/drivers/media/platform/amphion/vpu_dbg.c b/drivers/media/platform/amphion/vpu_dbg.c index 3c12320e17080..376196bea1787 100644 --- a/drivers/media/platform/amphion/vpu_dbg.c +++ b/drivers/media/platform/amphion/vpu_dbg.c @@ -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"); diff --git a/drivers/media/platform/amphion/vpu_drv.c b/drivers/media/platform/amphion/vpu_drv.c index 834ec39640e5a..f19f823d4b8c4 100644 --- a/drivers/media/platform/amphion/vpu_drv.c +++ b/drivers/media/platform/amphion/vpu_drv.c @@ -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);