aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@gmail.com>2009-03-31 18:19:16 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-04-01 11:59:08 -0400
commitcdda7cd92b9c0b8b25c906a1f39c61954432357a (patch)
tree65e871d4c80b31112df9d2a46a87e107711def95 /drivers/char
parent444697d61b6d5ae43b317d259db7c362c9d3756a (diff)
proc tty: switch ip2 to ->proc_fops
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/ip2/ip2main.c74
1 files changed, 34 insertions, 40 deletions
diff --git a/drivers/char/ip2/ip2main.c b/drivers/char/ip2/ip2main.c
index 70e0ebc30bd0..afd9247cf082 100644
--- a/drivers/char/ip2/ip2main.c
+++ b/drivers/char/ip2/ip2main.c
@@ -139,7 +139,7 @@
139#include <linux/seq_file.h> 139#include <linux/seq_file.h>
140 140
141static const struct file_operations ip2mem_proc_fops; 141static const struct file_operations ip2mem_proc_fops;
142static int ip2_read_proc(char *, char **, off_t, int, int *, void * ); 142static const struct file_operations ip2_proc_fops;
143 143
144/********************/ 144/********************/
145/* Type Definitions */ 145/* Type Definitions */
@@ -446,9 +446,9 @@ static const struct tty_operations ip2_ops = {
446 .stop = ip2_stop, 446 .stop = ip2_stop,
447 .start = ip2_start, 447 .start = ip2_start,
448 .hangup = ip2_hangup, 448 .hangup = ip2_hangup,
449 .read_proc = ip2_read_proc,
450 .tiocmget = ip2_tiocmget, 449 .tiocmget = ip2_tiocmget,
451 .tiocmset = ip2_tiocmset, 450 .tiocmset = ip2_tiocmset,
451 .proc_fops = &ip2_proc_fops,
452}; 452};
453 453
454/******************************************************************************/ 454/******************************************************************************/
@@ -3029,19 +3029,17 @@ static const struct file_operations ip2mem_proc_fops = {
3029 * different sources including ip2mkdev.c and a couple of other drivers. 3029 * different sources including ip2mkdev.c and a couple of other drivers.
3030 * The bugs are all mine. :-) =mhw= 3030 * The bugs are all mine. :-) =mhw=
3031 */ 3031 */
3032static int ip2_read_proc(char *page, char **start, off_t off, 3032static int ip2_proc_show(struct seq_file *m, void *v)
3033 int count, int *eof, void *data)
3034{ 3033{
3035 int i, j, box; 3034 int i, j, box;
3036 int len = 0;
3037 int boxes = 0; 3035 int boxes = 0;
3038 int ports = 0; 3036 int ports = 0;
3039 int tports = 0; 3037 int tports = 0;
3040 off_t begin = 0;
3041 i2eBordStrPtr pB; 3038 i2eBordStrPtr pB;
3039 char *sep;
3042 3040
3043 len += sprintf(page, "ip2info: 1.0 driver: %s\n", pcVersion ); 3041 seq_printf(m, "ip2info: 1.0 driver: %s\n", pcVersion);
3044 len += sprintf(page+len, "Driver: SMajor=%d CMajor=%d IMajor=%d MaxBoards=%d MaxBoxes=%d MaxPorts=%d\n", 3042 seq_printf(m, "Driver: SMajor=%d CMajor=%d IMajor=%d MaxBoards=%d MaxBoxes=%d MaxPorts=%d\n",
3045 IP2_TTY_MAJOR, IP2_CALLOUT_MAJOR, IP2_IPL_MAJOR, 3043 IP2_TTY_MAJOR, IP2_CALLOUT_MAJOR, IP2_IPL_MAJOR,
3046 IP2_MAX_BOARDS, ABS_MAX_BOXES, ABS_BIGGEST_BOX); 3044 IP2_MAX_BOARDS, ABS_MAX_BOXES, ABS_BIGGEST_BOX);
3047 3045
@@ -3053,7 +3051,8 @@ static int ip2_read_proc(char *page, char **start, off_t off,
3053 switch( pB->i2ePom.e.porID & ~POR_ID_RESERVED ) 3051 switch( pB->i2ePom.e.porID & ~POR_ID_RESERVED )
3054 { 3052 {
3055 case POR_ID_FIIEX: 3053 case POR_ID_FIIEX:
3056 len += sprintf( page+len, "Board %d: EX ports=", i ); 3054 seq_printf(m, "Board %d: EX ports=", i);
3055 sep = "";
3057 for( box = 0; box < ABS_MAX_BOXES; ++box ) 3056 for( box = 0; box < ABS_MAX_BOXES; ++box )
3058 { 3057 {
3059 ports = 0; 3058 ports = 0;
@@ -3065,79 +3064,74 @@ static int ip2_read_proc(char *page, char **start, off_t off,
3065 ++ports; 3064 ++ports;
3066 } 3065 }
3067 } 3066 }
3068 len += sprintf( page+len, "%d,", ports ); 3067 seq_printf(m, "%s%d", sep, ports);
3068 sep = ",";
3069 tports += ports; 3069 tports += ports;
3070 } 3070 }
3071 3071 seq_printf(m, " boxes=%d width=%d", boxes, pB->i2eDataWidth16 ? 16 : 8);
3072 --len; /* Backup over that last comma */
3073
3074 len += sprintf( page+len, " boxes=%d width=%d", boxes, pB->i2eDataWidth16 ? 16 : 8 );
3075 break; 3072 break;
3076 3073
3077 case POR_ID_II_4: 3074 case POR_ID_II_4:
3078 len += sprintf(page+len, "Board %d: ISA-4 ports=4 boxes=1", i ); 3075 seq_printf(m, "Board %d: ISA-4 ports=4 boxes=1", i);
3079 tports = ports = 4; 3076 tports = ports = 4;
3080 break; 3077 break;
3081 3078
3082 case POR_ID_II_8: 3079 case POR_ID_II_8:
3083 len += sprintf(page+len, "Board %d: ISA-8-std ports=8 boxes=1", i ); 3080 seq_printf(m, "Board %d: ISA-8-std ports=8 boxes=1", i);
3084 tports = ports = 8; 3081 tports = ports = 8;
3085 break; 3082 break;
3086 3083
3087 case POR_ID_II_8R: 3084 case POR_ID_II_8R:
3088 len += sprintf(page+len, "Board %d: ISA-8-RJ11 ports=8 boxes=1", i ); 3085 seq_printf(m, "Board %d: ISA-8-RJ11 ports=8 boxes=1", i);
3089 tports = ports = 8; 3086 tports = ports = 8;
3090 break; 3087 break;
3091 3088
3092 default: 3089 default:
3093 len += sprintf(page+len, "Board %d: unknown", i ); 3090 seq_printf(m, "Board %d: unknown", i);
3094 /* Don't try and probe for minor numbers */ 3091 /* Don't try and probe for minor numbers */
3095 tports = ports = 0; 3092 tports = ports = 0;
3096 } 3093 }
3097 3094
3098 } else { 3095 } else {
3099 /* Don't try and probe for minor numbers */ 3096 /* Don't try and probe for minor numbers */
3100 len += sprintf(page+len, "Board %d: vacant", i ); 3097 seq_printf(m, "Board %d: vacant", i);
3101 tports = ports = 0; 3098 tports = ports = 0;
3102 } 3099 }
3103 3100
3104 if( tports ) { 3101 if( tports ) {
3105 len += sprintf(page+len, " minors=" ); 3102 seq_puts(m, " minors=");
3106 3103 sep = "";
3107 for ( box = 0; box < ABS_MAX_BOXES; ++box ) 3104 for ( box = 0; box < ABS_MAX_BOXES; ++box )
3108 { 3105 {
3109 for ( j = 0; j < ABS_BIGGEST_BOX; ++j ) 3106 for ( j = 0; j < ABS_BIGGEST_BOX; ++j )
3110 { 3107 {
3111 if ( pB->i2eChannelMap[box] & (1 << j) ) 3108 if ( pB->i2eChannelMap[box] & (1 << j) )
3112 { 3109 {
3113 len += sprintf (page+len,"%d,", 3110 seq_printf(m, "%s%d", sep,
3114 j + ABS_BIGGEST_BOX * 3111 j + ABS_BIGGEST_BOX *
3115 (box+i*ABS_MAX_BOXES)); 3112 (box+i*ABS_MAX_BOXES));
3113 sep = ",";
3116 } 3114 }
3117 } 3115 }
3118 } 3116 }
3119
3120 page[ len - 1 ] = '\n'; /* Overwrite that last comma */
3121 } else {
3122 len += sprintf (page+len,"\n" );
3123 }
3124
3125 if (len+begin > off+count)
3126 break;
3127 if (len+begin < off) {
3128 begin += len;
3129 len = 0;
3130 } 3117 }
3118 seq_putc(m, '\n');
3131 } 3119 }
3120 return 0;
3121 }
3132 3122
3133 if (i >= IP2_MAX_BOARDS) 3123static int ip2_proc_open(struct inode *inode, struct file *file)
3134 *eof = 1; 3124{
3135 if (off >= len+begin) 3125 return single_open(file, ip2_proc_show, NULL);
3136 return 0; 3126}
3137 3127
3138 *start = page + (off-begin); 3128static const struct file_operations ip2_proc_fops = {
3139 return ((count < begin+len-off) ? count : begin+len-off); 3129 .owner = THIS_MODULE,
3140 } 3130 .open = ip2_proc_open,
3131 .read = seq_read,
3132 .llseek = seq_lseek,
3133 .release = single_release,
3134};
3141 3135
3142/******************************************************************************/ 3136/******************************************************************************/
3143/* Function: ip2trace() */ 3137/* Function: ip2trace() */