aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@sw.ru>2008-04-29 04:01:55 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-29 11:06:19 -0400
commit4a5cdb5b8f10998603e1e44adec1e56c234babfe (patch)
treeb2b9cef90dd8d3bc407a4d6c029db83c199d934c /drivers
parent076ec04b8ac84a04df67840f15f36218d7519510 (diff)
proc: switch /proc/ip2mem to seq_file interface
/******************************************/ /* Remove useless comment, while I am it. */ /******************************************/ Signed-off-by: Alexey Dobriyan <adobriyan@sw.ru> Cc: Greg Kroah-Hartman <gregkh@suse.de> Cc: Jeff Garzik <jeff@garzik.org> Cc: Jeff Dike <jdike@addtoit.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/ip2/ip2main.c53
1 files changed, 25 insertions, 28 deletions
diff --git a/drivers/char/ip2/ip2main.c b/drivers/char/ip2/ip2main.c
index a784f5e22ee9..0a61856c631f 100644
--- a/drivers/char/ip2/ip2main.c
+++ b/drivers/char/ip2/ip2main.c
@@ -133,8 +133,9 @@
133 *****************/ 133 *****************/
134 134
135#include <linux/proc_fs.h> 135#include <linux/proc_fs.h>
136#include <linux/seq_file.h>
136 137
137static int ip2_read_procmem(char *, char **, off_t, int); 138static const struct file_operations ip2mem_proc_fops;
138static int ip2_read_proc(char *, char **, off_t, int, int *, void * ); 139static int ip2_read_proc(char *, char **, off_t, int, int *, void * );
139 140
140/********************/ 141/********************/
@@ -695,7 +696,7 @@ ip2_loadmain(int *iop, int *irqp, unsigned char *firmware, int firmsize)
695 } 696 }
696 } 697 }
697 /* Register the read_procmem thing */ 698 /* Register the read_procmem thing */
698 if (!create_proc_info_entry("ip2mem",0,NULL,ip2_read_procmem)) { 699 if (!proc_create("ip2mem",0,NULL,&ip2mem_proc_fops)) {
699 printk(KERN_ERR "IP2: failed to register read_procmem\n"); 700 printk(KERN_ERR "IP2: failed to register read_procmem\n");
700 } else { 701 } else {
701 702
@@ -2967,65 +2968,61 @@ ip2_ipl_open( struct inode *pInode, struct file *pFile )
2967 } 2968 }
2968 return 0; 2969 return 0;
2969} 2970}
2970/******************************************************************************/
2971/* Function: ip2_read_procmem */
2972/* Parameters: */
2973/* */
2974/* Returns: Length of output */
2975/* */
2976/* Description: */
2977/* Supplies some driver operating parameters */
2978/* Not real useful unless your debugging the fifo */
2979/* */
2980/******************************************************************************/
2981
2982#define LIMIT (PAGE_SIZE - 120)
2983 2971
2984static int 2972static int
2985ip2_read_procmem(char *buf, char **start, off_t offset, int len) 2973proc_ip2mem_show(struct seq_file *m, void *v)
2986{ 2974{
2987 i2eBordStrPtr pB; 2975 i2eBordStrPtr pB;
2988 i2ChanStrPtr pCh; 2976 i2ChanStrPtr pCh;
2989 PTTY tty; 2977 PTTY tty;
2990 int i; 2978 int i;
2991 2979
2992 len = 0;
2993
2994#define FMTLINE "%3d: 0x%08x 0x%08x 0%011o 0%011o\n" 2980#define FMTLINE "%3d: 0x%08x 0x%08x 0%011o 0%011o\n"
2995#define FMTLIN2 " 0x%04x 0x%04x tx flow 0x%x\n" 2981#define FMTLIN2 " 0x%04x 0x%04x tx flow 0x%x\n"
2996#define FMTLIN3 " 0x%04x 0x%04x rc flow\n" 2982#define FMTLIN3 " 0x%04x 0x%04x rc flow\n"
2997 2983
2998 len += sprintf(buf+len,"\n"); 2984 seq_printf(m,"\n");
2999 2985
3000 for( i = 0; i < IP2_MAX_BOARDS; ++i ) { 2986 for( i = 0; i < IP2_MAX_BOARDS; ++i ) {
3001 pB = i2BoardPtrTable[i]; 2987 pB = i2BoardPtrTable[i];
3002 if ( pB ) { 2988 if ( pB ) {
3003 len += sprintf(buf+len,"board %d:\n",i); 2989 seq_printf(m,"board %d:\n",i);
3004 len += sprintf(buf+len,"\tFifo rem: %d mty: %x outM %x\n", 2990 seq_printf(m,"\tFifo rem: %d mty: %x outM %x\n",
3005 pB->i2eFifoRemains,pB->i2eWaitingForEmptyFifo,pB->i2eOutMailWaiting); 2991 pB->i2eFifoRemains,pB->i2eWaitingForEmptyFifo,pB->i2eOutMailWaiting);
3006 } 2992 }
3007 } 2993 }
3008 2994
3009 len += sprintf(buf+len,"#: tty flags, port flags, cflags, iflags\n"); 2995 seq_printf(m,"#: tty flags, port flags, cflags, iflags\n");
3010 for (i=0; i < IP2_MAX_PORTS; i++) { 2996 for (i=0; i < IP2_MAX_PORTS; i++) {
3011 if (len > LIMIT)
3012 break;
3013 pCh = DevTable[i]; 2997 pCh = DevTable[i];
3014 if (pCh) { 2998 if (pCh) {
3015 tty = pCh->pTTY; 2999 tty = pCh->pTTY;
3016 if (tty && tty->count) { 3000 if (tty && tty->count) {
3017 len += sprintf(buf+len,FMTLINE,i,(int)tty->flags,pCh->flags, 3001 seq_printf(m,FMTLINE,i,(int)tty->flags,pCh->flags,
3018 tty->termios->c_cflag,tty->termios->c_iflag); 3002 tty->termios->c_cflag,tty->termios->c_iflag);
3019 3003
3020 len += sprintf(buf+len,FMTLIN2, 3004 seq_printf(m,FMTLIN2,
3021 pCh->outfl.asof,pCh->outfl.room,pCh->channelNeeds); 3005 pCh->outfl.asof,pCh->outfl.room,pCh->channelNeeds);
3022 len += sprintf(buf+len,FMTLIN3,pCh->infl.asof,pCh->infl.room); 3006 seq_printf(m,FMTLIN3,pCh->infl.asof,pCh->infl.room);
3023 } 3007 }
3024 } 3008 }
3025 } 3009 }
3026 return len; 3010 return 0;
3011}
3012
3013static int proc_ip2mem_open(struct inode *inode, struct file *file)
3014{
3015 return single_open(file, proc_ip2mem_show, NULL);
3027} 3016}
3028 3017
3018static const struct file_operations ip2mem_proc_fops = {
3019 .owner = THIS_MODULE,
3020 .open = proc_ip2mem_open,
3021 .read = seq_read,
3022 .llseek = seq_lseek,
3023 .release = single_release,
3024};
3025
3029/* 3026/*
3030 * This is the handler for /proc/tty/driver/ip2 3027 * This is the handler for /proc/tty/driver/ip2
3031 * 3028 *