diff mbox series

media: amphion: fix an issue that using pm_runtime_get_sync incorrectly

Message ID 20220310063856.9627-1-ming.qian@nxp.com (mailing list archive)
State New, archived
Headers show
Series media: amphion: fix an issue that using pm_runtime_get_sync incorrectly | expand

Commit Message

Ming Qian March 10, 2022, 6:38 a.m. UTC
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>
---
 drivers/media/platform/amphion/vpu_core.c | 8 ++++----
 drivers/media/platform/amphion/vpu_dbg.c  | 2 +-
 drivers/media/platform/amphion/vpu_drv.c  | 6 ------
 3 files changed, 5 insertions(+), 11 deletions(-)
diff mbox series

Patch

diff --git a/drivers/media/platform/amphion/vpu_core.c b/drivers/media/platform/amphion/vpu_core.c
index 016554387f3f..968b578700e3 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);
@@ -650,7 +650,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);
@@ -682,7 +682,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);
@@ -746,7 +746,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 3c12320e1708..376196bea178 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 834ec39640e5..f19f823d4b8c 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 @@  static int vpu_probe(struct platform_device *pdev)
 	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);