Skip to content

Commit

Permalink
riscv: treat cpu devicetree nodes without status as enabled
Browse files Browse the repository at this point in the history
Follow the Linux convention and treat devicetree nodes without a status
property as enabled rather than disabled, while also allowing "ok" as a
shorthand for "okay".

Signed-off-by: Johan Hovold <johan@kernel.org>
Reviewed-by: Paul Walmsley <paul.walmsley@sifive.com>
Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
  • Loading branch information
Johan Hovold authored and Palmer Dabbelt committed Feb 11, 2019
1 parent 149820c commit e3d794d
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions arch/riscv/kernel/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/
int riscv_of_processor_hartid(struct device_node *node)
{
const char *isa, *status;
const char *isa;
u32 hart;

if (!of_device_is_compatible(node, "riscv")) {
Expand All @@ -39,12 +39,8 @@ int riscv_of_processor_hartid(struct device_node *node)
return -ENODEV;
}

if (of_property_read_string(node, "status", &status)) {
pr_warn("CPU with hartid=%d has no \"status\" property\n", hart);
return -ENODEV;
}
if (strcmp(status, "okay")) {
pr_info("CPU with hartid=%d has a non-okay status of \"%s\"\n", hart, status);
if (!of_device_is_available(node)) {
pr_info("CPU with hartid=%d is not available\n", hart);
return -ENODEV;
}

Expand Down

0 comments on commit e3d794d

Please sign in to comment.