Skip to content

Commit

Permalink
Merge tag 'nios2-v4.9-rc1' of git://git.kernel.org/pub/scm/linux/kern…
Browse files Browse the repository at this point in the history
…el/git/lftan/nios2

Pull nios2 update from Ley Foon Tan:
 "Use of_property_read_bool() instead of open-coding it"

* tag 'nios2-v4.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/lftan/nios2:
  nios2: use of_property_read_bool
  • Loading branch information
torvalds committed Oct 10, 2016
2 parents 057a056 + 476080a commit ae50a84
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
8 changes: 4 additions & 4 deletions arch/nios2/include/asm/cpuinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
15 changes: 5 additions & 10 deletions arch/nios2/kernel/cpuinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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");
Expand All @@ -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");
Expand Down

0 comments on commit ae50a84

Please sign in to comment.