diff mbox series

remoteproc: Use devm_platform_ioremap_resource_byname() helper function

Message ID 20240905120501.131046-1-zhangzekun11@huawei.com (mailing list archive)
State New
Headers show
Series remoteproc: Use devm_platform_ioremap_resource_byname() helper function | expand

Commit Message

zhangzekun (A) Sept. 5, 2024, 12:05 p.m. UTC
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(-)

Comments

Mathieu Poirier Sept. 5, 2024, 4:29 p.m. UTC | #1
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
>
diff mbox series

Patch

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);