diff mbox series

thermal: mediatek: Use of_address_to_resource()

Message ID 20230319163231.226738-1-robh@kernel.org
State Accepted
Commit f0fb67c27160eb1aed1524cf5bf7dbbc3174f1b9
Headers show
Series thermal: mediatek: Use of_address_to_resource() | expand

Commit Message

Rob Herring March 19, 2023, 4:32 p.m. UTC
Replace of_get_address() and of_translate_address() calls with single
call to of_address_to_resource().

Signed-off-by: Rob Herring <robh@kernel.org>
---
 drivers/thermal/mediatek/auxadc_thermal.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Comments

AngeloGioacchino Del Regno March 20, 2023, 9:19 a.m. UTC | #1
Il 19/03/23 17:32, Rob Herring ha scritto:
> Replace of_get_address() and of_translate_address() calls with single
> call to of_address_to_resource().
> 
> Signed-off-by: Rob Herring <robh@kernel.org>

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Rob Herring April 18, 2023, 4:28 p.m. UTC | #2
On Sun, Mar 19, 2023 at 11:32:31AM -0500, Rob Herring wrote:
> Replace of_get_address() and of_translate_address() calls with single
> call to of_address_to_resource().
> 
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
>  drivers/thermal/mediatek/auxadc_thermal.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)

Ping!

> 
> diff --git a/drivers/thermal/mediatek/auxadc_thermal.c b/drivers/thermal/mediatek/auxadc_thermal.c
> index ab730f9552d0..c8a3acaf56c1 100644
> --- a/drivers/thermal/mediatek/auxadc_thermal.c
> +++ b/drivers/thermal/mediatek/auxadc_thermal.c
> @@ -897,14 +897,12 @@ static void mtk_thermal_init_bank(struct mtk_thermal *mt, int num,
>  
>  static u64 of_get_phys_base(struct device_node *np)
>  {
> -	u64 size64;
> -	const __be32 *regaddr_p;
> +	struct resource res;
>  
> -	regaddr_p = of_get_address(np, 0, &size64, NULL);
> -	if (!regaddr_p)
> +	if (of_address_to_resource(np, 0, &res))
>  		return OF_BAD_ADDR;
>  
> -	return of_translate_address(np, regaddr_p);
> +	return res.start;
>  }
>  
>  static int mtk_thermal_extract_efuse_v1(struct mtk_thermal *mt, u32 *buf)
> -- 
> 2.39.2
>
diff mbox series

Patch

diff --git a/drivers/thermal/mediatek/auxadc_thermal.c b/drivers/thermal/mediatek/auxadc_thermal.c
index ab730f9552d0..c8a3acaf56c1 100644
--- a/drivers/thermal/mediatek/auxadc_thermal.c
+++ b/drivers/thermal/mediatek/auxadc_thermal.c
@@ -897,14 +897,12 @@  static void mtk_thermal_init_bank(struct mtk_thermal *mt, int num,
 
 static u64 of_get_phys_base(struct device_node *np)
 {
-	u64 size64;
-	const __be32 *regaddr_p;
+	struct resource res;
 
-	regaddr_p = of_get_address(np, 0, &size64, NULL);
-	if (!regaddr_p)
+	if (of_address_to_resource(np, 0, &res))
 		return OF_BAD_ADDR;
 
-	return of_translate_address(np, regaddr_p);
+	return res.start;
 }
 
 static int mtk_thermal_extract_efuse_v1(struct mtk_thermal *mt, u32 *buf)