aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@gmail.com>2009-03-31 18:19:19 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-04-01 11:59:09 -0400
commita18c56e5af41a6391a6bee2c26e806e7997f6698 (patch)
tree4bf7eda484355c99b9d9486506e2d1e7ab4cfb64 /drivers/char
parentd337829bd841974045846ec8b428f4199453159e (diff)
proc tty: switch synclink_gt 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/synclink_gt.c74
1 files changed, 34 insertions, 40 deletions
diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c
index efb3dc928a43..6ec6e13d47d7 100644
--- a/drivers/char/synclink_gt.c
+++ b/drivers/char/synclink_gt.c
@@ -60,6 +60,7 @@
60#include <linux/ptrace.h> 60#include <linux/ptrace.h>
61#include <linux/ioport.h> 61#include <linux/ioport.h>
62#include <linux/mm.h> 62#include <linux/mm.h>
63#include <linux/seq_file.h>
63#include <linux/slab.h> 64#include <linux/slab.h>
64#include <linux/netdevice.h> 65#include <linux/netdevice.h>
65#include <linux/vmalloc.h> 66#include <linux/vmalloc.h>
@@ -154,7 +155,6 @@ static void tx_hold(struct tty_struct *tty);
154static void tx_release(struct tty_struct *tty); 155static void tx_release(struct tty_struct *tty);
155 156
156static int ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg); 157static int ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg);
157static int read_proc(char *page, char **start, off_t off, int count,int *eof, void *data);
158static int chars_in_buffer(struct tty_struct *tty); 158static int chars_in_buffer(struct tty_struct *tty);
159static void throttle(struct tty_struct * tty); 159static void throttle(struct tty_struct * tty);
160static void unthrottle(struct tty_struct * tty); 160static void unthrottle(struct tty_struct * tty);
@@ -1229,13 +1229,12 @@ static long slgt_compat_ioctl(struct tty_struct *tty, struct file *file,
1229/* 1229/*
1230 * proc fs support 1230 * proc fs support
1231 */ 1231 */
1232static inline int line_info(char *buf, struct slgt_info *info) 1232static inline void line_info(struct seq_file *m, struct slgt_info *info)
1233{ 1233{
1234 char stat_buf[30]; 1234 char stat_buf[30];
1235 int ret;
1236 unsigned long flags; 1235 unsigned long flags;
1237 1236
1238 ret = sprintf(buf, "%s: IO=%08X IRQ=%d MaxFrameSize=%u\n", 1237 seq_printf(m, "%s: IO=%08X IRQ=%d MaxFrameSize=%u\n",
1239 info->device_name, info->phys_reg_addr, 1238 info->device_name, info->phys_reg_addr,
1240 info->irq_level, info->max_frame_size); 1239 info->irq_level, info->max_frame_size);
1241 1240
@@ -1260,75 +1259,70 @@ static inline int line_info(char *buf, struct slgt_info *info)
1260 strcat(stat_buf, "|RI"); 1259 strcat(stat_buf, "|RI");
1261 1260
1262 if (info->params.mode != MGSL_MODE_ASYNC) { 1261 if (info->params.mode != MGSL_MODE_ASYNC) {
1263 ret += sprintf(buf+ret, "\tHDLC txok:%d rxok:%d", 1262 seq_printf(m, "\tHDLC txok:%d rxok:%d",
1264 info->icount.txok, info->icount.rxok); 1263 info->icount.txok, info->icount.rxok);
1265 if (info->icount.txunder) 1264 if (info->icount.txunder)
1266 ret += sprintf(buf+ret, " txunder:%d", info->icount.txunder); 1265 seq_printf(m, " txunder:%d", info->icount.txunder);
1267 if (info->icount.txabort) 1266 if (info->icount.txabort)
1268 ret += sprintf(buf+ret, " txabort:%d", info->icount.txabort); 1267 seq_printf(m, " txabort:%d", info->icount.txabort);
1269 if (info->icount.rxshort) 1268 if (info->icount.rxshort)
1270 ret += sprintf(buf+ret, " rxshort:%d", info->icount.rxshort); 1269 seq_printf(m, " rxshort:%d", info->icount.rxshort);
1271 if (info->icount.rxlong) 1270 if (info->icount.rxlong)
1272 ret += sprintf(buf+ret, " rxlong:%d", info->icount.rxlong); 1271 seq_printf(m, " rxlong:%d", info->icount.rxlong);
1273 if (info->icount.rxover) 1272 if (info->icount.rxover)
1274 ret += sprintf(buf+ret, " rxover:%d", info->icount.rxover); 1273 seq_printf(m, " rxover:%d", info->icount.rxover);
1275 if (info->icount.rxcrc) 1274 if (info->icount.rxcrc)
1276 ret += sprintf(buf+ret, " rxcrc:%d", info->icount.rxcrc); 1275 seq_printf(m, " rxcrc:%d", info->icount.rxcrc);
1277 } else { 1276 } else {
1278 ret += sprintf(buf+ret, "\tASYNC tx:%d rx:%d", 1277 seq_printf(m, "\tASYNC tx:%d rx:%d",
1279 info->icount.tx, info->icount.rx); 1278 info->icount.tx, info->icount.rx);
1280 if (info->icount.frame) 1279 if (info->icount.frame)
1281 ret += sprintf(buf+ret, " fe:%d", info->icount.frame); 1280 seq_printf(m, " fe:%d", info->icount.frame);
1282 if (info->icount.parity) 1281 if (info->icount.parity)
1283 ret += sprintf(buf+ret, " pe:%d", info->icount.parity); 1282 seq_printf(m, " pe:%d", info->icount.parity);
1284 if (info->icount.brk) 1283 if (info->icount.brk)
1285 ret += sprintf(buf+ret, " brk:%d", info->icount.brk); 1284 seq_printf(m, " brk:%d", info->icount.brk);
1286 if (info->icount.overrun) 1285 if (info->icount.overrun)
1287 ret += sprintf(buf+ret, " oe:%d", info->icount.overrun); 1286 seq_printf(m, " oe:%d", info->icount.overrun);
1288 } 1287 }
1289 1288
1290 /* Append serial signal status to end */ 1289 /* Append serial signal status to end */
1291 ret += sprintf(buf+ret, " %s\n", stat_buf+1); 1290 seq_printf(m, " %s\n", stat_buf+1);
1292 1291
1293 ret += sprintf(buf+ret, "\ttxactive=%d bh_req=%d bh_run=%d pending_bh=%x\n", 1292 seq_printf(m, "\ttxactive=%d bh_req=%d bh_run=%d pending_bh=%x\n",
1294 info->tx_active,info->bh_requested,info->bh_running, 1293 info->tx_active,info->bh_requested,info->bh_running,
1295 info->pending_bh); 1294 info->pending_bh);
1296
1297 return ret;
1298} 1295}
1299 1296
1300/* Called to print information about devices 1297/* Called to print information about devices
1301 */ 1298 */
1302static int read_proc(char *page, char **start, off_t off, int count, 1299static int synclink_gt_proc_show(struct seq_file *m, void *v)
1303 int *eof, void *data)
1304{ 1300{
1305 int len = 0, l;
1306 off_t begin = 0;
1307 struct slgt_info *info; 1301 struct slgt_info *info;
1308 1302
1309 len += sprintf(page, "synclink_gt driver\n"); 1303 seq_puts(m, "synclink_gt driver\n");
1310 1304
1311 info = slgt_device_list; 1305 info = slgt_device_list;
1312 while( info ) { 1306 while( info ) {
1313 l = line_info(page + len, info); 1307 line_info(m, info);
1314 len += l;
1315 if (len+begin > off+count)
1316 goto done;
1317 if (len+begin < off) {
1318 begin += len;
1319 len = 0;
1320 }
1321 info = info->next_device; 1308 info = info->next_device;
1322 } 1309 }
1310 return 0;
1311}
1323 1312
1324 *eof = 1; 1313static int synclink_gt_proc_open(struct inode *inode, struct file *file)
1325done: 1314{
1326 if (off >= len+begin) 1315 return single_open(file, synclink_gt_proc_show, NULL);
1327 return 0;
1328 *start = page + (off-begin);
1329 return ((count < begin+len-off) ? count : begin+len-off);
1330} 1316}
1331 1317
1318static const struct file_operations synclink_gt_proc_fops = {
1319 .owner = THIS_MODULE,
1320 .open = synclink_gt_proc_open,
1321 .read = seq_read,
1322 .llseek = seq_lseek,
1323 .release = single_release,
1324};
1325
1332/* 1326/*
1333 * return count of bytes in transmit buffer 1327 * return count of bytes in transmit buffer
1334 */ 1328 */
@@ -3562,13 +3556,13 @@ static const struct tty_operations ops = {
3562 .send_xchar = send_xchar, 3556 .send_xchar = send_xchar,
3563 .break_ctl = set_break, 3557 .break_ctl = set_break,
3564 .wait_until_sent = wait_until_sent, 3558 .wait_until_sent = wait_until_sent,
3565 .read_proc = read_proc,
3566 .set_termios = set_termios, 3559 .set_termios = set_termios,
3567 .stop = tx_hold, 3560 .stop = tx_hold,
3568 .start = tx_release, 3561 .start = tx_release,
3569 .hangup = hangup, 3562 .hangup = hangup,
3570 .tiocmget = tiocmget, 3563 .tiocmget = tiocmget,
3571 .tiocmset = tiocmset, 3564 .tiocmset = tiocmset,
3565 .proc_fops = &synclink_gt_proc_fops,
3572}; 3566};
3573 3567
3574static void slgt_cleanup(void) 3568static void slgt_cleanup(void)