From: Atish Patra <atish.patra@wdc.com>
To: palmer@sifive.com, linux-riscv@lists.infradead.org
Cc: mark.rutland@arm.com, hch@infradead.org, anup@brainfault.org,
atish.patra@wdc.com, tglx@linutronix.de,
linux-kernel@vger.kernel.org, Damien.LeMoal@wdc.com,
marc.zyngier@arm.com, jeremy.linton@arm.com,
gregkh@linuxfoundation.org, jason@lakedaemon.net,
catalin.marinas@arm.com, dmitriy@oss-tech.org,
ard.biesheuvel@linaro.org
Subject: [PATCH v4 07/12] RISC-V: Rename riscv_of_processor_hart to riscv_of_processor_hartid
Date: Tue, 11 Sep 2018 13:05:34 -0700 [thread overview]
Message-ID: <1536696339-15204-8-git-send-email-atish.patra@wdc.com> (raw)
In-Reply-To: <1536696339-15204-1-git-send-email-atish.patra@wdc.com>
From: Palmer Dabbelt <palmer@sifive.com>
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>
---
arch/riscv/include/asm/processor.h | 2 +-
arch/riscv/kernel/cpu.c | 7 +++++--
arch/riscv/kernel/smpboot.c | 2 +-
drivers/clocksource/riscv_timer.c | 2 +-
drivers/irqchip/irq-sifive-plic.c | 2 +-
5 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/arch/riscv/include/asm/processor.h b/arch/riscv/include/asm/processor.h
index 3fe4af81..50de774d 100644
--- a/arch/riscv/include/asm/processor.h
+++ b/arch/riscv/include/asm/processor.h
@@ -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);
diff --git a/arch/riscv/kernel/cpu.c b/arch/riscv/kernel/cpu.c
index 1c0bf662..4723e235 100644
--- a/arch/riscv/kernel/cpu.c
+++ b/arch/riscv/kernel/cpu.c
@@ -15,8 +15,11 @@
#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;
diff --git a/arch/riscv/kernel/smpboot.c b/arch/riscv/kernel/smpboot.c
index 670749ec..cfb0b02d 100644
--- a/arch/riscv/kernel/smpboot.c
+++ b/arch/riscv/kernel/smpboot.c
@@ -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);
diff --git a/drivers/clocksource/riscv_timer.c b/drivers/clocksource/riscv_timer.c
index 4e8b347e..ad7453fc 100644
--- a/drivers/clocksource/riscv_timer.c
+++ b/drivers/clocksource/riscv_timer.c
@@ -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())
diff --git a/drivers/irqchip/irq-sifive-plic.c b/drivers/irqchip/irq-sifive-plic.c
index 532e9d68..c55eaa31 100644
--- a/drivers/irqchip/irq-sifive-plic.c
+++ b/drivers/irqchip/irq-sifive-plic.c
@@ -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;
--
2.7.4
next prev parent reply other threads:[~2018-09-11 20:06 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-11 20:05 [PATCH v4 00/12] SMP cleanup and new features Atish Patra
2018-09-11 20:05 ` [PATCH v4 01/12] RISC-V: No need to pass scause as arg to do_IRQ() Atish Patra
2018-09-11 20:05 ` [PATCH v4 02/12] RISC-V: Don't set cacheinfo.{physical_line_partition,attributes} Atish Patra
2018-09-11 20:05 ` [PATCH v4 03/12] RISC-V: Filter ISA and MMU values in cpuinfo Atish Patra
2018-09-11 20:05 ` [PATCH v4 04/12] RISC-V: Comment on the TLB flush in smp_callin() Atish Patra
2018-09-11 20:05 ` [PATCH v4 05/12] RISC-V: Disable preemption before enabling interrupts Atish Patra
2018-09-11 20:05 ` [PATCH v4 06/12] RISC-V: Provide a cleaner raw_smp_processor_id() Atish Patra
2018-09-11 20:05 ` Atish Patra [this message]
2018-09-11 20:05 ` [PATCH v4 08/12] RISC-V: Rename im_okay_therefore_i_am to found_boot_cpu Atish Patra
2018-09-11 20:05 ` [PATCH v4 09/12] RISC-V: Use mmgrab() Atish Patra
2018-09-11 20:05 ` [PATCH v4 10/12] RISC-V: User WRITE_ONCE instead of direct access Atish Patra
2018-09-11 20:32 ` Andreas Schwab
2018-09-13 18:21 ` Atish Patra
2018-09-11 20:05 ` [PATCH v4 11/12] RISC-V: Add logical CPU indexing for RISC-V Atish Patra
2018-09-11 20:05 ` [PATCH v4 12/12] RISC-V: Use Linux logical cpu number instead of hartid Atish Patra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1536696339-15204-8-git-send-email-atish.patra@wdc.com \
--to=atish.patra@wdc.com \
--cc=Damien.LeMoal@wdc.com \
--cc=anup@brainfault.org \
--cc=ard.biesheuvel@linaro.org \
--cc=catalin.marinas@arm.com \
--cc=dmitriy@oss-tech.org \
--cc=gregkh@linuxfoundation.org \
--cc=hch@infradead.org \
--cc=jason@lakedaemon.net \
--cc=jeremy.linton@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=marc.zyngier@arm.com \
--cc=mark.rutland@arm.com \
--cc=palmer@sifive.com \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).