public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm: bridge: Use devm_platform_get_and_ioremap_resource()
@ 2023-01-19  7:59 ye.xingchen
  2023-01-19 17:56 ` Brian Norris
  0 siblings, 1 reply; 2+ messages in thread
From: ye.xingchen @ 2023-01-19  7:59 UTC (permalink / raw)
  To: dianders
  Cc: andrzej.hajda, neil.armstrong, rfoss, laurent.pinchart, jonas,
	jernej.skrabec, airlied, daniel, briannorris, ville.syrjala, sam,
	linmq006, maxime, dri-devel, linux-kernel

From: ye xingchen <ye.xingchen@zte.com.cn>

Convert platform_get_resource(), devm_ioremap_resource() to a single
call to devm_platform_get_and_ioremap_resource(), as this is exactly
what this function does.

Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
---
 drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
index df9370e0ff23..50f092b316d0 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
@@ -1686,7 +1686,6 @@ analogix_dp_probe(struct device *dev, struct analogix_dp_plat_data *plat_data)
 {
 	struct platform_device *pdev = to_platform_device(dev);
 	struct analogix_dp_device *dp;
-	struct resource *res;
 	unsigned int irq_flags;
 	int ret;

@@ -1740,9 +1739,7 @@ analogix_dp_probe(struct device *dev, struct analogix_dp_plat_data *plat_data)

 	clk_prepare_enable(dp->clock);

-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-
-	dp->reg_base = devm_ioremap_resource(&pdev->dev, res);
+	dp->reg_base = devm_platform_get_and_ioremap_resource(pdev, 0, NULL);
 	if (IS_ERR(dp->reg_base)) {
 		ret = PTR_ERR(dp->reg_base);
 		goto err_disable_clk;
-- 
2.25.1

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

* Re: [PATCH] drm: bridge: Use devm_platform_get_and_ioremap_resource()
  2023-01-19  7:59 [PATCH] drm: bridge: Use devm_platform_get_and_ioremap_resource() ye.xingchen
@ 2023-01-19 17:56 ` Brian Norris
  0 siblings, 0 replies; 2+ messages in thread
From: Brian Norris @ 2023-01-19 17:56 UTC (permalink / raw)
  To: ye.xingchen
  Cc: dianders, andrzej.hajda, neil.armstrong, rfoss, laurent.pinchart,
	jonas, jernej.skrabec, airlied, daniel, ville.syrjala, sam,
	linmq006, maxime, dri-devel, linux-kernel

On Thu, Jan 19, 2023 at 03:59:01PM +0800, ye.xingchen@zte.com.cn wrote:
> From: ye xingchen <ye.xingchen@zte.com.cn>
> 
> Convert platform_get_resource(), devm_ioremap_resource() to a single
> call to devm_platform_get_and_ioremap_resource(), as this is exactly
> what this function does.
> 
> Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
> ---
>  drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> index df9370e0ff23..50f092b316d0 100644
> --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> @@ -1686,7 +1686,6 @@ analogix_dp_probe(struct device *dev, struct analogix_dp_plat_data *plat_data)
>  {
>  	struct platform_device *pdev = to_platform_device(dev);
>  	struct analogix_dp_device *dp;
> -	struct resource *res;
>  	unsigned int irq_flags;
>  	int ret;
> 
> @@ -1740,9 +1739,7 @@ analogix_dp_probe(struct device *dev, struct analogix_dp_plat_data *plat_data)
> 
>  	clk_prepare_enable(dp->clock);
> 
> -	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -
> -	dp->reg_base = devm_ioremap_resource(&pdev->dev, res);
> +	dp->reg_base = devm_platform_get_and_ioremap_resource(pdev, 0, NULL);

Rather than a NULL 3rd argument, couldn't you just use
devm_platform_ioremap_resource()? With that:

Reviewed-by: Brian Norris <briannorris@chromium.org>


>  	if (IS_ERR(dp->reg_base)) {
>  		ret = PTR_ERR(dp->reg_base);
>  		goto err_disable_clk;
> -- 
> 2.25.1

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

end of thread, other threads:[~2023-01-19 17:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-19  7:59 [PATCH] drm: bridge: Use devm_platform_get_and_ioremap_resource() ye.xingchen
2023-01-19 17:56 ` Brian Norris

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox