public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "CK Hu (胡俊光)" <ck.hu@mediatek.com>
To: "angelogioacchino.delregno@collabora.com" 
	<angelogioacchino.delregno@collabora.com>,
	"chunkuang.hu@kernel.org" <chunkuang.hu@kernel.org>
Cc: "dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-mediatek@lists.infradead.org" 
	<linux-mediatek@lists.infradead.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
	"kernel@collabora.com" <kernel@collabora.com>
Subject: Re: [PATCH 3/3] drm/mediatek: Use devm variant for pm_runtime_enable() when possible
Date: Tue, 4 Jul 2023 09:24:11 +0000	[thread overview]
Message-ID: <bb1f63502aef836b4fa4e7f49cf8b51445e3edea.camel@mediatek.com> (raw)
In-Reply-To: <20230608101209.126499-4-angelogioacchino.delregno@collabora.com>

Hi, Angelo:

On Thu, 2023-06-08 at 12:12 +0200, AngeloGioacchino Del Regno wrote:
>  	 
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
>  Simplify the error path of return functions and drop the call to
> pm_runtime_disable() in remove functions by switching to
> devm_pm_runtime_enable() where possible.

Reviewed-by: CK Hu <ck.hu@mediatek.com>

> 
> Signed-off-by: AngeloGioacchino Del Regno <
> angelogioacchino.delregno@collabora.com>
> ---
>  drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c |  9 ++++-----
>  drivers/gpu/drm/mediatek/mtk_disp_rdma.c        | 11 ++++-------
>  drivers/gpu/drm/mediatek/mtk_mdp_rdma.c         | 10 +++++-----
>  3 files changed, 13 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c
> b/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c
> index 1993b688befa..14e8ad6c78c3 100644
> --- a/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c
> +++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c
> @@ -519,13 +519,13 @@ static int mtk_disp_ovl_adaptor_probe(struct
> platform_device *pdev)
>  
>  	component_master_add_with_match(dev,
> &mtk_disp_ovl_adaptor_master_ops, match);
>  
> -	pm_runtime_enable(dev);
> +	ret = devm_pm_runtime_enable(dev);
> +	if (ret)
> +		return ret;
>  
>  	ret = component_add(dev, &mtk_disp_ovl_adaptor_comp_ops);
> -	if (ret) {
> -		pm_runtime_disable(dev);
> +	if (ret)
>  		return dev_err_probe(dev, ret, "Failed to add
> component\n");
> -	}
>  
>  	return 0;
>  }
> @@ -533,7 +533,6 @@ static int mtk_disp_ovl_adaptor_probe(struct
> platform_device *pdev)
>  static int mtk_disp_ovl_adaptor_remove(struct platform_device *pdev)
>  {
>  	component_master_del(&pdev->dev,
> &mtk_disp_ovl_adaptor_master_ops);
> -	pm_runtime_disable(&pdev->dev);
>  	return 0;
>  }
>  
> diff --git a/drivers/gpu/drm/mediatek/mtk_disp_rdma.c
> b/drivers/gpu/drm/mediatek/mtk_disp_rdma.c
> index 307be35b59fc..5e90b6d593f5 100644
> --- a/drivers/gpu/drm/mediatek/mtk_disp_rdma.c
> +++ b/drivers/gpu/drm/mediatek/mtk_disp_rdma.c
> @@ -361,13 +361,13 @@ static int mtk_disp_rdma_probe(struct
> platform_device *pdev)
>  
>  	platform_set_drvdata(pdev, priv);
>  
> -	pm_runtime_enable(dev);
> +	ret = devm_pm_runtime_enable(dev);
> +	if (ret)
> +		return ret;
>  
>  	ret = component_add(dev, &mtk_disp_rdma_component_ops);
> -	if (ret) {
> -		pm_runtime_disable(dev);
> +	if (ret)
>  		return dev_err_probe(dev, ret, "Failed to add
> component\n");
> -	}
>  
>  	return 0;
>  }
> @@ -375,9 +375,6 @@ static int mtk_disp_rdma_probe(struct
> platform_device *pdev)
>  static int mtk_disp_rdma_remove(struct platform_device *pdev)
>  {
>  	component_del(&pdev->dev, &mtk_disp_rdma_component_ops);
> -
> -	pm_runtime_disable(&pdev->dev);
> -
>  	return 0;
>  }
>  
> diff --git a/drivers/gpu/drm/mediatek/mtk_mdp_rdma.c
> b/drivers/gpu/drm/mediatek/mtk_mdp_rdma.c
> index ed519b5a3273..93ef05ec9720 100644
> --- a/drivers/gpu/drm/mediatek/mtk_mdp_rdma.c
> +++ b/drivers/gpu/drm/mediatek/mtk_mdp_rdma.c
> @@ -300,20 +300,20 @@ static int mtk_mdp_rdma_probe(struct
> platform_device *pdev)
>  #endif
>  	platform_set_drvdata(pdev, priv);
>  
> -	pm_runtime_enable(dev);
> +	ret = devm_pm_runtime_enable(dev);
> +	if (ret)
> +		return ret;
>  
>  	ret = component_add(dev, &mtk_mdp_rdma_component_ops);
> -	if (ret) {
> -		pm_runtime_disable(dev);
> +	if (ret)
>  		return dev_err_probe(dev, ret, "Failed to add
> component\n");
> -	}
> +
>  	return 0;
>  }
>  
>  static int mtk_mdp_rdma_remove(struct platform_device *pdev)
>  {
>  	component_del(&pdev->dev, &mtk_mdp_rdma_component_ops);
> -	pm_runtime_disable(&pdev->dev);
>  	return 0;
>  }
>  
> -- 
> 2.40.1

      parent reply	other threads:[~2023-07-04  9:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-08 10:12 [PATCH 0/3] drm/mediatek: General cleanups AngeloGioacchino Del Regno
2023-06-08 10:12 ` [PATCH 1/3] drm/mediatek: Use devm_platform_get_and_ioremap_resource() AngeloGioacchino Del Regno
2023-06-21  8:51   ` Alexandre Mergnat
2023-07-04  6:28   ` CK Hu (胡俊光)
2023-06-08 10:12 ` [PATCH 2/3] drm/mediatek: Use dev_err_probe() in probe functions AngeloGioacchino Del Regno
2023-06-21  9:33   ` Alexandre Mergnat
2023-07-04  6:52   ` CK Hu (胡俊光)
2023-06-08 10:12 ` [PATCH 3/3] drm/mediatek: Use devm variant for pm_runtime_enable() when possible AngeloGioacchino Del Regno
2023-06-21  9:36   ` Alexandre Mergnat
2023-07-04  9:24   ` CK Hu (胡俊光) [this message]

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=bb1f63502aef836b4fa4e7f49cf8b51445e3edea.camel@mediatek.com \
    --to=ck.hu@mediatek.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=chunkuang.hu@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kernel@collabora.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@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