diff mbox series

[v2,2/3] soc: mediatek: pwrap: Switch to devm_platform_ioremap_resource_byname()

Message ID 20220331075817.7122-3-angelogioacchino.delregno@collabora.com (mailing list archive)
State New, archived
Headers show
Series MediaTek PMIC Wrap improvements and cleanups | expand

Commit Message

AngeloGioacchino Del Regno March 31, 2022, 7:58 a.m. UTC
In order to simplify ioremapping resources, instead of calling
platform_get_resource_byname() and then devm_ioremap_resource(),
simply call devm_platform_ioremap_resource_byname().

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/soc/mediatek/mtk-pmic-wrap.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

Comments

Nícolas F. R. A. Prado March 31, 2022, 4:43 p.m. UTC | #1
On Thu, Mar 31, 2022 at 09:58:16AM +0200, AngeloGioacchino Del Regno wrote:
> In order to simplify ioremapping resources, instead of calling
> platform_get_resource_byname() and then devm_ioremap_resource(),
> simply call devm_platform_ioremap_resource_byname().
> 
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>

Reviewed-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Tested-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>

> ---
>  drivers/soc/mediatek/mtk-pmic-wrap.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/soc/mediatek/mtk-pmic-wrap.c b/drivers/soc/mediatek/mtk-pmic-wrap.c
> index 54a5300ab72b..852514366f1f 100644
> --- a/drivers/soc/mediatek/mtk-pmic-wrap.c
> +++ b/drivers/soc/mediatek/mtk-pmic-wrap.c
> @@ -2191,7 +2191,6 @@ static int pwrap_probe(struct platform_device *pdev)
>  	struct pmic_wrapper *wrp;
>  	struct device_node *np = pdev->dev.of_node;
>  	const struct of_device_id *of_slave_id = NULL;
> -	struct resource *res;
>  
>  	if (np->child)
>  		of_slave_id = of_match_node(of_slave_match_tbl, np->child);
> @@ -2211,8 +2210,7 @@ static int pwrap_probe(struct platform_device *pdev)
>  	wrp->slave = of_slave_id->data;
>  	wrp->dev = &pdev->dev;
>  
> -	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pwrap");
> -	wrp->base = devm_ioremap_resource(wrp->dev, res);
> +	wrp->base = devm_platform_ioremap_resource_byname(pdev, "pwrap");
>  	if (IS_ERR(wrp->base))
>  		return PTR_ERR(wrp->base);
>  
> @@ -2226,9 +2224,7 @@ static int pwrap_probe(struct platform_device *pdev)
>  	}
>  
>  	if (HAS_CAP(wrp->master->caps, PWRAP_CAP_BRIDGE)) {
> -		res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
> -				"pwrap-bridge");
> -		wrp->bridge_base = devm_ioremap_resource(wrp->dev, res);
> +		wrp->bridge_base = devm_platform_ioremap_resource_byname(pdev, "pwrap-bridge");
>  		if (IS_ERR(wrp->bridge_base))
>  			return PTR_ERR(wrp->bridge_base);
>  
> -- 
> 2.35.1
>
diff mbox series

Patch

diff --git a/drivers/soc/mediatek/mtk-pmic-wrap.c b/drivers/soc/mediatek/mtk-pmic-wrap.c
index 54a5300ab72b..852514366f1f 100644
--- a/drivers/soc/mediatek/mtk-pmic-wrap.c
+++ b/drivers/soc/mediatek/mtk-pmic-wrap.c
@@ -2191,7 +2191,6 @@  static int pwrap_probe(struct platform_device *pdev)
 	struct pmic_wrapper *wrp;
 	struct device_node *np = pdev->dev.of_node;
 	const struct of_device_id *of_slave_id = NULL;
-	struct resource *res;
 
 	if (np->child)
 		of_slave_id = of_match_node(of_slave_match_tbl, np->child);
@@ -2211,8 +2210,7 @@  static int pwrap_probe(struct platform_device *pdev)
 	wrp->slave = of_slave_id->data;
 	wrp->dev = &pdev->dev;
 
-	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pwrap");
-	wrp->base = devm_ioremap_resource(wrp->dev, res);
+	wrp->base = devm_platform_ioremap_resource_byname(pdev, "pwrap");
 	if (IS_ERR(wrp->base))
 		return PTR_ERR(wrp->base);
 
@@ -2226,9 +2224,7 @@  static int pwrap_probe(struct platform_device *pdev)
 	}
 
 	if (HAS_CAP(wrp->master->caps, PWRAP_CAP_BRIDGE)) {
-		res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
-				"pwrap-bridge");
-		wrp->bridge_base = devm_ioremap_resource(wrp->dev, res);
+		wrp->bridge_base = devm_platform_ioremap_resource_byname(pdev, "pwrap-bridge");
 		if (IS_ERR(wrp->bridge_base))
 			return PTR_ERR(wrp->bridge_base);