[PATCH] ARM: topology: Use of_property_read_u32 instead of open-coding it
Tobias Klauser
tklauser at distanz.ch
Wed Sep 16 08:18:56 PDT 2015
Use of_property_read_u32 to read the "clock-frequency" property instead
of using of_get_property with return value checks and endianness
conversion.
Signed-off-by: Tobias Klauser <tklauser at distanz.ch>
---
arch/arm/kernel/topology.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/arch/arm/kernel/topology.c b/arch/arm/kernel/topology.c
index 08b7847..615a13c 100644
--- a/arch/arm/kernel/topology.c
+++ b/arch/arm/kernel/topology.c
@@ -100,8 +100,7 @@ static void __init parse_dt_topology(void)
GFP_NOWAIT);
for_each_possible_cpu(cpu) {
- const u32 *rate;
- int len;
+ u32 rate;
/* too early to use cpu->of_node */
cn = of_get_cpu_node(cpu, NULL);
@@ -117,14 +116,13 @@ static void __init parse_dt_topology(void)
if (cpu_eff->compatible == NULL)
continue;
- rate = of_get_property(cn, "clock-frequency", &len);
- if (!rate || len != 4) {
+ if (of_property_read_u32(cn, "clock-frequency", &rate)) {
pr_err("%s missing clock-frequency property\n",
cn->full_name);
continue;
}
- capacity = ((be32_to_cpup(rate)) >> 20) * cpu_eff->efficiency;
+ capacity = (rate >> 20) * cpu_eff->efficiency;
/* Save min capacity of the system */
if (capacity < min_capacity)
--
2.5.0
More information about the linux-arm-kernel
mailing list