patch-2.4.15 linux/arch/arm/kernel/setup.c
Next file: linux/arch/arm/lib/gcclib.h
Previous file: linux/arch/arm/config.in
Back to the patch index
Back to the overall index
- Lines: 112
- Date:
Fri Nov 16 10:07:47 2001
- Orig file:
v2.4.14/linux/arch/arm/kernel/setup.c
- Orig date:
Tue Oct 23 22:48:49 2001
diff -u --recursive --new-file v2.4.14/linux/arch/arm/kernel/setup.c linux/arch/arm/kernel/setup.c
@@ -1,7 +1,7 @@
/*
* linux/arch/arm/kernel/setup.c
*
- * Copyright (C) 1995-2000 Russell King
+ * Copyright (C) 1995-2001 Russell King
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -16,6 +16,7 @@
#include <linux/blk.h>
#include <linux/console.h>
#include <linux/bootmem.h>
+#include <linux/seq_file.h>
#include <linux/init.h>
#include <asm/elf.h>
@@ -532,58 +533,53 @@
NULL
};
-/*
- * get_cpuinfo - Get information on one CPU for use by the procfs.
- *
- * Prints info on the next CPU into buffer. Beware, doesn't check for
- * buffer overflow. Current implementation of procfs assumes that the
- * resulting data is <= 1K.
- *
- * Args:
- * buffer -- you guessed it, the data buffer
- * cpu_np -- Input: next cpu to get (start at 0). Output: Updated.
- *
- * Returns number of bytes written to buffer.
- */
-
-int get_cpuinfo(char *buffer, unsigned *cpu_np)
+static int c_show(struct seq_file *m, void *v)
{
- char *p = buffer;
- unsigned n;
int i;
- /* No SMP at the moment, so just toggle 0/1 */
- n = *cpu_np;
- *cpu_np = 1;
- if (n != 0) {
- return (0);
- }
-
- p += sprintf(p, "Processor\t: %s %s rev %d (%s)\n",
- proc_info.manufacturer, proc_info.cpu_name,
- (int)processor_id & 15, elf_platform);
-
- p += sprintf(p, "BogoMIPS\t: %lu.%02lu\n",
- loops_per_jiffy / (500000/HZ),
- (loops_per_jiffy / (5000/HZ)) % 100);
+ seq_printf(m, "Processor\t: %s %s rev %d (%s)\n",
+ proc_info.manufacturer, proc_info.cpu_name,
+ (int)processor_id & 15, elf_platform);
+
+ seq_printf(m, "BogoMIPS\t: %lu.%02lu\n",
+ loops_per_jiffy / (500000/HZ),
+ (loops_per_jiffy / (5000/HZ)) % 100);
/* dump out the processor features */
- p += sprintf(p, "Features\t: ");
+ seq_puts(m, "Features\t: ");
for (i = 0; hwcap_str[i]; i++)
if (elf_hwcap & (1 << i))
- p += sprintf(p, "%s ", hwcap_str[i]);
+ seq_printf(m, "%s ", hwcap_str[i]);
+
+ seq_puts(m, "\n\n");
- p += sprintf(p, "\n\n");
+ seq_printf(m, "Hardware\t: %s\n", machine_name);
+ seq_printf(m, "Revision\t: %04x\n", system_rev);
+ seq_printf(m, "Serial\t\t: %08x%08x\n",
+ system_serial_high, system_serial_low);
- p += sprintf(p, "Hardware\t: %s\n", machine_name);
+ return 0;
+}
- p += sprintf(p, "Revision\t: %04x\n",
- system_rev);
+static void *c_start(struct seq_file *m, loff_t *pos)
+{
+ return *pos < 1 ? (void *)1 : NULL;
+}
- p += sprintf(p, "Serial\t\t: %08x%08x\n",
- system_serial_high,
- system_serial_low);
+static void *c_next(struct seq_file *m, void *v, loff_t *pos)
+{
+ ++*pos;
+ return NULL;
+}
- return p - buffer;
+static void c_stop(struct seq_file *m, void *v)
+{
}
+
+struct seq_operations cpuinfo_op = {
+ start: c_start,
+ next: c_next,
+ stop: c_stop,
+ show: c_show
+};
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)