RISC-V: Rename riscv_of_processor_hart to riscv_of_processor_hartid

It's a bit confusing exactly what this function does: it actually
returns the hartid of an OF processor node, failing with -1 on invalid
nodes.  I've changed the name to _hartid() in order to make that a bit
more clear, as well as adding a comment.
Signed-off-by: NPalmer Dabbelt <palmer@sifive.com>
[Atish: code comment formatting update]
Signed-off-by: NAtish Patra <atish.patra@wdc.com>
Reviewed-by: NChristoph Hellwig <hch@lst.de>
Signed-off-by: NPalmer Dabbelt <palmer@sifive.com>
上级 9639a443
...@@ -88,7 +88,7 @@ static inline void wait_for_interrupt(void) ...@@ -88,7 +88,7 @@ static inline void wait_for_interrupt(void)
} }
struct device_node; struct device_node;
extern int riscv_of_processor_hart(struct device_node *node); int riscv_of_processor_hartid(struct device_node *node);
extern void riscv_fill_hwcap(void); extern void riscv_fill_hwcap(void);
......
...@@ -15,8 +15,11 @@ ...@@ -15,8 +15,11 @@
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/of.h> #include <linux/of.h>
/* Return -1 if not a valid hart */ /*
int riscv_of_processor_hart(struct device_node *node) * Returns the hart ID of the given device tree node, or -1 if the device tree
* node isn't a RISC-V hart.
*/
int riscv_of_processor_hartid(struct device_node *node)
{ {
const char *isa, *status; const char *isa, *status;
u32 hart; u32 hart;
......
...@@ -53,7 +53,7 @@ void __init setup_smp(void) ...@@ -53,7 +53,7 @@ void __init setup_smp(void)
int hart, im_okay_therefore_i_am = 0; int hart, im_okay_therefore_i_am = 0;
while ((dn = of_find_node_by_type(dn, "cpu"))) { while ((dn = of_find_node_by_type(dn, "cpu"))) {
hart = riscv_of_processor_hart(dn); hart = riscv_of_processor_hartid(dn);
if (hart >= 0) { if (hart >= 0) {
set_cpu_possible(hart, true); set_cpu_possible(hart, true);
set_cpu_present(hart, true); set_cpu_present(hart, true);
......
...@@ -84,7 +84,7 @@ void riscv_timer_interrupt(void) ...@@ -84,7 +84,7 @@ void riscv_timer_interrupt(void)
static int __init riscv_timer_init_dt(struct device_node *n) static int __init riscv_timer_init_dt(struct device_node *n)
{ {
int cpu_id = riscv_of_processor_hart(n), error; int cpu_id = riscv_of_processor_hartid(n), error;
struct clocksource *cs; struct clocksource *cs;
if (cpu_id != smp_processor_id()) if (cpu_id != smp_processor_id())
......
...@@ -176,7 +176,7 @@ static int plic_find_hart_id(struct device_node *node) ...@@ -176,7 +176,7 @@ static int plic_find_hart_id(struct device_node *node)
{ {
for (; node; node = node->parent) { for (; node; node = node->parent) {
if (of_device_is_compatible(node, "riscv")) if (of_device_is_compatible(node, "riscv"))
return riscv_of_processor_hart(node); return riscv_of_processor_hartid(node);
} }
return -1; return -1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册