mirror of
https://github.com/torvalds/linux.git
synced 2024-12-12 22:23:55 +00:00
riscv: fix riscv_of_processor_hartid() comment
The riscv_of_processor_hartid() helper returns -ENODEV when the specified node isn't an enabled and valid RISC-V hart node. Also drop the unnecessary parenthesis around errno defines. Signed-off-by: Johan Hovold <johan@kernel.org> Reviewed-by: Paul Walmsley <paul.walmsley@sifive.com> Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
This commit is contained in:
parent
e1b1381b31
commit
149820c6cf
@ -17,8 +17,8 @@
|
|||||||
#include <asm/smp.h>
|
#include <asm/smp.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns the hart ID of the given device tree node, or -1 if the device tree
|
* Returns the hart ID of the given device tree node, or -ENODEV if the node
|
||||||
* node isn't a RISC-V hart.
|
* isn't an enabled and valid RISC-V hart node.
|
||||||
*/
|
*/
|
||||||
int riscv_of_processor_hartid(struct device_node *node)
|
int riscv_of_processor_hartid(struct device_node *node)
|
||||||
{
|
{
|
||||||
@ -27,34 +27,34 @@ int riscv_of_processor_hartid(struct device_node *node)
|
|||||||
|
|
||||||
if (!of_device_is_compatible(node, "riscv")) {
|
if (!of_device_is_compatible(node, "riscv")) {
|
||||||
pr_warn("Found incompatible CPU\n");
|
pr_warn("Found incompatible CPU\n");
|
||||||
return -(ENODEV);
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (of_property_read_u32(node, "reg", &hart)) {
|
if (of_property_read_u32(node, "reg", &hart)) {
|
||||||
pr_warn("Found CPU without hart ID\n");
|
pr_warn("Found CPU without hart ID\n");
|
||||||
return -(ENODEV);
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
if (hart >= NR_CPUS) {
|
if (hart >= NR_CPUS) {
|
||||||
pr_info("Found hart ID %d, which is above NR_CPUs. Disabling this hart\n", hart);
|
pr_info("Found hart ID %d, which is above NR_CPUs. Disabling this hart\n", hart);
|
||||||
return -(ENODEV);
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (of_property_read_string(node, "status", &status)) {
|
if (of_property_read_string(node, "status", &status)) {
|
||||||
pr_warn("CPU with hartid=%d has no \"status\" property\n", hart);
|
pr_warn("CPU with hartid=%d has no \"status\" property\n", hart);
|
||||||
return -(ENODEV);
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
if (strcmp(status, "okay")) {
|
if (strcmp(status, "okay")) {
|
||||||
pr_info("CPU with hartid=%d has a non-okay status of \"%s\"\n", hart, status);
|
pr_info("CPU with hartid=%d has a non-okay status of \"%s\"\n", hart, status);
|
||||||
return -(ENODEV);
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (of_property_read_string(node, "riscv,isa", &isa)) {
|
if (of_property_read_string(node, "riscv,isa", &isa)) {
|
||||||
pr_warn("CPU with hartid=%d has no \"riscv,isa\" property\n", hart);
|
pr_warn("CPU with hartid=%d has no \"riscv,isa\" property\n", hart);
|
||||||
return -(ENODEV);
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
if (isa[0] != 'r' || isa[1] != 'v') {
|
if (isa[0] != 'r' || isa[1] != 'v') {
|
||||||
pr_warn("CPU with hartid=%d has an invalid ISA of \"%s\"\n", hart, isa);
|
pr_warn("CPU with hartid=%d has an invalid ISA of \"%s\"\n", hart, isa);
|
||||||
return -(ENODEV);
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
return hart;
|
return hart;
|
||||||
|
Loading…
Reference in New Issue
Block a user