diff options
Diffstat (limited to 'arch/m68k/atari')
-rw-r--r-- | arch/m68k/atari/config.c | 15 | ||||
-rw-r--r-- | arch/m68k/atari/stram.c | 28 |
2 files changed, 29 insertions, 14 deletions
diff --git a/arch/m68k/atari/config.c b/arch/m68k/atari/config.c index af031855f796..49c28cdbea5c 100644 --- a/arch/m68k/atari/config.c +++ b/arch/m68k/atari/config.c @@ -26,6 +26,7 @@ #include <linux/types.h> #include <linux/mm.h> +#include <linux/seq_file.h> #include <linux/console.h> #include <linux/init.h> #include <linux/delay.h> @@ -63,7 +64,7 @@ int atari_rtc_year_offset; /* local function prototypes */ static void atari_reset(void); static void atari_get_model(char *model); -static int atari_get_hardware_list(char *buffer); +static void atari_get_hardware_list(struct seq_file *m); /* atari specific irq functions */ extern void atari_init_IRQ (void); @@ -611,21 +612,21 @@ static void atari_get_model(char *model) } -static int atari_get_hardware_list(char *buffer) +static void atari_get_hardware_list(struct seq_file *m) { - int len = 0, i; + int i; for (i = 0; i < m68k_num_memory; i++) - len += sprintf(buffer+len, "\t%3ld MB at 0x%08lx (%s)\n", + seq_printf(m, "\t%3ld MB at 0x%08lx (%s)\n", m68k_memory[i].size >> 20, m68k_memory[i].addr, (m68k_memory[i].addr & 0xff000000 ? "alternate RAM" : "ST-RAM")); #define ATARIHW_ANNOUNCE(name, str) \ if (ATARIHW_PRESENT(name)) \ - len += sprintf(buffer + len, "\t%s\n", str) + seq_printf(m, "\t%s\n", str) - len += sprintf(buffer + len, "Detected hardware:\n"); + seq_printf(m, "Detected hardware:\n"); ATARIHW_ANNOUNCE(STND_SHIFTER, "ST Shifter"); ATARIHW_ANNOUNCE(EXTD_SHIFTER, "STe Shifter"); ATARIHW_ANNOUNCE(TT_SHIFTER, "TT Shifter"); @@ -654,6 +655,4 @@ static int atari_get_hardware_list(char *buffer) ATARIHW_ANNOUNCE(BLITTER, "Blitter"); ATARIHW_ANNOUNCE(VME, "VME Bus"); ATARIHW_ANNOUNCE(DSP56K, "DSP56001 processor"); - - return len; } diff --git a/arch/m68k/atari/stram.c b/arch/m68k/atari/stram.c index 04c69ffbea71..6ec3b7f33779 100644 --- a/arch/m68k/atari/stram.c +++ b/arch/m68k/atari/stram.c @@ -42,6 +42,7 @@ /* abbrev for the && above... */ #define DO_PROC #include <linux/proc_fs.h> +#include <linux/seq_file.h> #endif /* @@ -323,19 +324,16 @@ static int remove_region( BLOCK *block ) #ifdef DO_PROC -#define PRINT_PROC(fmt,args...) len += sprintf( buf+len, fmt, ##args ) +#define PRINT_PROC(fmt,args...) seq_printf( m, fmt, ##args ) -int get_stram_list( char *buf ) +static int stram_proc_show(struct seq_file *m, void *v) { - int len = 0; BLOCK *p; PRINT_PROC("Total ST-RAM: %8u kB\n", (stram_end - stram_start) >> 10); PRINT_PROC( "Allocated regions:\n" ); for( p = alloc_list; p; p = p->next ) { - if (len + 50 >= PAGE_SIZE) - break; PRINT_PROC("0x%08lx-0x%08lx: %s (", virt_to_phys(p->start), virt_to_phys(p->start+p->size-1), @@ -346,9 +344,27 @@ int get_stram_list( char *buf ) PRINT_PROC( "??)\n" ); } - return( len ); + return 0; +} + +static int stram_proc_open(struct inode *inode, struct file *file) +{ + return single_open(file, stram_proc_show, NULL); } +static const struct file_operations stram_proc_fops = { + .open = stram_proc_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + +static int __init proc_stram_init(void) +{ + proc_create("stram", 0, NULL, &stram_proc_fops); + return 0; +} +module_init(proc_stram_init); #endif |