linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v5 00/25] media: use pm_runtime_resume_and_get() on non-i2c drivers
@ 2021-05-06 15:25 Mauro Carvalho Chehab
  2021-05-06 15:25 ` [PATCH v5 12/25] media: camss: use pm_runtime_resume_and_get() Mauro Carvalho Chehab
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Mauro Carvalho Chehab @ 2021-05-06 15:25 UTC (permalink / raw)
  Cc: linuxarm, mauro.chehab, Mauro Carvalho Chehab, Alexandre Torgue,
	Andrzej Hajda, Andy Gross, Benoit Parrot, Bingbu Cao,
	Bjorn Andersson, Chen-Yu Tsai, Dafna Hirschfeld, Dan Scally,
	Dmitry Osipenko, Ezequiel Garcia, Fabio Estevam, Heiko Stuebner,
	Helen Koike, Jacob Chen, Jernej Skrabec, Jonathan Hunter,
	Matthias Brugger, Mauro Carvalho Chehab, Maxime Coquelin,
	Maxime Ripard, NXP Linux Team, Paul Kocialkowski,
	Pengutronix Kernel Team, Philipp Zabel, Robert Foss,
	Rui Miguel Silva, Sakari Ailus, Sascha Hauer, Shawn Guo,
	Sowjanya Komatineni, Stanimir Varbanov, Steve Longerbeam,
	Sylwester Nawrocki, Thierry Reding, Tianshu Qiu, Todor Tomov,
	Yong Zhi, linux-arm-kernel, linux-arm-msm, linux-kernel,
	linux-media, linux-mediatek, linux-renesas-soc, linux-rockchip,
	linux-samsung-soc, linux-staging, linux-stm32, linux-sunxi,
	linux-tegra

Dealing with PM runtime (RPM) is different than dealing with other kAPIs used
on media, as most pm_runtime_get_*() functions won't return to the the state
before the call if an error rises. They, instead, increment an usage_count.

Due to that, there were several bugs on media. Just on this review, we found
24 such errors.

So, let's use pm_runtime_resume_and_get() whenever possible, as it
has two advantages over :

1. On errors, it decrements the usage count;
2. It always return zero on success or an error code. This prevents a
   common error pattern of checking if ret is not zero to identify
   for errors.

There are however a few places where calls to pm_runtime_get_sync()
are kept. On several of those, a comment was added, in order to
help preventing trivial patches that could try to change them.

PS.: This series was submitted already together with the fix patches
at:

   	https://lore.kernel.org/linux-media/cover.1619621413.git.mchehab+huawei@kernel.org/

I opted to break it on 3 parts, in order to make easier to review.

This is the third (and final) part.

Mauro Carvalho Chehab (25):
  staging: media: imx7-mipi-csis: use pm_runtime_resume_and_get()
  staging: media: atomisp: use pm_runtime_resume_and_get()
  staging: media: ipu3: use pm_runtime_resume_and_get()
  staging: media: cedrus_video: use pm_runtime_resume_and_get()
  staging: media: tegra-vde: use pm_runtime_resume_and_get()
  staging: media: tegra-video: use pm_runtime_resume_and_get()
  media: rockchip/rga: use pm_runtime_resume_and_get()
  media: sti/hva: use pm_runtime_resume_and_get()
  media: ipu3: use pm_runtime_resume_and_get()
  media: coda: use pm_runtime_resume_and_get()
  media: mtk-jpeg: use pm_runtime_resume_and_get()
  media: camss: use pm_runtime_resume_and_get()
  media: venus: core: use pm_runtime_resume_and_get()
  media: venus: vdec: use pm_runtime_resume_and_get()
  media: venus: venc: use pm_runtime_resume_and_get()
  media: rcar-fcp: use pm_runtime_resume_and_get()
  media: rkisp1: use pm_runtime_resume_and_get()
  media: s3c-camif: use pm_runtime_resume_and_get()
  media: s5p-mfc: use pm_runtime_resume_and_get()
  media: stm32: use pm_runtime_resume_and_get()
  media: sunxi: use pm_runtime_resume_and_get()
  media: ti-vpe: use pm_runtime_resume_and_get()
  media: vsp1: use pm_runtime_resume_and_get()
  media: rcar-vin: use pm_runtime_resume_and_get()
  media: hantro: use pm_runtime_resume_and_get()

 drivers/media/pci/intel/ipu3/ipu3-cio2-main.c |  3 +--
 drivers/media/platform/coda/coda-common.c     |  7 ++++---
 .../media/platform/mtk-jpeg/mtk_jpeg_core.c   |  4 ++--
 .../media/platform/qcom/camss/camss-csid.c    |  6 ++----
 .../media/platform/qcom/camss/camss-csiphy.c  |  6 ++----
 .../media/platform/qcom/camss/camss-ispif.c   |  6 ++----
 drivers/media/platform/qcom/camss/camss-vfe.c |  5 +++--
 .../media/platform/qcom/venus/pm_helpers.c    |  3 +--
 drivers/media/platform/qcom/venus/vdec.c      |  6 +++---
 drivers/media/platform/qcom/venus/venc.c      |  5 +++--
 drivers/media/platform/rcar-fcp.c             |  8 +------
 drivers/media/platform/rcar-vin/rcar-csi2.c   | 15 ++++++++++---
 drivers/media/platform/rcar-vin/rcar-dma.c    |  6 ++----
 drivers/media/platform/rcar-vin/rcar-v4l2.c   |  6 ++----
 drivers/media/platform/rockchip/rga/rga-buf.c |  3 +--
 drivers/media/platform/rockchip/rga/rga.c     |  4 +++-
 .../platform/rockchip/rkisp1/rkisp1-capture.c |  3 +--
 .../media/platform/s3c-camif/camif-capture.c  |  2 +-
 drivers/media/platform/s3c-camif/camif-core.c |  5 +++--
 drivers/media/platform/s5p-mfc/s5p_mfc_pm.c   |  6 ++----
 drivers/media/platform/sti/hva/hva-hw.c       | 17 ++++++++-------
 drivers/media/platform/stm32/stm32-dcmi.c     |  5 +++--
 .../platform/sunxi/sun4i-csi/sun4i_v4l2.c     |  6 ++++--
 drivers/media/platform/ti-vpe/cal-video.c     |  4 +++-
 drivers/media/platform/ti-vpe/cal.c           |  8 ++++---
 drivers/media/platform/ti-vpe/vpe.c           |  8 +++----
 drivers/media/platform/vsp1/vsp1_drv.c        | 10 +--------
 .../staging/media/atomisp/pci/atomisp_fops.c  |  6 +++---
 drivers/staging/media/hantro/hantro_drv.c     |  5 ++---
 drivers/staging/media/imx/imx7-mipi-csis.c    |  7 +++----
 drivers/staging/media/ipu3/ipu3.c             |  3 +--
 .../staging/media/sunxi/cedrus/cedrus_video.c |  6 ++----
 drivers/staging/media/tegra-vde/vde.c         | 21 ++++++++++++++++---
 drivers/staging/media/tegra-video/csi.c       |  3 +--
 drivers/staging/media/tegra-video/vi.c        |  3 +--
 35 files changed, 110 insertions(+), 111 deletions(-)

-- 
2.30.2



^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v5 12/25] media: camss: use pm_runtime_resume_and_get()
  2021-05-06 15:25 [PATCH v5 00/25] media: use pm_runtime_resume_and_get() on non-i2c drivers Mauro Carvalho Chehab
@ 2021-05-06 15:25 ` Mauro Carvalho Chehab
  2021-05-06 15:25 ` [PATCH v5 13/25] media: venus: core: " Mauro Carvalho Chehab
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 11+ messages in thread
From: Mauro Carvalho Chehab @ 2021-05-06 15:25 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.

Reviewed-by: Robert Foss <robert.foss@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
---
 drivers/media/platform/qcom/camss/camss-csid.c   | 6 ++----
 drivers/media/platform/qcom/camss/camss-csiphy.c | 6 ++----
 drivers/media/platform/qcom/camss/camss-ispif.c  | 6 ++----
 drivers/media/platform/qcom/camss/camss-vfe.c    | 5 +++--
 4 files changed, 9 insertions(+), 14 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) {
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) {
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) {
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] 11+ messages in thread

* [PATCH v5 13/25] media: venus: core: use pm_runtime_resume_and_get()
  2021-05-06 15:25 [PATCH v5 00/25] media: use pm_runtime_resume_and_get() on non-i2c drivers Mauro Carvalho Chehab
  2021-05-06 15:25 ` [PATCH v5 12/25] media: camss: use pm_runtime_resume_and_get() Mauro Carvalho Chehab
@ 2021-05-06 15:25 ` Mauro Carvalho Chehab
  2021-05-10 13:54   ` Stanimir Varbanov
  2021-05-06 15:25 ` [PATCH v5 14/25] media: venus: vdec: " Mauro Carvalho Chehab
  2021-05-06 15:25 ` [PATCH v5 15/25] media: venus: venc: " Mauro Carvalho Chehab
  3 siblings, 1 reply; 11+ messages in thread
From: Mauro Carvalho Chehab @ 2021-05-06 15:25 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 | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c
index c7e1ebec47ee..d0fddf5e9a69 100644
--- a/drivers/media/platform/qcom/venus/pm_helpers.c
+++ b/drivers/media/platform/qcom/venus/pm_helpers.c
@@ -990,9 +990,8 @@ static int core_power_v4(struct venus_core *core, int on)
 
 	if (on == POWER_ON) {
 		if (pmctrl) {
-			ret = pm_runtime_get_sync(pmctrl);
+			ret = pm_runtime_resume_and_get(pmctrl);
 			if (ret < 0) {
-				pm_runtime_put_noidle(pmctrl);
 				return ret;
 			}
 		}
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v5 14/25] media: venus: vdec: use pm_runtime_resume_and_get()
  2021-05-06 15:25 [PATCH v5 00/25] media: use pm_runtime_resume_and_get() on non-i2c drivers Mauro Carvalho Chehab
  2021-05-06 15:25 ` [PATCH v5 12/25] media: camss: use pm_runtime_resume_and_get() Mauro Carvalho Chehab
  2021-05-06 15:25 ` [PATCH v5 13/25] media: venus: core: " Mauro Carvalho Chehab
@ 2021-05-06 15:25 ` Mauro Carvalho Chehab
  2021-05-10 13:55   ` Stanimir Varbanov
  2021-05-06 15:25 ` [PATCH v5 15/25] media: venus: venc: " Mauro Carvalho Chehab
  3 siblings, 1 reply; 11+ messages in thread
From: Mauro Carvalho Chehab @ 2021-05-06 15:25 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.

As a bonus, there's no need to check if ret == 1, as
pm_runtime_resume_and_get() always return 0 on success.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
---
 drivers/media/platform/qcom/venus/vdec.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c
index ddb7cd39424e..198e47eb63f4 100644
--- a/drivers/media/platform/qcom/venus/vdec.c
+++ b/drivers/media/platform/qcom/venus/vdec.c
@@ -568,10 +568,10 @@ 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;
+	return ret;
 }
 
 static int vdec_pm_put(struct venus_inst *inst, bool autosuspend)
@@ -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] 11+ messages in thread

* [PATCH v5 15/25] media: venus: venc: use pm_runtime_resume_and_get()
  2021-05-06 15:25 [PATCH v5 00/25] media: use pm_runtime_resume_and_get() on non-i2c drivers Mauro Carvalho Chehab
                   ` (2 preceding siblings ...)
  2021-05-06 15:25 ` [PATCH v5 14/25] media: venus: vdec: " Mauro Carvalho Chehab
@ 2021-05-06 15:25 ` Mauro Carvalho Chehab
  2021-05-10 13:55   ` Stanimir Varbanov
  3 siblings, 1 reply; 11+ messages in thread
From: Mauro Carvalho Chehab @ 2021-05-06 15:25 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] 11+ messages in thread

* Re: [PATCH v5 13/25] media: venus: core: use pm_runtime_resume_and_get()
  2021-05-06 15:25 ` [PATCH v5 13/25] media: venus: core: " Mauro Carvalho Chehab
@ 2021-05-10 13:54   ` Stanimir Varbanov
  2021-05-17 15:26     ` Stanimir Varbanov
  0 siblings, 1 reply; 11+ messages in thread
From: Stanimir Varbanov @ 2021-05-10 13:54 UTC (permalink / raw)
  To: Mauro Carvalho Chehab
  Cc: linuxarm, mauro.chehab, Andy Gross, Bjorn Andersson,
	Mauro Carvalho Chehab, Stanimir Varbanov, linux-arm-msm,
	linux-kernel, linux-media



On 5/6/21 6:25 PM, Mauro Carvalho Chehab wrote:
> 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 | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Tested-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Acked-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>

> 
> diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c
> index c7e1ebec47ee..d0fddf5e9a69 100644
> --- a/drivers/media/platform/qcom/venus/pm_helpers.c
> +++ b/drivers/media/platform/qcom/venus/pm_helpers.c
> @@ -990,9 +990,8 @@ static int core_power_v4(struct venus_core *core, int on)
>  
>  	if (on == POWER_ON) {
>  		if (pmctrl) {
> -			ret = pm_runtime_get_sync(pmctrl);
> +			ret = pm_runtime_resume_and_get(pmctrl);
>  			if (ret < 0) {
> -				pm_runtime_put_noidle(pmctrl);
>  				return ret;
>  			}
>  		}
> 

-- 
regards,
Stan

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v5 14/25] media: venus: vdec: use pm_runtime_resume_and_get()
  2021-05-06 15:25 ` [PATCH v5 14/25] media: venus: vdec: " Mauro Carvalho Chehab
@ 2021-05-10 13:55   ` Stanimir Varbanov
  0 siblings, 0 replies; 11+ messages in thread
From: Stanimir Varbanov @ 2021-05-10 13:55 UTC (permalink / raw)
  To: Mauro Carvalho Chehab
  Cc: linuxarm, mauro.chehab, Andy Gross, Bjorn Andersson,
	Mauro Carvalho Chehab, Stanimir Varbanov, linux-arm-msm,
	linux-kernel, linux-media



On 5/6/21 6:25 PM, Mauro Carvalho Chehab wrote:
> 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.
> 
> As a bonus, there's no need to check if ret == 1, as
> pm_runtime_resume_and_get() always return 0 on success.
> 
> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
> ---
>  drivers/media/platform/qcom/venus/vdec.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

Tested-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Acked-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>


-- 
regards,
Stan

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v5 15/25] media: venus: venc: use pm_runtime_resume_and_get()
  2021-05-06 15:25 ` [PATCH v5 15/25] media: venus: venc: " Mauro Carvalho Chehab
@ 2021-05-10 13:55   ` Stanimir Varbanov
  0 siblings, 0 replies; 11+ messages in thread
From: Stanimir Varbanov @ 2021-05-10 13:55 UTC (permalink / raw)
  To: Mauro Carvalho Chehab
  Cc: linuxarm, mauro.chehab, Andy Gross, Bjorn Andersson,
	Mauro Carvalho Chehab, Stanimir Varbanov, linux-arm-msm,
	linux-kernel, linux-media



On 5/6/21 6:25 PM, Mauro Carvalho Chehab wrote:
> 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(-)

Tested-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Acked-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>


-- 
regards,
Stan

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v5 13/25] media: venus: core: use pm_runtime_resume_and_get()
  2021-05-10 13:54   ` Stanimir Varbanov
@ 2021-05-17 15:26     ` Stanimir Varbanov
  2021-05-18 15:20       ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 11+ messages in thread
From: Stanimir Varbanov @ 2021-05-17 15:26 UTC (permalink / raw)
  To: Mauro Carvalho Chehab
  Cc: linuxarm, mauro.chehab, Andy Gross, Bjorn Andersson,
	Mauro Carvalho Chehab, linux-arm-msm, linux-kernel, linux-media

Hi Mauro,

On 5/10/21 4:54 PM, Stanimir Varbanov wrote:
> 
> 
> On 5/6/21 6:25 PM, Mauro Carvalho Chehab wrote:
>> 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 | 3 +--
>>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> Tested-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
> Acked-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
> 

What is the plan for these venus patches. Do I need to take them through
my Venus pull request for v5.14 or you will take them directly?

>>
>> diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c
>> index c7e1ebec47ee..d0fddf5e9a69 100644
>> --- a/drivers/media/platform/qcom/venus/pm_helpers.c
>> +++ b/drivers/media/platform/qcom/venus/pm_helpers.c
>> @@ -990,9 +990,8 @@ static int core_power_v4(struct venus_core *core, int on)
>>  
>>  	if (on == POWER_ON) {
>>  		if (pmctrl) {
>> -			ret = pm_runtime_get_sync(pmctrl);
>> +			ret = pm_runtime_resume_and_get(pmctrl);
>>  			if (ret < 0) {
>> -				pm_runtime_put_noidle(pmctrl);
>>  				return ret;
>>  			}
>>  		}
>>
> 

-- 
regards,
Stan

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v5 13/25] media: venus: core: use pm_runtime_resume_and_get()
  2021-05-17 15:26     ` Stanimir Varbanov
@ 2021-05-18 15:20       ` Mauro Carvalho Chehab
  2021-05-18 15:49         ` Stanimir Varbanov
  0 siblings, 1 reply; 11+ messages in thread
From: Mauro Carvalho Chehab @ 2021-05-18 15:20 UTC (permalink / raw)
  To: Stanimir Varbanov
  Cc: linuxarm, mauro.chehab, Andy Gross, Bjorn Andersson,
	Mauro Carvalho Chehab, linux-arm-msm, linux-kernel, linux-media

Em Mon, 17 May 2021 18:26:14 +0300
Stanimir Varbanov <stanimir.varbanov@linaro.org> escreveu:

> Hi Mauro,
> 
> On 5/10/21 4:54 PM, Stanimir Varbanov wrote:
> > 
> > 
> > On 5/6/21 6:25 PM, Mauro Carvalho Chehab wrote:  
> >> 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 | 3 +--
> >>  1 file changed, 1 insertion(+), 2 deletions(-)  
> > 
> > Tested-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
> > Acked-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
> >   
> 
> What is the plan for these venus patches. Do I need to take them through
> my Venus pull request for v5.14 or you will take them directly?

Whatever works best for you. In principle, I should apply them on my
tree probably tomorrow, if ok for you.

Regards,
Mauro

> 
> >>
> >> diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c
> >> index c7e1ebec47ee..d0fddf5e9a69 100644
> >> --- a/drivers/media/platform/qcom/venus/pm_helpers.c
> >> +++ b/drivers/media/platform/qcom/venus/pm_helpers.c
> >> @@ -990,9 +990,8 @@ static int core_power_v4(struct venus_core *core, int on)
> >>  
> >>  	if (on == POWER_ON) {
> >>  		if (pmctrl) {
> >> -			ret = pm_runtime_get_sync(pmctrl);
> >> +			ret = pm_runtime_resume_and_get(pmctrl);
> >>  			if (ret < 0) {
> >> -				pm_runtime_put_noidle(pmctrl);
> >>  				return ret;
> >>  			}
> >>  		}
> >>  
> >   
> 



Thanks,
Mauro

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v5 13/25] media: venus: core: use pm_runtime_resume_and_get()
  2021-05-18 15:20       ` Mauro Carvalho Chehab
@ 2021-05-18 15:49         ` Stanimir Varbanov
  0 siblings, 0 replies; 11+ messages in thread
From: Stanimir Varbanov @ 2021-05-18 15:49 UTC (permalink / raw)
  To: Mauro Carvalho Chehab
  Cc: linuxarm, mauro.chehab, Andy Gross, Bjorn Andersson,
	Mauro Carvalho Chehab, linux-arm-msm, linux-kernel, linux-media

Hi Mauro,

On 5/18/21 6:20 PM, Mauro Carvalho Chehab wrote:
> Em Mon, 17 May 2021 18:26:14 +0300
> Stanimir Varbanov <stanimir.varbanov@linaro.org> escreveu:
> 
>> Hi Mauro,
>>
>> On 5/10/21 4:54 PM, Stanimir Varbanov wrote:
>>>
>>>
>>> On 5/6/21 6:25 PM, Mauro Carvalho Chehab wrote:  
>>>> 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 | 3 +--
>>>>  1 file changed, 1 insertion(+), 2 deletions(-)  
>>>
>>> Tested-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
>>> Acked-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
>>>   
>>
>> What is the plan for these venus patches. Do I need to take them through
>> my Venus pull request for v5.14 or you will take them directly?
> 
> Whatever works best for you. In principle, I should apply them on my
> tree probably tomorrow, if ok for you.
> 

It is perfectly fine, please apply them. Thank you!

-- 
regards,
Stan

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-05-18 15:49 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-06 15:25 [PATCH v5 00/25] media: use pm_runtime_resume_and_get() on non-i2c drivers Mauro Carvalho Chehab
2021-05-06 15:25 ` [PATCH v5 12/25] media: camss: use pm_runtime_resume_and_get() Mauro Carvalho Chehab
2021-05-06 15:25 ` [PATCH v5 13/25] media: venus: core: " Mauro Carvalho Chehab
2021-05-10 13:54   ` Stanimir Varbanov
2021-05-17 15:26     ` Stanimir Varbanov
2021-05-18 15:20       ` Mauro Carvalho Chehab
2021-05-18 15:49         ` Stanimir Varbanov
2021-05-06 15:25 ` [PATCH v5 14/25] media: venus: vdec: " Mauro Carvalho Chehab
2021-05-10 13:55   ` Stanimir Varbanov
2021-05-06 15:25 ` [PATCH v5 15/25] media: venus: venc: " Mauro Carvalho Chehab
2021-05-10 13:55   ` Stanimir Varbanov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).