Skip to contentSkip to conversation

MIPS: Display CPU byteorder in /proc/cpuinfo

PATCH In review Joshua Kinard 2 participants 2 messages Jan 21, 2015 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 MIPS: Display CPU byteorder in /proc/cpuinfo

From: Joshua Kinard <[email protected]>

This is a small patch to display the CPU byteorder that the kernel was compiled with in /proc/cpuinfo.

---
 arch/mips/kernel/proc.c |    4 ++++
 1 file changed, 4 insertions(+)

This version of the patches replaces the #ifdefs with proper conditionals.

linux-mips-proc-cpuinfo-byteorder.patch

arch/mips/kernel/proc.c +4 -0
index 097fc8d..22ef4c9 100644
@@ -65,6 +65,10 @@ static int show_cpuinfo(struct seq_file *m, void *v)
 	seq_printf(m, "BogoMIPS\t\t: %u.%02u\n",
 		      cpu_data[n].udelay_val / (500000/HZ),
 		      (cpu_data[n].udelay_val / (5000/HZ)) % 100);
+	if (config_enabled(CONFIG_CPU_BIG_ENDIAN))
+		seq_printf(m, "byteorder\t\t: big endian\n");
+	else
+		seq_printf(m, "byteorder\t\t: little endian\n");
 	seq_printf(m, "wait instruction\t: %s\n", cpu_wait ? "yes" : "no");
 	seq_printf(m, "microsecond timers\t: %s\n",
 		      cpu_has_counter ? "yes" : "no");
Reviewed-by on v2 1/1
#1 lore raw
Quoted 20 lines · Joshua Kinard

From: Joshua Kinard <[email protected]>

This is a small patch to display the CPU byteorder that the kernel was compiled with in /proc/cpuinfo.

---
 arch/mips/kernel/proc.c |    4 ++++
 1 file changed, 4 insertions(+)

This version of the patches replaces the #ifdefs with proper conditionals.

linux-mips-proc-cpuinfo-byteorder.patch

arch/mips/kernel/proc.c +0 -0
index 097fc8d..22ef4c9 100644

arch/mips/kernel/proc.c static int show_cpuinfo(struct seq_file *m, void *v) · line 74

Quoted 10 lines
arch/mips/kernel/proc.c +4 -0
@@ -65,6 +65,10 @@ static int show_cpuinfo(struct seq_file *m, void *v)
 	seq_printf(m, "BogoMIPS\t\t: %u.%02u\n",
 		      cpu_data[n].udelay_val / (500000/HZ),
 		      (cpu_data[n].udelay_val / (5000/HZ)) % 100);
+	if (config_enabled(CONFIG_CPU_BIG_ENDIAN))
+		seq_printf(m, "byteorder\t\t: big endian\n");
+	else
+		seq_printf(m, "byteorder\t\t: little endian\n");
 	seq_printf(m, "wait instruction\t: %s\n", cpu_wait ? "yes" : "no");
 	seq_printf(m, "microsecond timers\t: %s\n",
 		      cpu_has_counter ? "yes" : "no");

fwiw that looks ok to me

Signature · 1 line
markos