diff options
Diffstat (limited to 'arch/m68k/atari')
-rw-r--r-- | arch/m68k/atari/stram.c | 28 |
1 files changed, 22 insertions, 6 deletions
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 @@ | |||
42 | /* abbrev for the && above... */ | 42 | /* abbrev for the && above... */ |
43 | #define DO_PROC | 43 | #define DO_PROC |
44 | #include <linux/proc_fs.h> | 44 | #include <linux/proc_fs.h> |
45 | #include <linux/seq_file.h> | ||
45 | #endif | 46 | #endif |
46 | 47 | ||
47 | /* | 48 | /* |
@@ -323,19 +324,16 @@ static int remove_region( BLOCK *block ) | |||
323 | 324 | ||
324 | #ifdef DO_PROC | 325 | #ifdef DO_PROC |
325 | 326 | ||
326 | #define PRINT_PROC(fmt,args...) len += sprintf( buf+len, fmt, ##args ) | 327 | #define PRINT_PROC(fmt,args...) seq_printf( m, fmt, ##args ) |
327 | 328 | ||
328 | int get_stram_list( char *buf ) | 329 | static int stram_proc_show(struct seq_file *m, void *v) |
329 | { | 330 | { |
330 | int len = 0; | ||
331 | BLOCK *p; | 331 | BLOCK *p; |
332 | 332 | ||
333 | PRINT_PROC("Total ST-RAM: %8u kB\n", | 333 | PRINT_PROC("Total ST-RAM: %8u kB\n", |
334 | (stram_end - stram_start) >> 10); | 334 | (stram_end - stram_start) >> 10); |
335 | PRINT_PROC( "Allocated regions:\n" ); | 335 | PRINT_PROC( "Allocated regions:\n" ); |
336 | for( p = alloc_list; p; p = p->next ) { | 336 | for( p = alloc_list; p; p = p->next ) { |
337 | if (len + 50 >= PAGE_SIZE) | ||
338 | break; | ||
339 | PRINT_PROC("0x%08lx-0x%08lx: %s (", | 337 | PRINT_PROC("0x%08lx-0x%08lx: %s (", |
340 | virt_to_phys(p->start), | 338 | virt_to_phys(p->start), |
341 | virt_to_phys(p->start+p->size-1), | 339 | virt_to_phys(p->start+p->size-1), |
@@ -346,9 +344,27 @@ int get_stram_list( char *buf ) | |||
346 | PRINT_PROC( "??)\n" ); | 344 | PRINT_PROC( "??)\n" ); |
347 | } | 345 | } |
348 | 346 | ||
349 | return( len ); | 347 | return 0; |
348 | } | ||
349 | |||
350 | static int stram_proc_open(struct inode *inode, struct file *file) | ||
351 | { | ||
352 | return single_open(file, stram_proc_show, NULL); | ||
350 | } | 353 | } |
351 | 354 | ||
355 | static const struct file_operations stram_proc_fops = { | ||
356 | .open = stram_proc_open, | ||
357 | .read = seq_read, | ||
358 | .llseek = seq_lseek, | ||
359 | .release = single_release, | ||
360 | }; | ||
361 | |||
362 | static int __init proc_stram_init(void) | ||
363 | { | ||
364 | proc_create("stram", 0, NULL, &stram_proc_fops); | ||
365 | return 0; | ||
366 | } | ||
367 | module_init(proc_stram_init); | ||
352 | #endif | 368 | #endif |
353 | 369 | ||
354 | 370 | ||