linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nios2: use of_property_read_bool
@ 2016-08-10 12:27 Tobias Klauser
  2016-08-26  3:13 ` [Nios2-dev] " Ley Foon Tan
  0 siblings, 1 reply; 2+ messages in thread
From: Tobias Klauser @ 2016-08-10 12:27 UTC (permalink / raw)
  To: Ley Foon Tan; +Cc: nios2-dev, kernel-janitors, linux-kernel

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>
---
 arch/nios2/include/asm/cpuinfo.h |  8 ++++----
 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 {
 	/* Core CPU configuration */
 	char cpu_impl[12];
 	u32 cpu_clock_freq;
-	u32 mmu;
-	u32 has_div;
-	u32 has_mul;
-	u32 has_mulx;
+	bool mmu;
+	bool has_div;
+	bool has_mul;
+	bool has_mulx;
 
 	/* CPU caches */
 	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)
 	return val;
 }
 
-static inline u32 fcpu_has(struct device_node *cpu, const char *n)
-{
-	return of_get_property(cpu, n, NULL) ? 1 : 0;
-}
-
 void __init setup_cpuinfo(void)
 {
 	struct device_node *cpu;
@@ -56,7 +51,7 @@ void __init setup_cpuinfo(void)
 	if (!cpu)
 		panic("%s: No CPU found in devicetree!\n", __func__);
 
-	if (!fcpu_has(cpu, "altr,has-initda"))
+	if (!of_property_read_bool(cpu, "altr,has-initda"))
 		panic("initda instruction is unimplemented. Please update your "
 			"hardware system to have more than 4-byte line data "
 			"cache\n");
@@ -69,10 +64,10 @@ void __init setup_cpuinfo(void)
 	else
 		strcpy(cpuinfo.cpu_impl, "<unknown>");
 
-	cpuinfo.has_div = fcpu_has(cpu, "altr,has-div");
-	cpuinfo.has_mul = fcpu_has(cpu, "altr,has-mul");
-	cpuinfo.has_mulx = fcpu_has(cpu, "altr,has-mulx");
-	cpuinfo.mmu = fcpu_has(cpu, "altr,has-mmu");
+	cpuinfo.has_div = of_property_read_bool(cpu, "altr,has-div");
+	cpuinfo.has_mul = of_property_read_bool(cpu, "altr,has-mul");
+	cpuinfo.has_mulx = of_property_read_bool(cpu, "altr,has-mulx");
+	cpuinfo.mmu = of_property_read_bool(cpu, "altr,has-mmu");
 
 	if (IS_ENABLED(CONFIG_NIOS2_HW_DIV_SUPPORT) && !cpuinfo.has_div)
 		err_cpu("DIV");
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Nios2-dev] [PATCH] nios2: use of_property_read_bool
  2016-08-10 12:27 [PATCH] nios2: use of_property_read_bool Tobias Klauser
@ 2016-08-26  3:13 ` Ley Foon Tan
  0 siblings, 0 replies; 2+ messages in thread
From: Ley Foon Tan @ 2016-08-26  3:13 UTC (permalink / raw)
  To: Tobias Klauser; +Cc: nios2-dev, kernel-janitors, linux-kernel

On Wed, Aug 10, 2016 at 8:27 PM, Tobias Klauser <tklauser@distanz.ch> wrote:
> 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>

Thanks.

> ---
>  arch/nios2/include/asm/cpuinfo.h |  8 ++++----
>  arch/nios2/kernel/cpuinfo.c      | 15 +++++----------
>  2 files changed, 9 insertions(+), 14 deletions(-)
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-08-26  3:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-10 12:27 [PATCH] nios2: use of_property_read_bool Tobias Klauser
2016-08-26  3:13 ` [Nios2-dev] " Ley Foon Tan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).