Skip to contentSkip to conversation

thermal: mediatek: Use of_address_to_resource()

PATCH Applied Rob Herring 3 participants 4 messages Mar 19, 2023 – Apr 19, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 thermal: mediatek: Use of_address_to_resource()

Replace of_get_address() and of_translate_address() calls with single call to of_address_to_resource().

---
 drivers/thermal/mediatek/auxadc_thermal.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/thermal/mediatek/auxadc_thermal.c +3 -5
index ab730f9552d0..c8a3acaf56c1 100644
@@ -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)
Signature · 1 line
2.39.2
#2 lore raw
In reply to Rob Herring
Quoted 7 lines · Rob Herring

Replace of_get_address() and of_translate_address() calls with single call to of_address_to_resource().

---
 drivers/thermal/mediatek/auxadc_thermal.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Ping!

Quoted 26 lines
drivers/thermal/mediatek/auxadc_thermal.c +3 -5
index ab730f9552d0..c8a3acaf56c1 100644
@@ -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)
Signature · 1 line
2.39.2
#3 lore raw
In reply to Rob Herring
Quoted 5 lines · Rob Herring

Replace of_get_address() and of_translate_address() calls with single call to of_address_to_resource().

---

Applied, thanks

Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog