From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Cc: <linuxarm@huawei.com>, <mauro.chehab@huawei.com>,
Dmitry Osipenko <digetx@gmail.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Jonathan Hunter" <jonathanh@nvidia.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Thierry Reding <thierry.reding@gmail.com>,
<devel@driverdev.osuosl.org>, <linux-kernel@vger.kernel.org>,
<linux-media@vger.kernel.org>, <linux-tegra@vger.kernel.org>
Subject: Re: [PATCH v4 25/79] staging: media: tegra-vde: use pm_runtime_resume_and_get()
Date: Fri, 30 Apr 2021 18:08:36 +0100 [thread overview]
Message-ID: <20210430180836.00006da4@Huawei.com> (raw)
In-Reply-To: <bc2b9048d4ad510eec97988ce8f3fd0d2bb26f39.1619621413.git.mchehab+huawei@kernel.org>
On Wed, 28 Apr 2021 16:51:46 +0200
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> 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>
LGTM
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> ---
> drivers/staging/media/tegra-vde/vde.c | 19 ++++++++++++++++---
> 1 file changed, 16 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/staging/media/tegra-vde/vde.c b/drivers/staging/media/tegra-vde/vde.c
> index 28845b5bafaf..1cdacb3f781c 100644
> --- a/drivers/staging/media/tegra-vde/vde.c
> +++ b/drivers/staging/media/tegra-vde/vde.c
> @@ -775,9 +775,9 @@ static int tegra_vde_ioctl_decode_h264(struct tegra_vde *vde,
> if (ret)
> goto release_dpb_frames;
>
> - ret = pm_runtime_get_sync(dev);
> + ret = pm_runtime_resume_and_get(dev);
> if (ret < 0)
> - goto put_runtime_pm;
> + goto unlock;
>
> /*
> * We rely on the VDE registers reset value, otherwise VDE
> @@ -843,6 +843,8 @@ static int tegra_vde_ioctl_decode_h264(struct tegra_vde *vde,
> put_runtime_pm:
> pm_runtime_mark_last_busy(dev);
> pm_runtime_put_autosuspend(dev);
> +
> +unlock:
> mutex_unlock(&vde->lock);
>
> release_dpb_frames:
> @@ -1069,11 +1071,17 @@ static int tegra_vde_probe(struct platform_device *pdev)
> * power-cycle it in order to put hardware into a predictable lower
> * power state.
> */
> - pm_runtime_get_sync(dev);
> + if (pm_runtime_resume_and_get(dev) < 0)
> + goto err_pm_runtime;
> +
> pm_runtime_put(dev);
>
> return 0;
>
> +err_pm_runtime:
> + pm_runtime_dont_use_autosuspend(dev);
> + pm_runtime_disable(dev);
> +
> err_deinit_iommu:
> tegra_vde_iommu_deinit(vde);
>
> @@ -1089,7 +1097,12 @@ static int tegra_vde_remove(struct platform_device *pdev)
> struct tegra_vde *vde = platform_get_drvdata(pdev);
> struct device *dev = &pdev->dev;
>
> + /*
> + * As it increments RPM usage_count even on errors, we don't need to
> + * check the returned code here.
> + */
> pm_runtime_get_sync(dev);
> +
> pm_runtime_dont_use_autosuspend(dev);
> pm_runtime_disable(dev);
>
next prev parent reply other threads:[~2021-04-30 17:10 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-28 14:51 [PATCH v4 00/79] Address some issues with PM runtime at media subsystem Mauro Carvalho Chehab
2021-04-28 14:51 ` [PATCH v4 25/79] staging: media: tegra-vde: use pm_runtime_resume_and_get() Mauro Carvalho Chehab
2021-04-29 12:38 ` Dmitry Osipenko
2021-04-30 17:08 ` Jonathan Cameron [this message]
2021-04-30 17:11 ` Jonathan Cameron
2021-04-28 14:51 ` [PATCH v4 26/79] staging: media: tegra-video: " Mauro Carvalho Chehab
2021-04-30 17:13 ` Jonathan Cameron
2021-04-28 15:50 ` [PATCH v4 00/79] Address some issues with PM runtime at media subsystem Johan Hovold
2021-04-29 10:18 ` Mauro Carvalho Chehab
2021-04-29 12:33 ` Dmitry Osipenko
2021-04-29 15:17 ` Johan Hovold
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210430180836.00006da4@Huawei.com \
--to=jonathan.cameron@huawei.com \
--cc=devel@driverdev.osuosl.org \
--cc=digetx@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=jonathanh@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=mauro.chehab@huawei.com \
--cc=mchehab+huawei@kernel.org \
--cc=mchehab@kernel.org \
--cc=thierry.reding@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox