RISC-V: Rename riscv_of_processor_hart to riscv_of_processor_hartid
authorPalmer Dabbelt <palmer@sifive.com>
Tue, 2 Oct 2018 19:15:00 +0000 (12:15 -0700)
committerPalmer Dabbelt <palmer@sifive.com>
Tue, 23 Oct 2018 00:03:36 +0000 (17:03 -0700)
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>
arch/riscv/include/asm/processor.h
arch/riscv/kernel/cpu.c
arch/riscv/kernel/smpboot.c
drivers/clocksource/riscv_timer.c
drivers/irqchip/irq-sifive-plic.c

index 3fe4af8147d2d6bc692f9ad32f2015e77c01a4bd..50de774d827ae69ca88495747592c44fa08dd486 100644 (file)
@@ -88,7 +88,7 @@ static inline void wait_for_interrupt(void)
 }
 
 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);
 
index 1c0bf6620e652f5d6edd43f8bb2fdadfeb89af04..4723e235dcaa356710a2707ab0b4237ab4c5104e 100644 (file)
 #include <linux/seq_file.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;
        u32 hart;
index 670749ecd0c227ba6ba8fd386584a425f60905e5..cfb0b02db6479b1f28a0afe63cbb3fde098d4266 100644 (file)
@@ -53,7 +53,7 @@ void __init setup_smp(void)
        int hart, im_okay_therefore_i_am = 0;
 
        while ((dn = of_find_node_by_type(dn, "cpu"))) {
-               hart = riscv_of_processor_hart(dn);
+               hart = riscv_of_processor_hartid(dn);
                if (hart >= 0) {
                        set_cpu_possible(hart, true);
                        set_cpu_present(hart, true);
index 4e8b347e43e2ef385683a2bf33184c2cfa5ade1b..ad7453fc3129f2d3e25dc4379e90e26d35ca6f42 100644 (file)
@@ -84,7 +84,7 @@ void riscv_timer_interrupt(void)
 
 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;
 
        if (cpu_id != smp_processor_id())
index 532e9d68c70428bc65cd5285d9cecb4c1c535831..c55eaa31cde24701505e1f9996386378c6fd64be 100644 (file)
@@ -176,7 +176,7 @@ static int plic_find_hart_id(struct device_node *node)
 {
        for (; node; node = node->parent) {
                if (of_device_is_compatible(node, "riscv"))
-                       return riscv_of_processor_hart(node);
+                       return riscv_of_processor_hartid(node);
        }
 
        return -1;