Linux-remoteproc Archive mirror
 help / color / mirror / Atom feed
* [PATCH] remoteproc: Use devm_platform_ioremap_resource_byname() helper function
@ 2024-09-05 12:05 Zhang Zekun
  2024-09-05 16:29 ` Mathieu Poirier
  0 siblings, 1 reply; 2+ messages in thread
From: Zhang Zekun @ 2024-09-05 12:05 UTC (permalink / raw)
  To: patrice.chotard, andersson, mathieu.poirier, linux-remoteproc
  Cc: zhangzekun11

platform_get_resource_byname() and devm_ioremap_resource() can be
replaced by devm_platform_ioremap_resource_byname(), which can
simplify the code logic a bit, No functional change here.

Signed-off-by: Zhang Zekun <zhangzekun11@huawei.com>
---
 drivers/remoteproc/st_slim_rproc.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/remoteproc/st_slim_rproc.c b/drivers/remoteproc/st_slim_rproc.c
index d17719384c16..5412beb0a692 100644
--- a/drivers/remoteproc/st_slim_rproc.c
+++ b/drivers/remoteproc/st_slim_rproc.c
@@ -259,16 +259,14 @@ struct st_slim_rproc *st_slim_rproc_alloc(struct platform_device *pdev,
 		slim_rproc->mem[i].size = resource_size(res);
 	}
 
-	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "slimcore");
-	slim_rproc->slimcore = devm_ioremap_resource(dev, res);
+	slim_rproc->slimcore = devm_platform_ioremap_resource_byname(pdev, "slimcore");
 	if (IS_ERR(slim_rproc->slimcore)) {
 		dev_err(&pdev->dev, "failed to ioremap slimcore IO\n");
 		err = PTR_ERR(slim_rproc->slimcore);
 		goto err;
 	}
 
-	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "peripherals");
-	slim_rproc->peri = devm_ioremap_resource(dev, res);
+	slim_rproc->peri = devm_platform_ioremap_resource_byname(pdev, "peripherals");
 	if (IS_ERR(slim_rproc->peri)) {
 		dev_err(&pdev->dev, "failed to ioremap peripherals IO\n");
 		err = PTR_ERR(slim_rproc->peri);
-- 
2.17.1


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

* Re: [PATCH] remoteproc: Use devm_platform_ioremap_resource_byname() helper function
  2024-09-05 12:05 [PATCH] remoteproc: Use devm_platform_ioremap_resource_byname() helper function Zhang Zekun
@ 2024-09-05 16:29 ` Mathieu Poirier
  0 siblings, 0 replies; 2+ messages in thread
From: Mathieu Poirier @ 2024-09-05 16:29 UTC (permalink / raw)
  To: Zhang Zekun; +Cc: patrice.chotard, andersson, linux-remoteproc

Hi,

On Thu, Sep 05, 2024 at 08:05:01PM +0800, Zhang Zekun wrote:
> platform_get_resource_byname() and devm_ioremap_resource() can be
> replaced by devm_platform_ioremap_resource_byname(), which can
> simplify the code logic a bit, No functional change here.
> 
> Signed-off-by: Zhang Zekun <zhangzekun11@huawei.com>
> ---
>  drivers/remoteproc/st_slim_rproc.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/remoteproc/st_slim_rproc.c b/drivers/remoteproc/st_slim_rproc.c
> index d17719384c16..5412beb0a692 100644
> --- a/drivers/remoteproc/st_slim_rproc.c
> +++ b/drivers/remoteproc/st_slim_rproc.c
> @@ -259,16 +259,14 @@ struct st_slim_rproc *st_slim_rproc_alloc(struct platform_device *pdev,
>  		slim_rproc->mem[i].size = resource_size(res);
>  	}
>  
> -	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "slimcore");
> -	slim_rproc->slimcore = devm_ioremap_resource(dev, res);
> +	slim_rproc->slimcore = devm_platform_ioremap_resource_byname(pdev, "slimcore");
>  	if (IS_ERR(slim_rproc->slimcore)) {
>  		dev_err(&pdev->dev, "failed to ioremap slimcore IO\n");
>  		err = PTR_ERR(slim_rproc->slimcore);
>  		goto err;
>  	}
>  
> -	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "peripherals");
> -	slim_rproc->peri = devm_ioremap_resource(dev, res);
> +	slim_rproc->peri = devm_platform_ioremap_resource_byname(pdev, "peripherals");

There are several instances of the above in other drivers of the remoteproc
susbsystem.  Please send another patch with those corrected as well.

Thanks,
Mathieu

>  	if (IS_ERR(slim_rproc->peri)) {
>  		dev_err(&pdev->dev, "failed to ioremap peripherals IO\n");
>  		err = PTR_ERR(slim_rproc->peri);
> -- 
> 2.17.1
> 

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

end of thread, other threads:[~2024-09-05 16:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-05 12:05 [PATCH] remoteproc: Use devm_platform_ioremap_resource_byname() helper function Zhang Zekun
2024-09-05 16:29 ` Mathieu Poirier

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 read-only IMAP folder(s) and NNTP newsgroup(s).