lkml.org 
[lkml]   [2019]   [Jul]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 3/4] RISC-V: Support case insensitive ISA string parsing.
Date
As per riscv specification, ISA naming strings are
case insensitive. However, currently only lower case
strings are parsed during cpu procfs.

Support parsing of upper case letters as well.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
---
arch/riscv/kernel/cpu.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/arch/riscv/kernel/cpu.c b/arch/riscv/kernel/cpu.c
index 7da3c6a93abd..185143478830 100644
--- a/arch/riscv/kernel/cpu.c
+++ b/arch/riscv/kernel/cpu.c
@@ -5,6 +5,7 @@

#include <linux/init.h>
#include <linux/seq_file.h>
+#include <linux/ctype.h>
#include <linux/of.h>
#include <asm/smp.h>

@@ -57,10 +58,10 @@ static void print_isa(struct seq_file *f, const char *orig_isa)
* kernels on harts with the same ISA that the kernel is compiled for.
*/
#if defined(CONFIG_32BIT)
- if (strncmp(isa, "rv32i", 5) != 0)
+ if (strncasecmp(isa, "rv32i", 5) != 0)
return;
#elif defined(CONFIG_64BIT)
- if (strncmp(isa, "rv64i", 5) != 0)
+ if (strncasecmp(isa, "rv64i", 5) != 0)
return;
#endif

@@ -76,8 +77,8 @@ static void print_isa(struct seq_file *f, const char *orig_isa)
* extension from userspace as it's not accessible from there.
*/
for (e = ext; *e != '\0'; ++e) {
- if (isa[0] == e[0]) {
- if (isa[0] != 's')
+ if (tolower(isa[0]) == e[0]) {
+ if (tolower(isa[0] != 's'))
seq_write(f, isa, 1);

isa++;
--
2.21.0
\
 
 \ /
  Last update: 2019-07-26 21:47    [W:0.081 / U:2.900 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site