* [PATCH 60/78] media: camss-csid: use pm_runtime_resume_and_get()
2021-04-24 6:44 [PATCH 00/78] media: use pm_runtime_resume_and_get() instead of pm_runtime_get_sync() Mauro Carvalho Chehab
@ 2021-04-24 6:45 ` Mauro Carvalho Chehab
2021-04-24 6:45 ` [PATCH 61/78] media: camss-csiphy: " Mauro Carvalho Chehab
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Mauro Carvalho Chehab @ 2021-04-24 6:45 UTC (permalink / raw)
Cc: linuxarm, mauro.chehab, Mauro Carvalho Chehab, Andy Gross,
Bjorn Andersson, Mauro Carvalho Chehab, Robert Foss, Todor Tomov,
linux-arm-msm, linux-kernel, linux-media
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/qcom/camss/camss-csid.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/media/platform/qcom/camss/camss-csid.c b/drivers/media/platform/qcom/camss/camss-csid.c
index cc11fbfdae13..d2a7f2a64f26 100644
--- a/drivers/media/platform/qcom/camss/camss-csid.c
+++ b/drivers/media/platform/qcom/camss/camss-csid.c
@@ -156,11 +156,9 @@ static int csid_set_power(struct v4l2_subdev *sd, int on)
int ret;
if (on) {
- ret = pm_runtime_get_sync(dev);
- if (ret < 0) {
- pm_runtime_put_sync(dev);
+ ret = pm_runtime_resume_and_get(dev);
+ if (ret < 0)
return ret;
- }
ret = regulator_enable(csid->vdda);
if (ret < 0) {
--
2.30.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 61/78] media: camss-csiphy: use pm_runtime_resume_and_get()
2021-04-24 6:44 [PATCH 00/78] media: use pm_runtime_resume_and_get() instead of pm_runtime_get_sync() Mauro Carvalho Chehab
2021-04-24 6:45 ` [PATCH 60/78] media: camss-csid: use pm_runtime_resume_and_get() Mauro Carvalho Chehab
@ 2021-04-24 6:45 ` Mauro Carvalho Chehab
2021-04-24 6:45 ` [PATCH 62/78] media: camss-ispif: " Mauro Carvalho Chehab
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Mauro Carvalho Chehab @ 2021-04-24 6:45 UTC (permalink / raw)
Cc: linuxarm, mauro.chehab, Mauro Carvalho Chehab, Andy Gross,
Bjorn Andersson, Mauro Carvalho Chehab, Robert Foss, Todor Tomov,
linux-arm-msm, linux-kernel, linux-media
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/qcom/camss/camss-csiphy.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/media/platform/qcom/camss/camss-csiphy.c b/drivers/media/platform/qcom/camss/camss-csiphy.c
index b3c3bf19e522..8e18b8e668cf 100644
--- a/drivers/media/platform/qcom/camss/camss-csiphy.c
+++ b/drivers/media/platform/qcom/camss/camss-csiphy.c
@@ -197,11 +197,9 @@ static int csiphy_set_power(struct v4l2_subdev *sd, int on)
if (on) {
int ret;
- ret = pm_runtime_get_sync(dev);
- if (ret < 0) {
- pm_runtime_put_sync(dev);
+ ret = pm_runtime_resume_and_get(dev);
+ if (ret < 0)
return ret;
- }
ret = csiphy_set_clock_rates(csiphy);
if (ret < 0) {
--
2.30.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 62/78] media: camss-ispif: use pm_runtime_resume_and_get()
2021-04-24 6:44 [PATCH 00/78] media: use pm_runtime_resume_and_get() instead of pm_runtime_get_sync() Mauro Carvalho Chehab
2021-04-24 6:45 ` [PATCH 60/78] media: camss-csid: use pm_runtime_resume_and_get() Mauro Carvalho Chehab
2021-04-24 6:45 ` [PATCH 61/78] media: camss-csiphy: " Mauro Carvalho Chehab
@ 2021-04-24 6:45 ` Mauro Carvalho Chehab
2021-04-24 6:45 ` [PATCH 63/78] media: camss-vfe: " Mauro Carvalho Chehab
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Mauro Carvalho Chehab @ 2021-04-24 6:45 UTC (permalink / raw)
Cc: linuxarm, mauro.chehab, Mauro Carvalho Chehab, Andy Gross,
Bjorn Andersson, Mauro Carvalho Chehab, Robert Foss, Todor Tomov,
linux-arm-msm, linux-kernel, linux-media
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/qcom/camss/camss-ispif.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/media/platform/qcom/camss/camss-ispif.c b/drivers/media/platform/qcom/camss/camss-ispif.c
index 37611c8861da..d9907742ba79 100644
--- a/drivers/media/platform/qcom/camss/camss-ispif.c
+++ b/drivers/media/platform/qcom/camss/camss-ispif.c
@@ -372,11 +372,9 @@ static int ispif_set_power(struct v4l2_subdev *sd, int on)
goto exit;
}
- ret = pm_runtime_get_sync(dev);
- if (ret < 0) {
- pm_runtime_put_sync(dev);
+ ret = pm_runtime_resume_and_get(dev);
+ if (ret < 0)
goto exit;
- }
ret = camss_enable_clocks(ispif->nclocks, ispif->clock, dev);
if (ret < 0) {
--
2.30.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 63/78] media: camss-vfe: use pm_runtime_resume_and_get()
2021-04-24 6:44 [PATCH 00/78] media: use pm_runtime_resume_and_get() instead of pm_runtime_get_sync() Mauro Carvalho Chehab
` (2 preceding siblings ...)
2021-04-24 6:45 ` [PATCH 62/78] media: camss-ispif: " Mauro Carvalho Chehab
@ 2021-04-24 6:45 ` Mauro Carvalho Chehab
2021-04-24 6:45 ` [PATCH 64/78] media: core: " Mauro Carvalho Chehab
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Mauro Carvalho Chehab @ 2021-04-24 6:45 UTC (permalink / raw)
Cc: linuxarm, mauro.chehab, Mauro Carvalho Chehab, Andy Gross,
Bjorn Andersson, Mauro Carvalho Chehab, Robert Foss, Todor Tomov,
linux-arm-msm, linux-kernel, linux-media
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/qcom/camss/camss-vfe.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/media/platform/qcom/camss/camss-vfe.c b/drivers/media/platform/qcom/camss/camss-vfe.c
index 15695fd466c4..cf743e61f798 100644
--- a/drivers/media/platform/qcom/camss/camss-vfe.c
+++ b/drivers/media/platform/qcom/camss/camss-vfe.c
@@ -584,9 +584,9 @@ static int vfe_get(struct vfe_device *vfe)
if (ret < 0)
goto error_pm_domain;
- ret = pm_runtime_get_sync(vfe->camss->dev);
+ ret = pm_runtime_resume_and_get(vfe->camss->dev);
if (ret < 0)
- goto error_pm_runtime_get;
+ goto error_domain_off;
ret = vfe_set_clock_rates(vfe);
if (ret < 0)
@@ -620,6 +620,7 @@ static int vfe_get(struct vfe_device *vfe)
error_pm_runtime_get:
pm_runtime_put_sync(vfe->camss->dev);
+error_domain_off:
vfe->ops->pm_domain_off(vfe);
error_pm_domain:
--
2.30.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 64/78] media: core: use pm_runtime_resume_and_get()
2021-04-24 6:44 [PATCH 00/78] media: use pm_runtime_resume_and_get() instead of pm_runtime_get_sync() Mauro Carvalho Chehab
` (3 preceding siblings ...)
2021-04-24 6:45 ` [PATCH 63/78] media: camss-vfe: " Mauro Carvalho Chehab
@ 2021-04-24 6:45 ` Mauro Carvalho Chehab
2021-04-24 6:45 ` [PATCH 65/78] media: pm_helpers: " Mauro Carvalho Chehab
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Mauro Carvalho Chehab @ 2021-04-24 6:45 UTC (permalink / raw)
Cc: linuxarm, mauro.chehab, Mauro Carvalho Chehab, Andy Gross,
Bjorn Andersson, Mauro Carvalho Chehab, Stanimir Varbanov,
linux-arm-msm, linux-kernel, linux-media
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/qcom/venus/core.c | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
index 54bac7ec14c5..c156320fa256 100644
--- a/drivers/media/platform/qcom/venus/core.c
+++ b/drivers/media/platform/qcom/venus/core.c
@@ -84,7 +84,7 @@ static void venus_sys_error_handler(struct work_struct *work)
container_of(work, struct venus_core, work.work);
int ret = 0;
- pm_runtime_get_sync(core->dev);
+ pm_runtime_resume_and_get(core->dev);
hfi_core_deinit(core, true);
@@ -106,7 +106,7 @@ static void venus_sys_error_handler(struct work_struct *work)
hfi_reinit(core);
- pm_runtime_get_sync(core->dev);
+ pm_runtime_resume_and_get(core->dev);
ret |= venus_boot(core);
ret |= hfi_core_resume(core, true);
@@ -305,21 +305,21 @@ static int venus_probe(struct platform_device *pdev)
pm_runtime_enable(dev);
- ret = pm_runtime_get_sync(dev);
+ ret = pm_runtime_resume_and_get(dev);
if (ret < 0)
goto err_runtime_disable;
ret = of_platform_populate(dev->of_node, NULL, NULL, dev);
if (ret)
- goto err_runtime_disable;
+ goto err_pm;
ret = venus_firmware_init(core);
if (ret)
- goto err_runtime_disable;
+ goto err_pm;
ret = venus_boot(core);
if (ret)
- goto err_runtime_disable;
+ goto err_pm;
ret = hfi_core_resume(core, true);
if (ret)
@@ -351,8 +351,9 @@ static int venus_probe(struct platform_device *pdev)
v4l2_device_unregister(&core->v4l2_dev);
err_venus_shutdown:
venus_shutdown(core);
-err_runtime_disable:
+err_pm:
pm_runtime_put_noidle(dev);
+err_runtime_disable:
pm_runtime_set_suspended(dev);
pm_runtime_disable(dev);
hfi_destroy(core);
@@ -371,7 +372,7 @@ static int venus_remove(struct platform_device *pdev)
struct device *dev = core->dev;
int ret;
- ret = pm_runtime_get_sync(dev);
+ ret = pm_runtime_resume_and_get(dev);
WARN_ON(ret < 0);
ret = hfi_core_deinit(core, true);
@@ -403,7 +404,7 @@ static void venus_core_shutdown(struct platform_device *pdev)
{
struct venus_core *core = platform_get_drvdata(pdev);
- pm_runtime_get_sync(core->dev);
+ pm_runtime_resume_and_get(core->dev);
venus_shutdown(core);
venus_firmware_deinit(core);
pm_runtime_put_sync(core->dev);
--
2.30.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 65/78] media: pm_helpers: use pm_runtime_resume_and_get()
2021-04-24 6:44 [PATCH 00/78] media: use pm_runtime_resume_and_get() instead of pm_runtime_get_sync() Mauro Carvalho Chehab
` (4 preceding siblings ...)
2021-04-24 6:45 ` [PATCH 64/78] media: core: " Mauro Carvalho Chehab
@ 2021-04-24 6:45 ` Mauro Carvalho Chehab
2021-04-24 6:45 ` [PATCH 66/78] media: vdec: " Mauro Carvalho Chehab
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Mauro Carvalho Chehab @ 2021-04-24 6:45 UTC (permalink / raw)
Cc: linuxarm, mauro.chehab, Mauro Carvalho Chehab, Andy Gross,
Bjorn Andersson, Mauro Carvalho Chehab, Stanimir Varbanov,
linux-arm-msm, linux-kernel, linux-media
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/qcom/venus/pm_helpers.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c
index c7e1ebec47ee..9e32ec866af7 100644
--- a/drivers/media/platform/qcom/venus/pm_helpers.c
+++ b/drivers/media/platform/qcom/venus/pm_helpers.c
@@ -486,7 +486,7 @@ static int poweron_coreid(struct venus_core *core, unsigned int coreid_mask)
int ret;
if (coreid_mask & VIDC_CORE_ID_1) {
- ret = pm_runtime_get_sync(core->pmdomains[1]);
+ ret = pm_runtime_resume_and_get(core->pmdomains[1]);
if (ret < 0)
return ret;
@@ -504,7 +504,7 @@ static int poweron_coreid(struct venus_core *core, unsigned int coreid_mask)
}
if (coreid_mask & VIDC_CORE_ID_2) {
- ret = pm_runtime_get_sync(core->pmdomains[2]);
+ ret = pm_runtime_resume_and_get(core->pmdomains[2]);
if (ret < 0)
return ret;
@@ -990,11 +990,9 @@ static int core_power_v4(struct venus_core *core, int on)
if (on == POWER_ON) {
if (pmctrl) {
- ret = pm_runtime_get_sync(pmctrl);
- if (ret < 0) {
- pm_runtime_put_noidle(pmctrl);
+ ret = pm_runtime_resume_and_get(pmctrl);
+ if (ret < 0)
return ret;
- }
}
ret = core_resets_reset(core);
--
2.30.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 66/78] media: vdec: use pm_runtime_resume_and_get()
2021-04-24 6:44 [PATCH 00/78] media: use pm_runtime_resume_and_get() instead of pm_runtime_get_sync() Mauro Carvalho Chehab
` (5 preceding siblings ...)
2021-04-24 6:45 ` [PATCH 65/78] media: pm_helpers: " Mauro Carvalho Chehab
@ 2021-04-24 6:45 ` Mauro Carvalho Chehab
2021-04-24 6:45 ` [PATCH 67/78] media: venc: " Mauro Carvalho Chehab
2021-04-28 10:13 ` [PATCH 00/78] media: use pm_runtime_resume_and_get() instead of pm_runtime_get_sync() Dan Carpenter
8 siblings, 0 replies; 10+ messages in thread
From: Mauro Carvalho Chehab @ 2021-04-24 6:45 UTC (permalink / raw)
Cc: linuxarm, mauro.chehab, Mauro Carvalho Chehab, Andy Gross,
Bjorn Andersson, Mauro Carvalho Chehab, Stanimir Varbanov,
linux-arm-msm, linux-kernel, linux-media
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/qcom/venus/vdec.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c
index ddb7cd39424e..347e533ea673 100644
--- a/drivers/media/platform/qcom/venus/vdec.c
+++ b/drivers/media/platform/qcom/venus/vdec.c
@@ -568,7 +568,7 @@ static int vdec_pm_get(struct venus_inst *inst)
int ret;
mutex_lock(&core->pm_lock);
- ret = pm_runtime_get_sync(dev);
+ ret = pm_runtime_resume_and_get(dev);
mutex_unlock(&core->pm_lock);
return ret < 0 ? ret : 0;
@@ -601,7 +601,7 @@ static int vdec_pm_get_put(struct venus_inst *inst)
mutex_lock(&core->pm_lock);
if (pm_runtime_suspended(dev)) {
- ret = pm_runtime_get_sync(dev);
+ ret = pm_runtime_resume_and_get(dev);
if (ret < 0)
goto error;
--
2.30.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 67/78] media: venc: use pm_runtime_resume_and_get()
2021-04-24 6:44 [PATCH 00/78] media: use pm_runtime_resume_and_get() instead of pm_runtime_get_sync() Mauro Carvalho Chehab
` (6 preceding siblings ...)
2021-04-24 6:45 ` [PATCH 66/78] media: vdec: " Mauro Carvalho Chehab
@ 2021-04-24 6:45 ` Mauro Carvalho Chehab
2021-04-28 10:13 ` [PATCH 00/78] media: use pm_runtime_resume_and_get() instead of pm_runtime_get_sync() Dan Carpenter
8 siblings, 0 replies; 10+ messages in thread
From: Mauro Carvalho Chehab @ 2021-04-24 6:45 UTC (permalink / raw)
Cc: linuxarm, mauro.chehab, Mauro Carvalho Chehab, Andy Gross,
Bjorn Andersson, Mauro Carvalho Chehab, Stanimir Varbanov,
linux-arm-msm, linux-kernel, linux-media
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/qcom/venus/venc.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c
index 4a7291f934b6..8dd49d4f124c 100644
--- a/drivers/media/platform/qcom/venus/venc.c
+++ b/drivers/media/platform/qcom/venus/venc.c
@@ -1205,9 +1205,9 @@ static int venc_open(struct file *file)
venus_helper_init_instance(inst);
- ret = pm_runtime_get_sync(core->dev_enc);
+ ret = pm_runtime_resume_and_get(core->dev_enc);
if (ret < 0)
- goto err_put_sync;
+ goto err_free;
ret = venc_ctrl_init(inst);
if (ret)
@@ -1252,6 +1252,7 @@ static int venc_open(struct file *file)
venc_ctrl_deinit(inst);
err_put_sync:
pm_runtime_put_sync(core->dev_enc);
+err_free:
kfree(inst);
return ret;
}
--
2.30.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 00/78] media: use pm_runtime_resume_and_get() instead of pm_runtime_get_sync()
2021-04-24 6:44 [PATCH 00/78] media: use pm_runtime_resume_and_get() instead of pm_runtime_get_sync() Mauro Carvalho Chehab
` (7 preceding siblings ...)
2021-04-24 6:45 ` [PATCH 67/78] media: venc: " Mauro Carvalho Chehab
@ 2021-04-28 10:13 ` Dan Carpenter
8 siblings, 0 replies; 10+ messages in thread
From: Dan Carpenter @ 2021-04-28 10:13 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: Shawn Tu, Ricardo Ribalda, Dafna Hirschfeld, Heiko Stuebner,
linuxarm, Todor Tomov, Bjorn Andersson, Andrzej Hajda, Lad,
Prabhakar, Thierry Reding, Pengutronix Kernel Team,
Dmitry Osipenko, linux-stm32, Andrzej Pietrasiewicz, Leon Luo,
Paul Kocialkowski, Mauro Carvalho Chehab, Dave Stevenson,
Matt Ranostay, Krzysztof Kozlowski, Jonathan Hunter,
linux-rockchip, Chen-Yu Tsai, Andy Gross, Matthias Brugger,
Dongchun Zhu, Sakari Ailus, Bingbu Cao, Marek Szyprowski,
Shunqian Zheng, Tianshu Qiu, NXP Linux Team, Philipp Zabel,
devel, Jacopo Mondi, Sylwester Nawrocki, linux-tegra,
Alexandre Torgue, Wenyou Yang, Manivannan Sadhasivam,
linux-arm-msm, Sascha Hauer, Steve Longerbeam, linux-media,
Maxime Ripard, Stanimir Varbanov, Benoit Parrot, Helen Koike,
linux-samsung-soc, linux-mediatek, Jacek Anaszewski,
mauro.chehab, Sylwester Nawrocki, Paul J. Murphy,
Ezequiel Garcia, Daniele Alessandrelli, Chiranjeevi Rapolu,
linux-arm-kernel, Jacob Chen, Jernej Skrabec, Hyungwoo Yang,
linux-kernel, Robert Foss, Dan Scally, Sowjanya Komatineni,
Maxime Coquelin, linux-renesas-soc, Yong Zhi, Shawn Guo
There was a Smatch check for these bugs. This was a good source of
recurring Reported-by tags for me. ;) Thanks for doing this.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 10+ messages in thread