linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Palmer Dabbelt <palmer@sifive.com>
Cc: Albert Ou <aou@eecs.berkeley.edu>,
	Andreas Schwab <schwab@suse.de>,
	Atish Patra <atish.patra@wdc.com>,
	Anup Patel <anup@brainfault.org>,
	linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
	Johan Hovold <johan@kernel.org>
Subject: [PATCH 3/5] riscv: fix riscv_of_processor_hartid() comment
Date: Fri, 18 Jan 2019 15:03:06 +0100	[thread overview]
Message-ID: <20190118140308.9599-4-johan@kernel.org> (raw)
In-Reply-To: <20190118140308.9599-1-johan@kernel.org>

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>
---
 arch/riscv/kernel/cpu.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/arch/riscv/kernel/cpu.c b/arch/riscv/kernel/cpu.c
index 11ba67f010e7..974d374fd36b 100644
--- a/arch/riscv/kernel/cpu.c
+++ b/arch/riscv/kernel/cpu.c
@@ -17,8 +17,8 @@
 #include <asm/smp.h>
 
 /*
- * Returns the hart ID of the given device tree node, or -1 if the device tree
- * node isn't a RISC-V hart.
+ * Returns the hart ID of the given device tree node, or -ENODEV if the node
+ * isn't an enabled and valid RISC-V hart 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")) {
 		pr_warn("Found incompatible CPU\n");
-		return -(ENODEV);
+		return -ENODEV;
 	}
 
 	if (of_property_read_u32(node, "reg", &hart)) {
 		pr_warn("Found CPU without hart ID\n");
-		return -(ENODEV);
+		return -ENODEV;
 	}
 	if (hart >= NR_CPUS) {
 		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)) {
 		pr_warn("CPU with hartid=%d has no \"status\" property\n", hart);
-		return -(ENODEV);
+		return -ENODEV;
 	}
 	if (strcmp(status, "okay")) {
 		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)) {
 		pr_warn("CPU with hartid=%d has no \"riscv,isa\" property\n", hart);
-		return -(ENODEV);
+		return -ENODEV;
 	}
 	if (isa[0] != 'r' || isa[1] != 'v') {
 		pr_warn("CPU with hartid=%d has an invalid ISA of \"%s\"\n", hart, isa);
-		return -(ENODEV);
+		return -ENODEV;
 	}
 
 	return hart;
-- 
2.20.1


  parent reply	other threads:[~2019-01-18 14:04 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-18 14:03 [PATCH 0/5] riscv: minor fixes and cleanups Johan Hovold
2019-01-18 14:03 ` [PATCH 1/5] riscv: add missing newlines to printk messages Johan Hovold
2019-02-12  7:11   ` Christoph Hellwig
2019-01-18 14:03 ` [PATCH 2/5] riscv: use pr_info and friends Johan Hovold
2019-01-19  1:39   ` Paul Walmsley
2019-02-12  7:11   ` Christoph Hellwig
2019-01-18 14:03 ` Johan Hovold [this message]
2019-01-19  1:40   ` [PATCH 3/5] riscv: fix riscv_of_processor_hartid() comment Paul Walmsley
2019-02-12  7:12   ` Christoph Hellwig
2019-01-18 14:03 ` [PATCH 4/5] riscv: treat cpu devicetree nodes without status as enabled Johan Hovold
2019-01-19  1:43   ` Paul Walmsley
2019-01-21  8:59     ` Johan Hovold
2019-02-12  7:12   ` Christoph Hellwig
2019-01-18 14:03 ` [PATCH 5/5] riscv: use for_each_of_cpu_node iterator Johan Hovold
2019-02-12  7:13   ` Christoph Hellwig
2019-02-12  8:26     ` Johan Hovold
2019-02-12  8:47       ` Atish Patra
2019-02-12  8:53         ` Johan Hovold
2019-02-12  9:20           ` Atish Patra
2019-02-11  9:34 ` [PATCH 0/5] riscv: minor fixes and cleanups Johan Hovold
2019-02-11 19:59   ` Palmer Dabbelt

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=20190118140308.9599-4-johan@kernel.org \
    --to=johan@kernel.org \
    --cc=anup@brainfault.org \
    --cc=aou@eecs.berkeley.edu \
    --cc=atish.patra@wdc.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@sifive.com \
    --cc=schwab@suse.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).