Skip to content

Commit b2f8cfa

Browse files
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: Palmer Dabbelt <palmer@sifive.com> [Atish: code comment formatting update] Signed-off-by: Atish Patra <atish.patra@wdc.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
1 parent 9639a44 commit b2f8cfa

File tree

5 files changed

+9
-6
lines changed

5 files changed

+9
-6
lines changed

arch/riscv/include/asm/processor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ static inline void wait_for_interrupt(void)
8888
}
8989

9090
struct device_node;
91-
extern int riscv_of_processor_hart(struct device_node *node);
91+
int riscv_of_processor_hartid(struct device_node *node);
9292

9393
extern void riscv_fill_hwcap(void);
9494

arch/riscv/kernel/cpu.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,11 @@
1515
#include <linux/seq_file.h>
1616
#include <linux/of.h>
1717

18-
/* Return -1 if not a valid hart */
19-
int riscv_of_processor_hart(struct device_node *node)
18+
/*
19+
* Returns the hart ID of the given device tree node, or -1 if the device tree
20+
* node isn't a RISC-V hart.
21+
*/
22+
int riscv_of_processor_hartid(struct device_node *node)
2023
{
2124
const char *isa, *status;
2225
u32 hart;

arch/riscv/kernel/smpboot.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ void __init setup_smp(void)
5353
int hart, im_okay_therefore_i_am = 0;
5454

5555
while ((dn = of_find_node_by_type(dn, "cpu"))) {
56-
hart = riscv_of_processor_hart(dn);
56+
hart = riscv_of_processor_hartid(dn);
5757
if (hart >= 0) {
5858
set_cpu_possible(hart, true);
5959
set_cpu_present(hart, true);

drivers/clocksource/riscv_timer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ void riscv_timer_interrupt(void)
8484

8585
static int __init riscv_timer_init_dt(struct device_node *n)
8686
{
87-
int cpu_id = riscv_of_processor_hart(n), error;
87+
int cpu_id = riscv_of_processor_hartid(n), error;
8888
struct clocksource *cs;
8989

9090
if (cpu_id != smp_processor_id())

drivers/irqchip/irq-sifive-plic.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ static int plic_find_hart_id(struct device_node *node)
176176
{
177177
for (; node; node = node->parent) {
178178
if (of_device_is_compatible(node, "riscv"))
179-
return riscv_of_processor_hart(node);
179+
return riscv_of_processor_hartid(node);
180180
}
181181

182182
return -1;

0 commit comments

Comments
 (0)