diff options
author | Ley Foon Tan <lftan@altera.com> | 2016-08-25 04:11:59 -0400 |
---|---|---|
committer | Ley Foon Tan <lftan@altera.com> | 2016-10-06 06:19:16 -0400 |
commit | 476080a79367b950cb860ccf8a3a53fd24f6cccc (patch) | |
tree | e2fcb36662977631ccf9c40cd0eb33f39df7780e | |
parent | c8d2bc9bc39ebea8437fd974fdbc21847bb897a3 (diff) |
nios2: use of_property_read_bool
Use of_property_read_bool instead of open-coding it as fpcu_has.
Convert the members of struct cpuinfo from u32 to bool accordingly as
they are only used as boolean anyhow.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Acked-by: Ley Foon Tan <lftan@altera.com>
-rw-r--r-- | arch/nios2/include/asm/cpuinfo.h | 8 | ||||
-rw-r--r-- | arch/nios2/kernel/cpuinfo.c | 15 |
2 files changed, 9 insertions, 14 deletions
diff --git a/arch/nios2/include/asm/cpuinfo.h b/arch/nios2/include/asm/cpuinfo.h index e88fcae464d9..348bb228fec9 100644 --- a/arch/nios2/include/asm/cpuinfo.h +++ b/arch/nios2/include/asm/cpuinfo.h | |||
@@ -25,10 +25,10 @@ struct cpuinfo { | |||
25 | /* Core CPU configuration */ | 25 | /* Core CPU configuration */ |
26 | char cpu_impl[12]; | 26 | char cpu_impl[12]; |
27 | u32 cpu_clock_freq; | 27 | u32 cpu_clock_freq; |
28 | u32 mmu; | 28 | bool mmu; |
29 | u32 has_div; | 29 | bool has_div; |
30 | u32 has_mul; | 30 | bool has_mul; |
31 | u32 has_mulx; | 31 | bool has_mulx; |
32 | 32 | ||
33 | /* CPU caches */ | 33 | /* CPU caches */ |
34 | u32 icache_line_size; | 34 | u32 icache_line_size; |
diff --git a/arch/nios2/kernel/cpuinfo.c b/arch/nios2/kernel/cpuinfo.c index 1d96de0bd4aa..1cccc36877bc 100644 --- a/arch/nios2/kernel/cpuinfo.c +++ b/arch/nios2/kernel/cpuinfo.c | |||
@@ -41,11 +41,6 @@ static inline u32 fcpu(struct device_node *cpu, const char *n) | |||
41 | return val; | 41 | return val; |
42 | } | 42 | } |
43 | 43 | ||
44 | static inline u32 fcpu_has(struct device_node *cpu, const char *n) | ||
45 | { | ||
46 | return of_get_property(cpu, n, NULL) ? 1 : 0; | ||
47 | } | ||
48 | |||
49 | void __init setup_cpuinfo(void) | 44 | void __init setup_cpuinfo(void) |
50 | { | 45 | { |
51 | struct device_node *cpu; | 46 | struct device_node *cpu; |
@@ -56,7 +51,7 @@ void __init setup_cpuinfo(void) | |||
56 | if (!cpu) | 51 | if (!cpu) |
57 | panic("%s: No CPU found in devicetree!\n", __func__); | 52 | panic("%s: No CPU found in devicetree!\n", __func__); |
58 | 53 | ||
59 | if (!fcpu_has(cpu, "altr,has-initda")) | 54 | if (!of_property_read_bool(cpu, "altr,has-initda")) |
60 | panic("initda instruction is unimplemented. Please update your " | 55 | panic("initda instruction is unimplemented. Please update your " |
61 | "hardware system to have more than 4-byte line data " | 56 | "hardware system to have more than 4-byte line data " |
62 | "cache\n"); | 57 | "cache\n"); |
@@ -69,10 +64,10 @@ void __init setup_cpuinfo(void) | |||
69 | else | 64 | else |
70 | strcpy(cpuinfo.cpu_impl, "<unknown>"); | 65 | strcpy(cpuinfo.cpu_impl, "<unknown>"); |
71 | 66 | ||
72 | cpuinfo.has_div = fcpu_has(cpu, "altr,has-div"); | 67 | cpuinfo.has_div = of_property_read_bool(cpu, "altr,has-div"); |
73 | cpuinfo.has_mul = fcpu_has(cpu, "altr,has-mul"); | 68 | cpuinfo.has_mul = of_property_read_bool(cpu, "altr,has-mul"); |
74 | cpuinfo.has_mulx = fcpu_has(cpu, "altr,has-mulx"); | 69 | cpuinfo.has_mulx = of_property_read_bool(cpu, "altr,has-mulx"); |
75 | cpuinfo.mmu = fcpu_has(cpu, "altr,has-mmu"); | 70 | cpuinfo.mmu = of_property_read_bool(cpu, "altr,has-mmu"); |
76 | 71 | ||
77 | if (IS_ENABLED(CONFIG_NIOS2_HW_DIV_SUPPORT) && !cpuinfo.has_div) | 72 | if (IS_ENABLED(CONFIG_NIOS2_HW_DIV_SUPPORT) && !cpuinfo.has_div) |
78 | err_cpu("DIV"); | 73 | err_cpu("DIV"); |