aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/card
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
commit201a50ba6627dd00aa7b7673a5c454ca387095fb (patch)
treec053687969b09ffe21fae0d00615be00ea3700ef /drivers/mmc/card
parente6c8dd8a5c887caaf6ee29f04c7260617cb28295 (diff)
proc tty: switch sdio_uart 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/mmc/card')
-rw-r--r--drivers/mmc/card/sdio_uart.c62
1 files changed, 30 insertions, 32 deletions
diff --git a/drivers/mmc/card/sdio_uart.c b/drivers/mmc/card/sdio_uart.c
index 78ad48718ab0..36a8d53ad2a2 100644
--- a/drivers/mmc/card/sdio_uart.c
+++ b/drivers/mmc/card/sdio_uart.c
@@ -30,6 +30,7 @@
30#include <linux/init.h> 30#include <linux/init.h>
31#include <linux/kernel.h> 31#include <linux/kernel.h>
32#include <linux/mutex.h> 32#include <linux/mutex.h>
33#include <linux/seq_file.h>
33#include <linux/serial_reg.h> 34#include <linux/serial_reg.h>
34#include <linux/circ_buf.h> 35#include <linux/circ_buf.h>
35#include <linux/gfp.h> 36#include <linux/gfp.h>
@@ -933,67 +934,64 @@ static int sdio_uart_tiocmset(struct tty_struct *tty, struct file *file,
933 return result; 934 return result;
934} 935}
935 936
936static int sdio_uart_read_proc(char *page, char **start, off_t off, 937static int sdio_uart_proc_show(struct seq_file *m, void *v)
937 int count, int *eof, void *data)
938{ 938{
939 int i, len = 0; 939 int i;
940 off_t begin = 0;
941 940
942 len += sprintf(page, "serinfo:1.0 driver%s%s revision:%s\n", 941 seq_printf(m, "serinfo:1.0 driver%s%s revision:%s\n",
943 "", "", ""); 942 "", "", "");
944 for (i = 0; i < UART_NR && len < PAGE_SIZE - 96; i++) { 943 for (i = 0; i < UART_NR; i++) {
945 struct sdio_uart_port *port = sdio_uart_port_get(i); 944 struct sdio_uart_port *port = sdio_uart_port_get(i);
946 if (port) { 945 if (port) {
947 len += sprintf(page+len, "%d: uart:SDIO", i); 946 seq_printf(m, "%d: uart:SDIO", i);
948 if(capable(CAP_SYS_ADMIN)) { 947 if(capable(CAP_SYS_ADMIN)) {
949 len += sprintf(page + len, " tx:%d rx:%d", 948 seq_printf(m, " tx:%d rx:%d",
950 port->icount.tx, port->icount.rx); 949 port->icount.tx, port->icount.rx);
951 if (port->icount.frame) 950 if (port->icount.frame)
952 len += sprintf(page + len, " fe:%d", 951 seq_printf(m, " fe:%d",
953 port->icount.frame); 952 port->icount.frame);
954 if (port->icount.parity) 953 if (port->icount.parity)
955 len += sprintf(page + len, " pe:%d", 954 seq_printf(m, " pe:%d",
956 port->icount.parity); 955 port->icount.parity);
957 if (port->icount.brk) 956 if (port->icount.brk)
958 len += sprintf(page + len, " brk:%d", 957 seq_printf(m, " brk:%d",
959 port->icount.brk); 958 port->icount.brk);
960 if (port->icount.overrun) 959 if (port->icount.overrun)
961 len += sprintf(page + len, " oe:%d", 960 seq_printf(m, " oe:%d",
962 port->icount.overrun); 961 port->icount.overrun);
963 if (port->icount.cts) 962 if (port->icount.cts)
964 len += sprintf(page + len, " cts:%d", 963 seq_printf(m, " cts:%d",
965 port->icount.cts); 964 port->icount.cts);
966 if (port->icount.dsr) 965 if (port->icount.dsr)
967 len += sprintf(page + len, " dsr:%d", 966 seq_printf(m, " dsr:%d",
968 port->icount.dsr); 967 port->icount.dsr);
969 if (port->icount.rng) 968 if (port->icount.rng)
970 len += sprintf(page + len, " rng:%d", 969 seq_printf(m, " rng:%d",
971 port->icount.rng); 970 port->icount.rng);
972 if (port->icount.dcd) 971 if (port->icount.dcd)
973 len += sprintf(page + len, " dcd:%d", 972 seq_printf(m, " dcd:%d",
974 port->icount.dcd); 973 port->icount.dcd);
975 } 974 }
976 strcat(page, "\n");
977 len++;
978 sdio_uart_port_put(port); 975 sdio_uart_port_put(port);
979 } 976 seq_putc(m, '\n');
980
981 if (len + begin > off + count)
982 goto done;
983 if (len + begin < off) {
984 begin += len;
985 len = 0;
986 } 977 }
987 } 978 }
988 *eof = 1; 979 return 0;
980}
989 981
990done: 982static int sdio_uart_proc_open(struct inode *inode, struct file *file)
991 if (off >= len + begin) 983{
992 return 0; 984 return single_open(file, sdio_uart_proc_show, NULL);
993 *start = page + (off - begin);
994 return (count < begin + len - off) ? count : (begin + len - off);
995} 985}
996 986
987static const struct file_operations sdio_uart_proc_fops = {
988 .owner = THIS_MODULE,
989 .open = sdio_uart_proc_open,
990 .read = seq_read,
991 .llseek = seq_lseek,
992 .release = single_release,
993};
994
997static const struct tty_operations sdio_uart_ops = { 995static const struct tty_operations sdio_uart_ops = {
998 .open = sdio_uart_open, 996 .open = sdio_uart_open,
999 .close = sdio_uart_close, 997 .close = sdio_uart_close,
@@ -1007,7 +1005,7 @@ static const struct tty_operations sdio_uart_ops = {
1007 .break_ctl = sdio_uart_break_ctl, 1005 .break_ctl = sdio_uart_break_ctl,
1008 .tiocmget = sdio_uart_tiocmget, 1006 .tiocmget = sdio_uart_tiocmget,
1009 .tiocmset = sdio_uart_tiocmset, 1007 .tiocmset = sdio_uart_tiocmset,
1010 .read_proc = sdio_uart_read_proc, 1008 .proc_fops = &sdio_uart_proc_fops,
1011}; 1009};
1012 1010
1013static struct tty_driver *sdio_uart_tty_driver; 1011static struct tty_driver *sdio_uart_tty_driver;