aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@gmail.com>2009-03-31 18:19:20 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-04-01 11:59:09 -0400
commite6c8dd8a5c887caaf6ee29f04c7260617cb28295 (patch)
tree2bbf4b2d03e9d2ea0bfd50b8862807c1fe63c3e9 /drivers
parenta18c56e5af41a6391a6bee2c26e806e7997f6698 (diff)
proc tty: switch synclinkmp 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')
-rw-r--r--drivers/char/synclinkmp.c74
1 files changed, 34 insertions, 40 deletions
diff --git a/drivers/char/synclinkmp.c b/drivers/char/synclinkmp.c
index 8eb6c89a980e..26de60efe4b2 100644
--- a/drivers/char/synclinkmp.c
+++ b/drivers/char/synclinkmp.c
@@ -50,6 +50,7 @@
50#include <linux/ptrace.h> 50#include <linux/ptrace.h>
51#include <linux/ioport.h> 51#include <linux/ioport.h>
52#include <linux/mm.h> 52#include <linux/mm.h>
53#include <linux/seq_file.h>
53#include <linux/slab.h> 54#include <linux/slab.h>
54#include <linux/netdevice.h> 55#include <linux/netdevice.h>
55#include <linux/vmalloc.h> 56#include <linux/vmalloc.h>
@@ -520,7 +521,6 @@ static void tx_hold(struct tty_struct *tty);
520static void tx_release(struct tty_struct *tty); 521static void tx_release(struct tty_struct *tty);
521 522
522static int ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg); 523static int ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg);
523static int read_proc(char *page, char **start, off_t off, int count,int *eof, void *data);
524static int chars_in_buffer(struct tty_struct *tty); 524static int chars_in_buffer(struct tty_struct *tty);
525static void throttle(struct tty_struct * tty); 525static void throttle(struct tty_struct * tty);
526static void unthrottle(struct tty_struct * tty); 526static void unthrottle(struct tty_struct * tty);
@@ -1354,13 +1354,12 @@ static int ioctl(struct tty_struct *tty, struct file *file,
1354 * /proc fs routines.... 1354 * /proc fs routines....
1355 */ 1355 */
1356 1356
1357static inline int line_info(char *buf, SLMP_INFO *info) 1357static inline void line_info(struct seq_file *m, SLMP_INFO *info)
1358{ 1358{
1359 char stat_buf[30]; 1359 char stat_buf[30];
1360 int ret;
1361 unsigned long flags; 1360 unsigned long flags;
1362 1361
1363 ret = sprintf(buf, "%s: SCABase=%08x Mem=%08X StatusControl=%08x LCR=%08X\n" 1362 seq_printf(m, "%s: SCABase=%08x Mem=%08X StatusControl=%08x LCR=%08X\n"
1364 "\tIRQ=%d MaxFrameSize=%u\n", 1363 "\tIRQ=%d MaxFrameSize=%u\n",
1365 info->device_name, 1364 info->device_name,
1366 info->phys_sca_base, 1365 info->phys_sca_base,
@@ -1391,75 +1390,70 @@ static inline int line_info(char *buf, SLMP_INFO *info)
1391 strcat(stat_buf, "|RI"); 1390 strcat(stat_buf, "|RI");
1392 1391
1393 if (info->params.mode == MGSL_MODE_HDLC) { 1392 if (info->params.mode == MGSL_MODE_HDLC) {
1394 ret += sprintf(buf+ret, "\tHDLC txok:%d rxok:%d", 1393 seq_printf(m, "\tHDLC txok:%d rxok:%d",
1395 info->icount.txok, info->icount.rxok); 1394 info->icount.txok, info->icount.rxok);
1396 if (info->icount.txunder) 1395 if (info->icount.txunder)
1397 ret += sprintf(buf+ret, " txunder:%d", info->icount.txunder); 1396 seq_printf(m, " txunder:%d", info->icount.txunder);
1398 if (info->icount.txabort) 1397 if (info->icount.txabort)
1399 ret += sprintf(buf+ret, " txabort:%d", info->icount.txabort); 1398 seq_printf(m, " txabort:%d", info->icount.txabort);
1400 if (info->icount.rxshort) 1399 if (info->icount.rxshort)
1401 ret += sprintf(buf+ret, " rxshort:%d", info->icount.rxshort); 1400 seq_printf(m, " rxshort:%d", info->icount.rxshort);
1402 if (info->icount.rxlong) 1401 if (info->icount.rxlong)
1403 ret += sprintf(buf+ret, " rxlong:%d", info->icount.rxlong); 1402 seq_printf(m, " rxlong:%d", info->icount.rxlong);
1404 if (info->icount.rxover) 1403 if (info->icount.rxover)
1405 ret += sprintf(buf+ret, " rxover:%d", info->icount.rxover); 1404 seq_printf(m, " rxover:%d", info->icount.rxover);
1406 if (info->icount.rxcrc) 1405 if (info->icount.rxcrc)
1407 ret += sprintf(buf+ret, " rxlong:%d", info->icount.rxcrc); 1406 seq_printf(m, " rxlong:%d", info->icount.rxcrc);
1408 } else { 1407 } else {
1409 ret += sprintf(buf+ret, "\tASYNC tx:%d rx:%d", 1408 seq_printf(m, "\tASYNC tx:%d rx:%d",
1410 info->icount.tx, info->icount.rx); 1409 info->icount.tx, info->icount.rx);
1411 if (info->icount.frame) 1410 if (info->icount.frame)
1412 ret += sprintf(buf+ret, " fe:%d", info->icount.frame); 1411 seq_printf(m, " fe:%d", info->icount.frame);
1413 if (info->icount.parity) 1412 if (info->icount.parity)
1414 ret += sprintf(buf+ret, " pe:%d", info->icount.parity); 1413 seq_printf(m, " pe:%d", info->icount.parity);
1415 if (info->icount.brk) 1414 if (info->icount.brk)
1416 ret += sprintf(buf+ret, " brk:%d", info->icount.brk); 1415 seq_printf(m, " brk:%d", info->icount.brk);
1417 if (info->icount.overrun) 1416 if (info->icount.overrun)
1418 ret += sprintf(buf+ret, " oe:%d", info->icount.overrun); 1417 seq_printf(m, " oe:%d", info->icount.overrun);
1419 } 1418 }
1420 1419
1421 /* Append serial signal status to end */ 1420 /* Append serial signal status to end */
1422 ret += sprintf(buf+ret, " %s\n", stat_buf+1); 1421 seq_printf(m, " %s\n", stat_buf+1);
1423 1422
1424 ret += sprintf(buf+ret, "\ttxactive=%d bh_req=%d bh_run=%d pending_bh=%x\n", 1423 seq_printf(m, "\ttxactive=%d bh_req=%d bh_run=%d pending_bh=%x\n",
1425 info->tx_active,info->bh_requested,info->bh_running, 1424 info->tx_active,info->bh_requested,info->bh_running,
1426 info->pending_bh); 1425 info->pending_bh);
1427
1428 return ret;
1429} 1426}
1430 1427
1431/* Called to print information about devices 1428/* Called to print information about devices
1432 */ 1429 */
1433static int read_proc(char *page, char **start, off_t off, int count, 1430static int synclinkmp_proc_show(struct seq_file *m, void *v)
1434 int *eof, void *data)
1435{ 1431{
1436 int len = 0, l;
1437 off_t begin = 0;
1438 SLMP_INFO *info; 1432 SLMP_INFO *info;
1439 1433
1440 len += sprintf(page, "synclinkmp driver:%s\n", driver_version); 1434 seq_printf(m, "synclinkmp driver:%s\n", driver_version);
1441 1435
1442 info = synclinkmp_device_list; 1436 info = synclinkmp_device_list;
1443 while( info ) { 1437 while( info ) {
1444 l = line_info(page + len, info); 1438 line_info(m, info);
1445 len += l;
1446 if (len+begin > off+count)
1447 goto done;
1448 if (len+begin < off) {
1449 begin += len;
1450 len = 0;
1451 }
1452 info = info->next_device; 1439 info = info->next_device;
1453 } 1440 }
1441 return 0;
1442}
1454 1443
1455 *eof = 1; 1444static int synclinkmp_proc_open(struct inode *inode, struct file *file)
1456done: 1445{
1457 if (off >= len+begin) 1446 return single_open(file, synclinkmp_proc_show, NULL);
1458 return 0;
1459 *start = page + (off-begin);
1460 return ((count < begin+len-off) ? count : begin+len-off);
1461} 1447}
1462 1448
1449static const struct file_operations synclinkmp_proc_fops = {
1450 .owner = THIS_MODULE,
1451 .open = synclinkmp_proc_open,
1452 .read = seq_read,
1453 .llseek = seq_lseek,
1454 .release = single_release,
1455};
1456
1463/* Return the count of bytes in transmit buffer 1457/* Return the count of bytes in transmit buffer
1464 */ 1458 */
1465static int chars_in_buffer(struct tty_struct *tty) 1459static int chars_in_buffer(struct tty_struct *tty)
@@ -3905,13 +3899,13 @@ static const struct tty_operations ops = {
3905 .send_xchar = send_xchar, 3899 .send_xchar = send_xchar,
3906 .break_ctl = set_break, 3900 .break_ctl = set_break,
3907 .wait_until_sent = wait_until_sent, 3901 .wait_until_sent = wait_until_sent,
3908 .read_proc = read_proc,
3909 .set_termios = set_termios, 3902 .set_termios = set_termios,
3910 .stop = tx_hold, 3903 .stop = tx_hold,
3911 .start = tx_release, 3904 .start = tx_release,
3912 .hangup = hangup, 3905 .hangup = hangup,
3913 .tiocmget = tiocmget, 3906 .tiocmget = tiocmget,
3914 .tiocmset = tiocmset, 3907 .tiocmset = tiocmset,
3908 .proc_fops = &synclinkmp_proc_fops,
3915}; 3909};
3916 3910
3917 3911