diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2009-03-31 18:19:17 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-01 11:59:08 -0400 |
commit | 87687144b4fce2ad083e689eec8b219054c292ae (patch) | |
tree | 202b12dd95cab3852d0e3c9ba55b520a660c8138 /drivers | |
parent | 5bd6de7dadb8054a558ae4ac29121d8e93493065 (diff) |
proc tty: switch synclink_cs 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/pcmcia/synclink_cs.c | 73 |
1 files changed, 34 insertions, 39 deletions
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c index 5608a1e5a3b3..19d79fc54461 100644 --- a/drivers/char/pcmcia/synclink_cs.c +++ b/drivers/char/pcmcia/synclink_cs.c | |||
@@ -51,6 +51,7 @@ | |||
51 | #include <linux/ptrace.h> | 51 | #include <linux/ptrace.h> |
52 | #include <linux/ioport.h> | 52 | #include <linux/ioport.h> |
53 | #include <linux/mm.h> | 53 | #include <linux/mm.h> |
54 | #include <linux/seq_file.h> | ||
54 | #include <linux/slab.h> | 55 | #include <linux/slab.h> |
55 | #include <linux/netdevice.h> | 56 | #include <linux/netdevice.h> |
56 | #include <linux/vmalloc.h> | 57 | #include <linux/vmalloc.h> |
@@ -2619,13 +2620,12 @@ cleanup: | |||
2619 | * /proc fs routines.... | 2620 | * /proc fs routines.... |
2620 | */ | 2621 | */ |
2621 | 2622 | ||
2622 | static inline int line_info(char *buf, MGSLPC_INFO *info) | 2623 | static inline void line_info(struct seq_file *m, MGSLPC_INFO *info) |
2623 | { | 2624 | { |
2624 | char stat_buf[30]; | 2625 | char stat_buf[30]; |
2625 | int ret; | ||
2626 | unsigned long flags; | 2626 | unsigned long flags; |
2627 | 2627 | ||
2628 | ret = sprintf(buf, "%s:io:%04X irq:%d", | 2628 | seq_printf(m, "%s:io:%04X irq:%d", |
2629 | info->device_name, info->io_base, info->irq_level); | 2629 | info->device_name, info->io_base, info->irq_level); |
2630 | 2630 | ||
2631 | /* output current serial signal states */ | 2631 | /* output current serial signal states */ |
@@ -2649,75 +2649,70 @@ static inline int line_info(char *buf, MGSLPC_INFO *info) | |||
2649 | strcat(stat_buf, "|RI"); | 2649 | strcat(stat_buf, "|RI"); |
2650 | 2650 | ||
2651 | if (info->params.mode == MGSL_MODE_HDLC) { | 2651 | if (info->params.mode == MGSL_MODE_HDLC) { |
2652 | ret += sprintf(buf+ret, " HDLC txok:%d rxok:%d", | 2652 | seq_printf(m, " HDLC txok:%d rxok:%d", |
2653 | info->icount.txok, info->icount.rxok); | 2653 | info->icount.txok, info->icount.rxok); |
2654 | if (info->icount.txunder) | 2654 | if (info->icount.txunder) |
2655 | ret += sprintf(buf+ret, " txunder:%d", info->icount.txunder); | 2655 | seq_printf(m, " txunder:%d", info->icount.txunder); |
2656 | if (info->icount.txabort) | 2656 | if (info->icount.txabort) |
2657 | ret += sprintf(buf+ret, " txabort:%d", info->icount.txabort); | 2657 | seq_printf(m, " txabort:%d", info->icount.txabort); |
2658 | if (info->icount.rxshort) | 2658 | if (info->icount.rxshort) |
2659 | ret += sprintf(buf+ret, " rxshort:%d", info->icount.rxshort); | 2659 | seq_printf(m, " rxshort:%d", info->icount.rxshort); |
2660 | if (info->icount.rxlong) | 2660 | if (info->icount.rxlong) |
2661 | ret += sprintf(buf+ret, " rxlong:%d", info->icount.rxlong); | 2661 | seq_printf(m, " rxlong:%d", info->icount.rxlong); |
2662 | if (info->icount.rxover) | 2662 | if (info->icount.rxover) |
2663 | ret += sprintf(buf+ret, " rxover:%d", info->icount.rxover); | 2663 | seq_printf(m, " rxover:%d", info->icount.rxover); |
2664 | if (info->icount.rxcrc) | 2664 | if (info->icount.rxcrc) |
2665 | ret += sprintf(buf+ret, " rxcrc:%d", info->icount.rxcrc); | 2665 | seq_printf(m, " rxcrc:%d", info->icount.rxcrc); |
2666 | } else { | 2666 | } else { |
2667 | ret += sprintf(buf+ret, " ASYNC tx:%d rx:%d", | 2667 | seq_printf(m, " ASYNC tx:%d rx:%d", |
2668 | info->icount.tx, info->icount.rx); | 2668 | info->icount.tx, info->icount.rx); |
2669 | if (info->icount.frame) | 2669 | if (info->icount.frame) |
2670 | ret += sprintf(buf+ret, " fe:%d", info->icount.frame); | 2670 | seq_printf(m, " fe:%d", info->icount.frame); |
2671 | if (info->icount.parity) | 2671 | if (info->icount.parity) |
2672 | ret += sprintf(buf+ret, " pe:%d", info->icount.parity); | 2672 | seq_printf(m, " pe:%d", info->icount.parity); |
2673 | if (info->icount.brk) | 2673 | if (info->icount.brk) |
2674 | ret += sprintf(buf+ret, " brk:%d", info->icount.brk); | 2674 | seq_printf(m, " brk:%d", info->icount.brk); |
2675 | if (info->icount.overrun) | 2675 | if (info->icount.overrun) |
2676 | ret += sprintf(buf+ret, " oe:%d", info->icount.overrun); | 2676 | seq_printf(m, " oe:%d", info->icount.overrun); |
2677 | } | 2677 | } |
2678 | 2678 | ||
2679 | /* Append serial signal status to end */ | 2679 | /* Append serial signal status to end */ |
2680 | ret += sprintf(buf+ret, " %s\n", stat_buf+1); | 2680 | seq_printf(m, " %s\n", stat_buf+1); |
2681 | 2681 | ||
2682 | ret += sprintf(buf+ret, "txactive=%d bh_req=%d bh_run=%d pending_bh=%x\n", | 2682 | seq_printf(m, "txactive=%d bh_req=%d bh_run=%d pending_bh=%x\n", |
2683 | info->tx_active,info->bh_requested,info->bh_running, | 2683 | info->tx_active,info->bh_requested,info->bh_running, |
2684 | info->pending_bh); | 2684 | info->pending_bh); |
2685 | |||
2686 | return ret; | ||
2687 | } | 2685 | } |
2688 | 2686 | ||
2689 | /* Called to print information about devices | 2687 | /* Called to print information about devices |
2690 | */ | 2688 | */ |
2691 | static int mgslpc_read_proc(char *page, char **start, off_t off, int count, | 2689 | static int mgslpc_proc_show(struct seq_file *m, void *v) |
2692 | int *eof, void *data) | ||
2693 | { | 2690 | { |
2694 | int len = 0, l; | ||
2695 | off_t begin = 0; | ||
2696 | MGSLPC_INFO *info; | 2691 | MGSLPC_INFO *info; |
2697 | 2692 | ||
2698 | len += sprintf(page, "synclink driver:%s\n", driver_version); | 2693 | seq_printf(m, "synclink driver:%s\n", driver_version); |
2699 | 2694 | ||
2700 | info = mgslpc_device_list; | 2695 | info = mgslpc_device_list; |
2701 | while( info ) { | 2696 | while( info ) { |
2702 | l = line_info(page + len, info); | 2697 | line_info(m, info); |
2703 | len += l; | ||
2704 | if (len+begin > off+count) | ||
2705 | goto done; | ||
2706 | if (len+begin < off) { | ||
2707 | begin += len; | ||
2708 | len = 0; | ||
2709 | } | ||
2710 | info = info->next_device; | 2698 | info = info->next_device; |
2711 | } | 2699 | } |
2700 | return 0; | ||
2701 | } | ||
2712 | 2702 | ||
2713 | *eof = 1; | 2703 | static int mgslpc_proc_open(struct inode *inode, struct file *file) |
2714 | done: | 2704 | { |
2715 | if (off >= len+begin) | 2705 | return single_open(file, mgslpc_proc_show, NULL); |
2716 | return 0; | ||
2717 | *start = page + (off-begin); | ||
2718 | return ((count < begin+len-off) ? count : begin+len-off); | ||
2719 | } | 2706 | } |
2720 | 2707 | ||
2708 | static const struct file_operations mgslpc_proc_fops = { | ||
2709 | .owner = THIS_MODULE, | ||
2710 | .open = mgslpc_proc_open, | ||
2711 | .read = seq_read, | ||
2712 | .llseek = seq_lseek, | ||
2713 | .release = single_release, | ||
2714 | }; | ||
2715 | |||
2721 | static int rx_alloc_buffers(MGSLPC_INFO *info) | 2716 | static int rx_alloc_buffers(MGSLPC_INFO *info) |
2722 | { | 2717 | { |
2723 | /* each buffer has header and data */ | 2718 | /* each buffer has header and data */ |
@@ -2861,13 +2856,13 @@ static const struct tty_operations mgslpc_ops = { | |||
2861 | .send_xchar = mgslpc_send_xchar, | 2856 | .send_xchar = mgslpc_send_xchar, |
2862 | .break_ctl = mgslpc_break, | 2857 | .break_ctl = mgslpc_break, |
2863 | .wait_until_sent = mgslpc_wait_until_sent, | 2858 | .wait_until_sent = mgslpc_wait_until_sent, |
2864 | .read_proc = mgslpc_read_proc, | ||
2865 | .set_termios = mgslpc_set_termios, | 2859 | .set_termios = mgslpc_set_termios, |
2866 | .stop = tx_pause, | 2860 | .stop = tx_pause, |
2867 | .start = tx_release, | 2861 | .start = tx_release, |
2868 | .hangup = mgslpc_hangup, | 2862 | .hangup = mgslpc_hangup, |
2869 | .tiocmget = tiocmget, | 2863 | .tiocmget = tiocmget, |
2870 | .tiocmset = tiocmset, | 2864 | .tiocmset = tiocmset, |
2865 | .proc_fops = &mgslpc_proc_fops, | ||
2871 | }; | 2866 | }; |
2872 | 2867 | ||
2873 | static void synclink_cs_cleanup(void) | 2868 | static void synclink_cs_cleanup(void) |