diff options
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/amiserial.c | 62 | ||||
-rw-r--r-- | drivers/char/cyclades.c | 54 | ||||
-rw-r--r-- | drivers/char/ip2/ip2main.c | 74 | ||||
-rw-r--r-- | drivers/char/istallion.c | 121 | ||||
-rw-r--r-- | drivers/char/pcmcia/synclink_cs.c | 73 | ||||
-rw-r--r-- | drivers/char/stallion.c | 126 | ||||
-rw-r--r-- | drivers/char/synclink.c | 98 | ||||
-rw-r--r-- | drivers/char/synclink_gt.c | 74 | ||||
-rw-r--r-- | drivers/char/synclinkmp.c | 74 | ||||
-rw-r--r-- | drivers/char/sysrq.c | 21 | ||||
-rw-r--r-- | drivers/char/tty_io.c | 20 |
11 files changed, 354 insertions, 443 deletions
diff --git a/drivers/char/amiserial.c b/drivers/char/amiserial.c index a58869ea851..fd3ebd1be57 100644 --- a/drivers/char/amiserial.c +++ b/drivers/char/amiserial.c | |||
@@ -79,6 +79,7 @@ static char *serial_version = "4.30"; | |||
79 | #include <linux/ptrace.h> | 79 | #include <linux/ptrace.h> |
80 | #include <linux/ioport.h> | 80 | #include <linux/ioport.h> |
81 | #include <linux/mm.h> | 81 | #include <linux/mm.h> |
82 | #include <linux/seq_file.h> | ||
82 | #include <linux/slab.h> | 83 | #include <linux/slab.h> |
83 | #include <linux/init.h> | 84 | #include <linux/init.h> |
84 | #include <linux/bitops.h> | 85 | #include <linux/bitops.h> |
@@ -1825,14 +1826,13 @@ static int rs_open(struct tty_struct *tty, struct file * filp) | |||
1825 | * /proc fs routines.... | 1826 | * /proc fs routines.... |
1826 | */ | 1827 | */ |
1827 | 1828 | ||
1828 | static inline int line_info(char *buf, struct serial_state *state) | 1829 | static inline void line_info(struct seq_file *m, struct serial_state *state) |
1829 | { | 1830 | { |
1830 | struct async_struct *info = state->info, scr_info; | 1831 | struct async_struct *info = state->info, scr_info; |
1831 | char stat_buf[30], control, status; | 1832 | char stat_buf[30], control, status; |
1832 | int ret; | ||
1833 | unsigned long flags; | 1833 | unsigned long flags; |
1834 | 1834 | ||
1835 | ret = sprintf(buf, "%d: uart:amiga_builtin",state->line); | 1835 | seq_printf(m, "%d: uart:amiga_builtin",state->line); |
1836 | 1836 | ||
1837 | /* | 1837 | /* |
1838 | * Figure out the current RS-232 lines | 1838 | * Figure out the current RS-232 lines |
@@ -1864,55 +1864,49 @@ static inline int line_info(char *buf, struct serial_state *state) | |||
1864 | strcat(stat_buf, "|CD"); | 1864 | strcat(stat_buf, "|CD"); |
1865 | 1865 | ||
1866 | if (info->quot) { | 1866 | if (info->quot) { |
1867 | ret += sprintf(buf+ret, " baud:%d", | 1867 | seq_printf(m, " baud:%d", state->baud_base / info->quot); |
1868 | state->baud_base / info->quot); | ||
1869 | } | 1868 | } |
1870 | 1869 | ||
1871 | ret += sprintf(buf+ret, " tx:%d rx:%d", | 1870 | seq_printf(m, " tx:%d rx:%d", state->icount.tx, state->icount.rx); |
1872 | state->icount.tx, state->icount.rx); | ||
1873 | 1871 | ||
1874 | if (state->icount.frame) | 1872 | if (state->icount.frame) |
1875 | ret += sprintf(buf+ret, " fe:%d", state->icount.frame); | 1873 | seq_printf(m, " fe:%d", state->icount.frame); |
1876 | 1874 | ||
1877 | if (state->icount.parity) | 1875 | if (state->icount.parity) |
1878 | ret += sprintf(buf+ret, " pe:%d", state->icount.parity); | 1876 | seq_printf(m, " pe:%d", state->icount.parity); |
1879 | 1877 | ||
1880 | if (state->icount.brk) | 1878 | if (state->icount.brk) |
1881 | ret += sprintf(buf+ret, " brk:%d", state->icount.brk); | 1879 | seq_printf(m, " brk:%d", state->icount.brk); |
1882 | 1880 | ||
1883 | if (state->icount.overrun) | 1881 | if (state->icount.overrun) |
1884 | ret += sprintf(buf+ret, " oe:%d", state->icount.overrun); | 1882 | seq_printf(m, " oe:%d", state->icount.overrun); |
1885 | 1883 | ||
1886 | /* | 1884 | /* |
1887 | * Last thing is the RS-232 status lines | 1885 | * Last thing is the RS-232 status lines |
1888 | */ | 1886 | */ |
1889 | ret += sprintf(buf+ret, " %s\n", stat_buf+1); | 1887 | seq_printf(m, " %s\n", stat_buf+1); |
1890 | return ret; | ||
1891 | } | 1888 | } |
1892 | 1889 | ||
1893 | static int rs_read_proc(char *page, char **start, off_t off, int count, | 1890 | static int rs_proc_show(struct seq_file *m, void *v) |
1894 | int *eof, void *data) | ||
1895 | { | 1891 | { |
1896 | int len = 0, l; | 1892 | seq_printf(m, "serinfo:1.0 driver:%s\n", serial_version); |
1897 | off_t begin = 0; | 1893 | line_info(m, &rs_table[0]); |
1898 | 1894 | return 0; | |
1899 | len += sprintf(page, "serinfo:1.0 driver:%s\n", serial_version); | ||
1900 | l = line_info(page + len, &rs_table[0]); | ||
1901 | len += l; | ||
1902 | if (len+begin > off+count) | ||
1903 | goto done; | ||
1904 | if (len+begin < off) { | ||
1905 | begin += len; | ||
1906 | len = 0; | ||
1907 | } | ||
1908 | *eof = 1; | ||
1909 | done: | ||
1910 | if (off >= len+begin) | ||
1911 | return 0; | ||
1912 | *start = page + (off-begin); | ||
1913 | return ((count < begin+len-off) ? count : begin+len-off); | ||
1914 | } | 1895 | } |
1915 | 1896 | ||
1897 | static int rs_proc_open(struct inode *inode, struct file *file) | ||
1898 | { | ||
1899 | return single_open(file, rs_proc_show, NULL); | ||
1900 | } | ||
1901 | |||
1902 | static const struct file_operations rs_proc_fops = { | ||
1903 | .owner = THIS_MODULE, | ||
1904 | .open = rs_proc_open, | ||
1905 | .read = seq_read, | ||
1906 | .llseek = seq_lseek, | ||
1907 | .release = single_release, | ||
1908 | }; | ||
1909 | |||
1916 | /* | 1910 | /* |
1917 | * --------------------------------------------------------------------- | 1911 | * --------------------------------------------------------------------- |
1918 | * rs_init() and friends | 1912 | * rs_init() and friends |
@@ -1951,9 +1945,9 @@ static const struct tty_operations serial_ops = { | |||
1951 | .break_ctl = rs_break, | 1945 | .break_ctl = rs_break, |
1952 | .send_xchar = rs_send_xchar, | 1946 | .send_xchar = rs_send_xchar, |
1953 | .wait_until_sent = rs_wait_until_sent, | 1947 | .wait_until_sent = rs_wait_until_sent, |
1954 | .read_proc = rs_read_proc, | ||
1955 | .tiocmget = rs_tiocmget, | 1948 | .tiocmget = rs_tiocmget, |
1956 | .tiocmset = rs_tiocmset, | 1949 | .tiocmset = rs_tiocmset, |
1950 | .proc_fops = &rs_proc_fops, | ||
1957 | }; | 1951 | }; |
1958 | 1952 | ||
1959 | /* | 1953 | /* |
diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c index 6a59f72a9c2..272db0e2b49 100644 --- a/drivers/char/cyclades.c +++ b/drivers/char/cyclades.c | |||
@@ -657,6 +657,7 @@ | |||
657 | 657 | ||
658 | #include <linux/stat.h> | 658 | #include <linux/stat.h> |
659 | #include <linux/proc_fs.h> | 659 | #include <linux/proc_fs.h> |
660 | #include <linux/seq_file.h> | ||
660 | 661 | ||
661 | static void cy_throttle(struct tty_struct *tty); | 662 | static void cy_throttle(struct tty_struct *tty); |
662 | static void cy_send_xchar(struct tty_struct *tty, char ch); | 663 | static void cy_send_xchar(struct tty_struct *tty, char ch); |
@@ -868,8 +869,6 @@ static int cyz_issue_cmd(struct cyclades_card *, __u32, __u8, __u32); | |||
868 | static unsigned detect_isa_irq(void __iomem *); | 869 | static unsigned detect_isa_irq(void __iomem *); |
869 | #endif /* CONFIG_ISA */ | 870 | #endif /* CONFIG_ISA */ |
870 | 871 | ||
871 | static int cyclades_get_proc_info(char *, char **, off_t, int, int *, void *); | ||
872 | |||
873 | #ifndef CONFIG_CYZ_INTR | 872 | #ifndef CONFIG_CYZ_INTR |
874 | static void cyz_poll(unsigned long); | 873 | static void cyz_poll(unsigned long); |
875 | 874 | ||
@@ -5216,31 +5215,22 @@ static struct pci_driver cy_pci_driver = { | |||
5216 | }; | 5215 | }; |
5217 | #endif | 5216 | #endif |
5218 | 5217 | ||
5219 | static int | 5218 | static int cyclades_proc_show(struct seq_file *m, void *v) |
5220 | cyclades_get_proc_info(char *buf, char **start, off_t offset, int length, | ||
5221 | int *eof, void *data) | ||
5222 | { | 5219 | { |
5223 | struct cyclades_port *info; | 5220 | struct cyclades_port *info; |
5224 | unsigned int i, j; | 5221 | unsigned int i, j; |
5225 | int len = 0; | ||
5226 | off_t begin = 0; | ||
5227 | off_t pos = 0; | ||
5228 | int size; | ||
5229 | __u32 cur_jifs = jiffies; | 5222 | __u32 cur_jifs = jiffies; |
5230 | 5223 | ||
5231 | size = sprintf(buf, "Dev TimeOpen BytesOut IdleOut BytesIn " | 5224 | seq_puts(m, "Dev TimeOpen BytesOut IdleOut BytesIn " |
5232 | "IdleIn Overruns Ldisc\n"); | 5225 | "IdleIn Overruns Ldisc\n"); |
5233 | 5226 | ||
5234 | pos += size; | ||
5235 | len += size; | ||
5236 | |||
5237 | /* Output one line for each known port */ | 5227 | /* Output one line for each known port */ |
5238 | for (i = 0; i < NR_CARDS; i++) | 5228 | for (i = 0; i < NR_CARDS; i++) |
5239 | for (j = 0; j < cy_card[i].nports; j++) { | 5229 | for (j = 0; j < cy_card[i].nports; j++) { |
5240 | info = &cy_card[i].ports[j]; | 5230 | info = &cy_card[i].ports[j]; |
5241 | 5231 | ||
5242 | if (info->port.count) | 5232 | if (info->port.count) |
5243 | size = sprintf(buf + len, "%3d %8lu %10lu %8lu " | 5233 | seq_printf(m, "%3d %8lu %10lu %8lu " |
5244 | "%10lu %8lu %9lu %6ld\n", info->line, | 5234 | "%10lu %8lu %9lu %6ld\n", info->line, |
5245 | (cur_jifs - info->idle_stats.in_use) / | 5235 | (cur_jifs - info->idle_stats.in_use) / |
5246 | HZ, info->idle_stats.xmit_bytes, | 5236 | HZ, info->idle_stats.xmit_bytes, |
@@ -5251,30 +5241,26 @@ cyclades_get_proc_info(char *buf, char **start, off_t offset, int length, | |||
5251 | /* FIXME: double check locking */ | 5241 | /* FIXME: double check locking */ |
5252 | (long)info->port.tty->ldisc.ops->num); | 5242 | (long)info->port.tty->ldisc.ops->num); |
5253 | else | 5243 | else |
5254 | size = sprintf(buf + len, "%3d %8lu %10lu %8lu " | 5244 | seq_printf(m, "%3d %8lu %10lu %8lu " |
5255 | "%10lu %8lu %9lu %6ld\n", | 5245 | "%10lu %8lu %9lu %6ld\n", |
5256 | info->line, 0L, 0L, 0L, 0L, 0L, 0L, 0L); | 5246 | info->line, 0L, 0L, 0L, 0L, 0L, 0L, 0L); |
5257 | len += size; | ||
5258 | pos = begin + len; | ||
5259 | |||
5260 | if (pos < offset) { | ||
5261 | len = 0; | ||
5262 | begin = pos; | ||
5263 | } | ||
5264 | if (pos > offset + length) | ||
5265 | goto done; | ||
5266 | } | 5247 | } |
5267 | *eof = 1; | 5248 | return 0; |
5268 | done: | 5249 | } |
5269 | *start = buf + (offset - begin); /* Start of wanted data */ | 5250 | |
5270 | len -= (offset - begin); /* Start slop */ | 5251 | static int cyclades_proc_open(struct inode *inode, struct file *file) |
5271 | if (len > length) | 5252 | { |
5272 | len = length; /* Ending slop */ | 5253 | return single_open(file, cyclades_proc_show, NULL); |
5273 | if (len < 0) | ||
5274 | len = 0; | ||
5275 | return len; | ||
5276 | } | 5254 | } |
5277 | 5255 | ||
5256 | static const struct file_operations cyclades_proc_fops = { | ||
5257 | .owner = THIS_MODULE, | ||
5258 | .open = cyclades_proc_open, | ||
5259 | .read = seq_read, | ||
5260 | .llseek = seq_lseek, | ||
5261 | .release = single_release, | ||
5262 | }; | ||
5263 | |||
5278 | /* The serial driver boot-time initialization code! | 5264 | /* The serial driver boot-time initialization code! |
5279 | Hardware I/O ports are mapped to character special devices on a | 5265 | Hardware I/O ports are mapped to character special devices on a |
5280 | first found, first allocated manner. That is, this code searches | 5266 | first found, first allocated manner. That is, this code searches |
@@ -5311,9 +5297,9 @@ static const struct tty_operations cy_ops = { | |||
5311 | .hangup = cy_hangup, | 5297 | .hangup = cy_hangup, |
5312 | .break_ctl = cy_break, | 5298 | .break_ctl = cy_break, |
5313 | .wait_until_sent = cy_wait_until_sent, | 5299 | .wait_until_sent = cy_wait_until_sent, |
5314 | .read_proc = cyclades_get_proc_info, | ||
5315 | .tiocmget = cy_tiocmget, | 5300 | .tiocmget = cy_tiocmget, |
5316 | .tiocmset = cy_tiocmset, | 5301 | .tiocmset = cy_tiocmset, |
5302 | .proc_fops = &cyclades_proc_fops, | ||
5317 | }; | 5303 | }; |
5318 | 5304 | ||
5319 | static int __init cy_init(void) | 5305 | static int __init cy_init(void) |
diff --git a/drivers/char/ip2/ip2main.c b/drivers/char/ip2/ip2main.c index 70e0ebc30bd..afd9247cf08 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 | ||
141 | static const struct file_operations ip2mem_proc_fops; | 141 | static const struct file_operations ip2mem_proc_fops; |
142 | static int ip2_read_proc(char *, char **, off_t, int, int *, void * ); | 142 | static 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 | */ |
3032 | static int ip2_read_proc(char *page, char **start, off_t off, | 3032 | static 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) | 3123 | static 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); | 3128 | static 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() */ |
diff --git a/drivers/char/istallion.c b/drivers/char/istallion.c index 5c3dc6b8411..fff19f7e29d 100644 --- a/drivers/char/istallion.c +++ b/drivers/char/istallion.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/tty.h> | 24 | #include <linux/tty.h> |
25 | #include <linux/tty_flip.h> | 25 | #include <linux/tty_flip.h> |
26 | #include <linux/serial.h> | 26 | #include <linux/serial.h> |
27 | #include <linux/seq_file.h> | ||
27 | #include <linux/cdk.h> | 28 | #include <linux/cdk.h> |
28 | #include <linux/comstats.h> | 29 | #include <linux/comstats.h> |
29 | #include <linux/istallion.h> | 30 | #include <linux/istallion.h> |
@@ -613,7 +614,6 @@ static int stli_breakctl(struct tty_struct *tty, int state); | |||
613 | static void stli_waituntilsent(struct tty_struct *tty, int timeout); | 614 | static void stli_waituntilsent(struct tty_struct *tty, int timeout); |
614 | static void stli_sendxchar(struct tty_struct *tty, char ch); | 615 | static void stli_sendxchar(struct tty_struct *tty, char ch); |
615 | static void stli_hangup(struct tty_struct *tty); | 616 | static void stli_hangup(struct tty_struct *tty); |
616 | static int stli_portinfo(struct stlibrd *brdp, struct stliport *portp, int portnr, char *pos); | ||
617 | 617 | ||
618 | static int stli_brdinit(struct stlibrd *brdp); | 618 | static int stli_brdinit(struct stlibrd *brdp); |
619 | static int stli_startbrd(struct stlibrd *brdp); | 619 | static int stli_startbrd(struct stlibrd *brdp); |
@@ -1893,20 +1893,10 @@ static void stli_sendxchar(struct tty_struct *tty, char ch) | |||
1893 | stli_cmdwait(brdp, portp, A_PORTCTRL, &actrl, sizeof(asyctrl_t), 0); | 1893 | stli_cmdwait(brdp, portp, A_PORTCTRL, &actrl, sizeof(asyctrl_t), 0); |
1894 | } | 1894 | } |
1895 | 1895 | ||
1896 | /*****************************************************************************/ | 1896 | static void stli_portinfo(struct seq_file *m, struct stlibrd *brdp, struct stliport *portp, int portnr) |
1897 | |||
1898 | #define MAXLINE 80 | ||
1899 | |||
1900 | /* | ||
1901 | * Format info for a specified port. The line is deliberately limited | ||
1902 | * to 80 characters. (If it is too long it will be truncated, if too | ||
1903 | * short then padded with spaces). | ||
1904 | */ | ||
1905 | |||
1906 | static int stli_portinfo(struct stlibrd *brdp, struct stliport *portp, int portnr, char *pos) | ||
1907 | { | 1897 | { |
1908 | char *sp, *uart; | 1898 | char *uart; |
1909 | int rc, cnt; | 1899 | int rc; |
1910 | 1900 | ||
1911 | rc = stli_portcmdstats(NULL, portp); | 1901 | rc = stli_portcmdstats(NULL, portp); |
1912 | 1902 | ||
@@ -1918,44 +1908,50 @@ static int stli_portinfo(struct stlibrd *brdp, struct stliport *portp, int portn | |||
1918 | default:uart = "CD1400"; break; | 1908 | default:uart = "CD1400"; break; |
1919 | } | 1909 | } |
1920 | } | 1910 | } |
1921 | 1911 | seq_printf(m, "%d: uart:%s ", portnr, uart); | |
1922 | sp = pos; | ||
1923 | sp += sprintf(sp, "%d: uart:%s ", portnr, uart); | ||
1924 | 1912 | ||
1925 | if ((brdp->state & BST_STARTED) && (rc >= 0)) { | 1913 | if ((brdp->state & BST_STARTED) && (rc >= 0)) { |
1926 | sp += sprintf(sp, "tx:%d rx:%d", (int) stli_comstats.txtotal, | 1914 | char sep; |
1915 | |||
1916 | seq_printf(m, "tx:%d rx:%d", (int) stli_comstats.txtotal, | ||
1927 | (int) stli_comstats.rxtotal); | 1917 | (int) stli_comstats.rxtotal); |
1928 | 1918 | ||
1929 | if (stli_comstats.rxframing) | 1919 | if (stli_comstats.rxframing) |
1930 | sp += sprintf(sp, " fe:%d", | 1920 | seq_printf(m, " fe:%d", |
1931 | (int) stli_comstats.rxframing); | 1921 | (int) stli_comstats.rxframing); |
1932 | if (stli_comstats.rxparity) | 1922 | if (stli_comstats.rxparity) |
1933 | sp += sprintf(sp, " pe:%d", | 1923 | seq_printf(m, " pe:%d", |
1934 | (int) stli_comstats.rxparity); | 1924 | (int) stli_comstats.rxparity); |
1935 | if (stli_comstats.rxbreaks) | 1925 | if (stli_comstats.rxbreaks) |
1936 | sp += sprintf(sp, " brk:%d", | 1926 | seq_printf(m, " brk:%d", |
1937 | (int) stli_comstats.rxbreaks); | 1927 | (int) stli_comstats.rxbreaks); |
1938 | if (stli_comstats.rxoverrun) | 1928 | if (stli_comstats.rxoverrun) |
1939 | sp += sprintf(sp, " oe:%d", | 1929 | seq_printf(m, " oe:%d", |
1940 | (int) stli_comstats.rxoverrun); | 1930 | (int) stli_comstats.rxoverrun); |
1941 | 1931 | ||
1942 | cnt = sprintf(sp, "%s%s%s%s%s ", | 1932 | sep = ' '; |
1943 | (stli_comstats.signals & TIOCM_RTS) ? "|RTS" : "", | 1933 | if (stli_comstats.signals & TIOCM_RTS) { |
1944 | (stli_comstats.signals & TIOCM_CTS) ? "|CTS" : "", | 1934 | seq_printf(m, "%c%s", sep, "RTS"); |
1945 | (stli_comstats.signals & TIOCM_DTR) ? "|DTR" : "", | 1935 | sep = '|'; |
1946 | (stli_comstats.signals & TIOCM_CD) ? "|DCD" : "", | 1936 | } |
1947 | (stli_comstats.signals & TIOCM_DSR) ? "|DSR" : ""); | 1937 | if (stli_comstats.signals & TIOCM_CTS) { |
1948 | *sp = ' '; | 1938 | seq_printf(m, "%c%s", sep, "CTS"); |
1949 | sp += cnt; | 1939 | sep = '|'; |
1940 | } | ||
1941 | if (stli_comstats.signals & TIOCM_DTR) { | ||
1942 | seq_printf(m, "%c%s", sep, "DTR"); | ||
1943 | sep = '|'; | ||
1944 | } | ||
1945 | if (stli_comstats.signals & TIOCM_CD) { | ||
1946 | seq_printf(m, "%c%s", sep, "DCD"); | ||
1947 | sep = '|'; | ||
1948 | } | ||
1949 | if (stli_comstats.signals & TIOCM_DSR) { | ||
1950 | seq_printf(m, "%c%s", sep, "DSR"); | ||
1951 | sep = '|'; | ||
1952 | } | ||
1950 | } | 1953 | } |
1951 | 1954 | seq_putc(m, '\n'); | |
1952 | for (cnt = (sp - pos); (cnt < (MAXLINE - 1)); cnt++) | ||
1953 | *sp++ = ' '; | ||
1954 | if (cnt >= MAXLINE) | ||
1955 | pos[(MAXLINE - 2)] = '+'; | ||
1956 | pos[(MAXLINE - 1)] = '\n'; | ||
1957 | |||
1958 | return(MAXLINE); | ||
1959 | } | 1955 | } |
1960 | 1956 | ||
1961 | /*****************************************************************************/ | 1957 | /*****************************************************************************/ |
@@ -1964,26 +1960,15 @@ static int stli_portinfo(struct stlibrd *brdp, struct stliport *portp, int portn | |||
1964 | * Port info, read from the /proc file system. | 1960 | * Port info, read from the /proc file system. |
1965 | */ | 1961 | */ |
1966 | 1962 | ||
1967 | static int stli_readproc(char *page, char **start, off_t off, int count, int *eof, void *data) | 1963 | static int stli_proc_show(struct seq_file *m, void *v) |
1968 | { | 1964 | { |
1969 | struct stlibrd *brdp; | 1965 | struct stlibrd *brdp; |
1970 | struct stliport *portp; | 1966 | struct stliport *portp; |
1971 | unsigned int brdnr, portnr, totalport; | 1967 | unsigned int brdnr, portnr, totalport; |
1972 | int curoff, maxoff; | ||
1973 | char *pos; | ||
1974 | 1968 | ||
1975 | pos = page; | ||
1976 | totalport = 0; | 1969 | totalport = 0; |
1977 | curoff = 0; | 1970 | |
1978 | 1971 | seq_printf(m, "%s: version %s\n", stli_drvtitle, stli_drvversion); | |
1979 | if (off == 0) { | ||
1980 | pos += sprintf(pos, "%s: version %s", stli_drvtitle, | ||
1981 | stli_drvversion); | ||
1982 | while (pos < (page + MAXLINE - 1)) | ||
1983 | *pos++ = ' '; | ||
1984 | *pos++ = '\n'; | ||
1985 | } | ||
1986 | curoff = MAXLINE; | ||
1987 | 1972 | ||
1988 | /* | 1973 | /* |
1989 | * We scan through for each board, panel and port. The offset is | 1974 | * We scan through for each board, panel and port. The offset is |
@@ -1996,33 +1981,31 @@ static int stli_readproc(char *page, char **start, off_t off, int count, int *eo | |||
1996 | if (brdp->state == 0) | 1981 | if (brdp->state == 0) |
1997 | continue; | 1982 | continue; |
1998 | 1983 | ||
1999 | maxoff = curoff + (brdp->nrports * MAXLINE); | ||
2000 | if (off >= maxoff) { | ||
2001 | curoff = maxoff; | ||
2002 | continue; | ||
2003 | } | ||
2004 | |||
2005 | totalport = brdnr * STL_MAXPORTS; | 1984 | totalport = brdnr * STL_MAXPORTS; |
2006 | for (portnr = 0; (portnr < brdp->nrports); portnr++, | 1985 | for (portnr = 0; (portnr < brdp->nrports); portnr++, |
2007 | totalport++) { | 1986 | totalport++) { |
2008 | portp = brdp->ports[portnr]; | 1987 | portp = brdp->ports[portnr]; |
2009 | if (portp == NULL) | 1988 | if (portp == NULL) |
2010 | continue; | 1989 | continue; |
2011 | if (off >= (curoff += MAXLINE)) | 1990 | stli_portinfo(m, brdp, portp, totalport); |
2012 | continue; | ||
2013 | if ((pos - page + MAXLINE) > count) | ||
2014 | goto stli_readdone; | ||
2015 | pos += stli_portinfo(brdp, portp, totalport, pos); | ||
2016 | } | 1991 | } |
2017 | } | 1992 | } |
1993 | return 0; | ||
1994 | } | ||
2018 | 1995 | ||
2019 | *eof = 1; | 1996 | static int stli_proc_open(struct inode *inode, struct file *file) |
2020 | 1997 | { | |
2021 | stli_readdone: | 1998 | return single_open(file, stli_proc_show, NULL); |
2022 | *start = page; | ||
2023 | return(pos - page); | ||
2024 | } | 1999 | } |
2025 | 2000 | ||
2001 | static const struct file_operations stli_proc_fops = { | ||
2002 | .owner = THIS_MODULE, | ||
2003 | .open = stli_proc_open, | ||
2004 | .read = seq_read, | ||
2005 | .llseek = seq_lseek, | ||
2006 | .release = single_release, | ||
2007 | }; | ||
2008 | |||
2026 | /*****************************************************************************/ | 2009 | /*****************************************************************************/ |
2027 | 2010 | ||
2028 | /* | 2011 | /* |
@@ -4427,9 +4410,9 @@ static const struct tty_operations stli_ops = { | |||
4427 | .break_ctl = stli_breakctl, | 4410 | .break_ctl = stli_breakctl, |
4428 | .wait_until_sent = stli_waituntilsent, | 4411 | .wait_until_sent = stli_waituntilsent, |
4429 | .send_xchar = stli_sendxchar, | 4412 | .send_xchar = stli_sendxchar, |
4430 | .read_proc = stli_readproc, | ||
4431 | .tiocmget = stli_tiocmget, | 4413 | .tiocmget = stli_tiocmget, |
4432 | .tiocmset = stli_tiocmset, | 4414 | .tiocmset = stli_tiocmset, |
4415 | .proc_fops = &stli_proc_fops, | ||
4433 | }; | 4416 | }; |
4434 | 4417 | ||
4435 | static const struct tty_port_operations stli_port_ops = { | 4418 | static const struct tty_port_operations stli_port_ops = { |
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c index 5608a1e5a3b..19d79fc5446 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) |
diff --git a/drivers/char/stallion.c b/drivers/char/stallion.c index e1e0dd89ac9..2ad813a801d 100644 --- a/drivers/char/stallion.c +++ b/drivers/char/stallion.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/tty.h> | 32 | #include <linux/tty.h> |
33 | #include <linux/tty_flip.h> | 33 | #include <linux/tty_flip.h> |
34 | #include <linux/serial.h> | 34 | #include <linux/serial.h> |
35 | #include <linux/seq_file.h> | ||
35 | #include <linux/cd1400.h> | 36 | #include <linux/cd1400.h> |
36 | #include <linux/sc26198.h> | 37 | #include <linux/sc26198.h> |
37 | #include <linux/comstats.h> | 38 | #include <linux/comstats.h> |
@@ -1379,52 +1380,47 @@ static void stl_sendxchar(struct tty_struct *tty, char ch) | |||
1379 | stl_putchar(tty, ch); | 1380 | stl_putchar(tty, ch); |
1380 | } | 1381 | } |
1381 | 1382 | ||
1382 | /*****************************************************************************/ | 1383 | static void stl_portinfo(struct seq_file *m, struct stlport *portp, int portnr) |
1383 | |||
1384 | #define MAXLINE 80 | ||
1385 | |||
1386 | /* | ||
1387 | * Format info for a specified port. The line is deliberately limited | ||
1388 | * to 80 characters. (If it is too long it will be truncated, if too | ||
1389 | * short then padded with spaces). | ||
1390 | */ | ||
1391 | |||
1392 | static int stl_portinfo(struct stlport *portp, int portnr, char *pos) | ||
1393 | { | 1384 | { |
1394 | char *sp; | 1385 | int sigs; |
1395 | int sigs, cnt; | 1386 | char sep; |
1396 | 1387 | ||
1397 | sp = pos; | 1388 | seq_printf(m, "%d: uart:%s tx:%d rx:%d", |
1398 | sp += sprintf(sp, "%d: uart:%s tx:%d rx:%d", | ||
1399 | portnr, (portp->hwid == 1) ? "SC26198" : "CD1400", | 1389 | portnr, (portp->hwid == 1) ? "SC26198" : "CD1400", |
1400 | (int) portp->stats.txtotal, (int) portp->stats.rxtotal); | 1390 | (int) portp->stats.txtotal, (int) portp->stats.rxtotal); |
1401 | 1391 | ||
1402 | if (portp->stats.rxframing) | 1392 | if (portp->stats.rxframing) |
1403 | sp += sprintf(sp, " fe:%d", (int) portp->stats.rxframing); | 1393 | seq_printf(m, " fe:%d", (int) portp->stats.rxframing); |
1404 | if (portp->stats.rxparity) | 1394 | if (portp->stats.rxparity) |
1405 | sp += sprintf(sp, " pe:%d", (int) portp->stats.rxparity); | 1395 | seq_printf(m, " pe:%d", (int) portp->stats.rxparity); |
1406 | if (portp->stats.rxbreaks) | 1396 | if (portp->stats.rxbreaks) |
1407 | sp += sprintf(sp, " brk:%d", (int) portp->stats.rxbreaks); | 1397 | seq_printf(m, " brk:%d", (int) portp->stats.rxbreaks); |
1408 | if (portp->stats.rxoverrun) | 1398 | if (portp->stats.rxoverrun) |
1409 | sp += sprintf(sp, " oe:%d", (int) portp->stats.rxoverrun); | 1399 | seq_printf(m, " oe:%d", (int) portp->stats.rxoverrun); |
1410 | 1400 | ||
1411 | sigs = stl_getsignals(portp); | 1401 | sigs = stl_getsignals(portp); |
1412 | cnt = sprintf(sp, "%s%s%s%s%s ", | 1402 | sep = ' '; |
1413 | (sigs & TIOCM_RTS) ? "|RTS" : "", | 1403 | if (sigs & TIOCM_RTS) { |
1414 | (sigs & TIOCM_CTS) ? "|CTS" : "", | 1404 | seq_printf(m, "%c%s", sep, "RTS"); |
1415 | (sigs & TIOCM_DTR) ? "|DTR" : "", | 1405 | sep = '|'; |
1416 | (sigs & TIOCM_CD) ? "|DCD" : "", | 1406 | } |
1417 | (sigs & TIOCM_DSR) ? "|DSR" : ""); | 1407 | if (sigs & TIOCM_CTS) { |
1418 | *sp = ' '; | 1408 | seq_printf(m, "%c%s", sep, "CTS"); |
1419 | sp += cnt; | 1409 | sep = '|'; |
1420 | 1410 | } | |
1421 | for (cnt = sp - pos; cnt < (MAXLINE - 1); cnt++) | 1411 | if (sigs & TIOCM_DTR) { |
1422 | *sp++ = ' '; | 1412 | seq_printf(m, "%c%s", sep, "DTR"); |
1423 | if (cnt >= MAXLINE) | 1413 | sep = '|'; |
1424 | pos[(MAXLINE - 2)] = '+'; | 1414 | } |
1425 | pos[(MAXLINE - 1)] = '\n'; | 1415 | if (sigs & TIOCM_CD) { |
1426 | 1416 | seq_printf(m, "%c%s", sep, "DCD"); | |
1427 | return MAXLINE; | 1417 | sep = '|'; |
1418 | } | ||
1419 | if (sigs & TIOCM_DSR) { | ||
1420 | seq_printf(m, "%c%s", sep, "DSR"); | ||
1421 | sep = '|'; | ||
1422 | } | ||
1423 | seq_putc(m, '\n'); | ||
1428 | } | 1424 | } |
1429 | 1425 | ||
1430 | /*****************************************************************************/ | 1426 | /*****************************************************************************/ |
@@ -1433,30 +1429,17 @@ static int stl_portinfo(struct stlport *portp, int portnr, char *pos) | |||
1433 | * Port info, read from the /proc file system. | 1429 | * Port info, read from the /proc file system. |
1434 | */ | 1430 | */ |
1435 | 1431 | ||
1436 | static int stl_readproc(char *page, char **start, off_t off, int count, int *eof, void *data) | 1432 | static int stl_proc_show(struct seq_file *m, void *v) |
1437 | { | 1433 | { |
1438 | struct stlbrd *brdp; | 1434 | struct stlbrd *brdp; |
1439 | struct stlpanel *panelp; | 1435 | struct stlpanel *panelp; |
1440 | struct stlport *portp; | 1436 | struct stlport *portp; |
1441 | unsigned int brdnr, panelnr, portnr; | 1437 | unsigned int brdnr, panelnr, portnr; |
1442 | int totalport, curoff, maxoff; | 1438 | int totalport; |
1443 | char *pos; | ||
1444 | 1439 | ||
1445 | pr_debug("stl_readproc(page=%p,start=%p,off=%lx,count=%d,eof=%p," | ||
1446 | "data=%p\n", page, start, off, count, eof, data); | ||
1447 | |||
1448 | pos = page; | ||
1449 | totalport = 0; | 1440 | totalport = 0; |
1450 | curoff = 0; | 1441 | |
1451 | 1442 | seq_printf(m, "%s: version %s\n", stl_drvtitle, stl_drvversion); | |
1452 | if (off == 0) { | ||
1453 | pos += sprintf(pos, "%s: version %s", stl_drvtitle, | ||
1454 | stl_drvversion); | ||
1455 | while (pos < (page + MAXLINE - 1)) | ||
1456 | *pos++ = ' '; | ||
1457 | *pos++ = '\n'; | ||
1458 | } | ||
1459 | curoff = MAXLINE; | ||
1460 | 1443 | ||
1461 | /* | 1444 | /* |
1462 | * We scan through for each board, panel and port. The offset is | 1445 | * We scan through for each board, panel and port. The offset is |
@@ -1469,46 +1452,37 @@ static int stl_readproc(char *page, char **start, off_t off, int count, int *eof | |||
1469 | if (brdp->state == 0) | 1452 | if (brdp->state == 0) |
1470 | continue; | 1453 | continue; |
1471 | 1454 | ||
1472 | maxoff = curoff + (brdp->nrports * MAXLINE); | ||
1473 | if (off >= maxoff) { | ||
1474 | curoff = maxoff; | ||
1475 | continue; | ||
1476 | } | ||
1477 | |||
1478 | totalport = brdnr * STL_MAXPORTS; | 1455 | totalport = brdnr * STL_MAXPORTS; |
1479 | for (panelnr = 0; panelnr < brdp->nrpanels; panelnr++) { | 1456 | for (panelnr = 0; panelnr < brdp->nrpanels; panelnr++) { |
1480 | panelp = brdp->panels[panelnr]; | 1457 | panelp = brdp->panels[panelnr]; |
1481 | if (panelp == NULL) | 1458 | if (panelp == NULL) |
1482 | continue; | 1459 | continue; |
1483 | 1460 | ||
1484 | maxoff = curoff + (panelp->nrports * MAXLINE); | ||
1485 | if (off >= maxoff) { | ||
1486 | curoff = maxoff; | ||
1487 | totalport += panelp->nrports; | ||
1488 | continue; | ||
1489 | } | ||
1490 | |||
1491 | for (portnr = 0; portnr < panelp->nrports; portnr++, | 1461 | for (portnr = 0; portnr < panelp->nrports; portnr++, |
1492 | totalport++) { | 1462 | totalport++) { |
1493 | portp = panelp->ports[portnr]; | 1463 | portp = panelp->ports[portnr]; |
1494 | if (portp == NULL) | 1464 | if (portp == NULL) |
1495 | continue; | 1465 | continue; |
1496 | if (off >= (curoff += MAXLINE)) | 1466 | stl_portinfo(m, portp, totalport); |
1497 | continue; | ||
1498 | if ((pos - page + MAXLINE) > count) | ||
1499 | goto stl_readdone; | ||
1500 | pos += stl_portinfo(portp, totalport, pos); | ||
1501 | } | 1467 | } |
1502 | } | 1468 | } |
1503 | } | 1469 | } |
1470 | return 0; | ||
1471 | } | ||
1504 | 1472 | ||
1505 | *eof = 1; | 1473 | static int stl_proc_open(struct inode *inode, struct file *file) |
1506 | 1474 | { | |
1507 | stl_readdone: | 1475 | return single_open(file, stl_proc_show, NULL); |
1508 | *start = page; | ||
1509 | return pos - page; | ||
1510 | } | 1476 | } |
1511 | 1477 | ||
1478 | static const struct file_operations stl_proc_fops = { | ||
1479 | .owner = THIS_MODULE, | ||
1480 | .open = stl_proc_open, | ||
1481 | .read = seq_read, | ||
1482 | .llseek = seq_lseek, | ||
1483 | .release = single_release, | ||
1484 | }; | ||
1485 | |||
1512 | /*****************************************************************************/ | 1486 | /*****************************************************************************/ |
1513 | 1487 | ||
1514 | /* | 1488 | /* |
@@ -2566,9 +2540,9 @@ static const struct tty_operations stl_ops = { | |||
2566 | .break_ctl = stl_breakctl, | 2540 | .break_ctl = stl_breakctl, |
2567 | .wait_until_sent = stl_waituntilsent, | 2541 | .wait_until_sent = stl_waituntilsent, |
2568 | .send_xchar = stl_sendxchar, | 2542 | .send_xchar = stl_sendxchar, |
2569 | .read_proc = stl_readproc, | ||
2570 | .tiocmget = stl_tiocmget, | 2543 | .tiocmget = stl_tiocmget, |
2571 | .tiocmset = stl_tiocmset, | 2544 | .tiocmset = stl_tiocmset, |
2545 | .proc_fops = &stl_proc_fops, | ||
2572 | }; | 2546 | }; |
2573 | 2547 | ||
2574 | static const struct tty_port_operations stl_port_ops = { | 2548 | static const struct tty_port_operations stl_port_ops = { |
diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c index 0057a8f58cb..afd0b26ca05 100644 --- a/drivers/char/synclink.c +++ b/drivers/char/synclink.c | |||
@@ -79,6 +79,7 @@ | |||
79 | #include <linux/ptrace.h> | 79 | #include <linux/ptrace.h> |
80 | #include <linux/ioport.h> | 80 | #include <linux/ioport.h> |
81 | #include <linux/mm.h> | 81 | #include <linux/mm.h> |
82 | #include <linux/seq_file.h> | ||
82 | #include <linux/slab.h> | 83 | #include <linux/slab.h> |
83 | #include <linux/delay.h> | 84 | #include <linux/delay.h> |
84 | #include <linux/netdevice.h> | 85 | #include <linux/netdevice.h> |
@@ -3459,18 +3460,17 @@ cleanup: | |||
3459 | * /proc fs routines.... | 3460 | * /proc fs routines.... |
3460 | */ | 3461 | */ |
3461 | 3462 | ||
3462 | static inline int line_info(char *buf, struct mgsl_struct *info) | 3463 | static inline void line_info(struct seq_file *m, struct mgsl_struct *info) |
3463 | { | 3464 | { |
3464 | char stat_buf[30]; | 3465 | char stat_buf[30]; |
3465 | int ret; | ||
3466 | unsigned long flags; | 3466 | unsigned long flags; |
3467 | 3467 | ||
3468 | if (info->bus_type == MGSL_BUS_TYPE_PCI) { | 3468 | if (info->bus_type == MGSL_BUS_TYPE_PCI) { |
3469 | ret = sprintf(buf, "%s:PCI io:%04X irq:%d mem:%08X lcr:%08X", | 3469 | seq_printf(m, "%s:PCI io:%04X irq:%d mem:%08X lcr:%08X", |
3470 | info->device_name, info->io_base, info->irq_level, | 3470 | info->device_name, info->io_base, info->irq_level, |
3471 | info->phys_memory_base, info->phys_lcr_base); | 3471 | info->phys_memory_base, info->phys_lcr_base); |
3472 | } else { | 3472 | } else { |
3473 | ret = sprintf(buf, "%s:(E)ISA io:%04X irq:%d dma:%d", | 3473 | seq_printf(m, "%s:(E)ISA io:%04X irq:%d dma:%d", |
3474 | info->device_name, info->io_base, | 3474 | info->device_name, info->io_base, |
3475 | info->irq_level, info->dma_level); | 3475 | info->irq_level, info->dma_level); |
3476 | } | 3476 | } |
@@ -3497,37 +3497,37 @@ static inline int line_info(char *buf, struct mgsl_struct *info) | |||
3497 | 3497 | ||
3498 | if (info->params.mode == MGSL_MODE_HDLC || | 3498 | if (info->params.mode == MGSL_MODE_HDLC || |
3499 | info->params.mode == MGSL_MODE_RAW ) { | 3499 | info->params.mode == MGSL_MODE_RAW ) { |
3500 | ret += sprintf(buf+ret, " HDLC txok:%d rxok:%d", | 3500 | seq_printf(m, " HDLC txok:%d rxok:%d", |
3501 | info->icount.txok, info->icount.rxok); | 3501 | info->icount.txok, info->icount.rxok); |
3502 | if (info->icount.txunder) | 3502 | if (info->icount.txunder) |
3503 | ret += sprintf(buf+ret, " txunder:%d", info->icount.txunder); | 3503 | seq_printf(m, " txunder:%d", info->icount.txunder); |
3504 | if (info->icount.txabort) | 3504 | if (info->icount.txabort) |
3505 | ret += sprintf(buf+ret, " txabort:%d", info->icount.txabort); | 3505 | seq_printf(m, " txabort:%d", info->icount.txabort); |
3506 | if (info->icount.rxshort) | 3506 | if (info->icount.rxshort) |
3507 | ret += sprintf(buf+ret, " rxshort:%d", info->icount.rxshort); | 3507 | seq_printf(m, " rxshort:%d", info->icount.rxshort); |
3508 | if (info->icount.rxlong) | 3508 | if (info->icount.rxlong) |
3509 | ret += sprintf(buf+ret, " rxlong:%d", info->icount.rxlong); | 3509 | seq_printf(m, " rxlong:%d", info->icount.rxlong); |
3510 | if (info->icount.rxover) | 3510 | if (info->icount.rxover) |
3511 | ret += sprintf(buf+ret, " rxover:%d", info->icount.rxover); | 3511 | seq_printf(m, " rxover:%d", info->icount.rxover); |
3512 | if (info->icount.rxcrc) | 3512 | if (info->icount.rxcrc) |
3513 | ret += sprintf(buf+ret, " rxcrc:%d", info->icount.rxcrc); | 3513 | seq_printf(m, " rxcrc:%d", info->icount.rxcrc); |
3514 | } else { | 3514 | } else { |
3515 | ret += sprintf(buf+ret, " ASYNC tx:%d rx:%d", | 3515 | seq_printf(m, " ASYNC tx:%d rx:%d", |
3516 | info->icount.tx, info->icount.rx); | 3516 | info->icount.tx, info->icount.rx); |
3517 | if (info->icount.frame) | 3517 | if (info->icount.frame) |
3518 | ret += sprintf(buf+ret, " fe:%d", info->icount.frame); | 3518 | seq_printf(m, " fe:%d", info->icount.frame); |
3519 | if (info->icount.parity) | 3519 | if (info->icount.parity) |
3520 | ret += sprintf(buf+ret, " pe:%d", info->icount.parity); | 3520 | seq_printf(m, " pe:%d", info->icount.parity); |
3521 | if (info->icount.brk) | 3521 | if (info->icount.brk) |
3522 | ret += sprintf(buf+ret, " brk:%d", info->icount.brk); | 3522 | seq_printf(m, " brk:%d", info->icount.brk); |
3523 | if (info->icount.overrun) | 3523 | if (info->icount.overrun) |
3524 | ret += sprintf(buf+ret, " oe:%d", info->icount.overrun); | 3524 | seq_printf(m, " oe:%d", info->icount.overrun); |
3525 | } | 3525 | } |
3526 | 3526 | ||
3527 | /* Append serial signal status to end */ | 3527 | /* Append serial signal status to end */ |
3528 | ret += sprintf(buf+ret, " %s\n", stat_buf+1); | 3528 | seq_printf(m, " %s\n", stat_buf+1); |
3529 | 3529 | ||
3530 | ret += sprintf(buf+ret, "txactive=%d bh_req=%d bh_run=%d pending_bh=%x\n", | 3530 | seq_printf(m, "txactive=%d bh_req=%d bh_run=%d pending_bh=%x\n", |
3531 | info->tx_active,info->bh_requested,info->bh_running, | 3531 | info->tx_active,info->bh_requested,info->bh_running, |
3532 | info->pending_bh); | 3532 | info->pending_bh); |
3533 | 3533 | ||
@@ -3544,60 +3544,40 @@ static inline int line_info(char *buf, struct mgsl_struct *info) | |||
3544 | u16 Tmr = usc_InReg( info, TMR ); | 3544 | u16 Tmr = usc_InReg( info, TMR ); |
3545 | u16 Tccr = usc_InReg( info, TCCR ); | 3545 | u16 Tccr = usc_InReg( info, TCCR ); |
3546 | u16 Ccar = inw( info->io_base + CCAR ); | 3546 | u16 Ccar = inw( info->io_base + CCAR ); |
3547 | ret += sprintf(buf+ret, "tcsr=%04X tdmr=%04X ticr=%04X rcsr=%04X rdmr=%04X\n" | 3547 | seq_printf(m, "tcsr=%04X tdmr=%04X ticr=%04X rcsr=%04X rdmr=%04X\n" |
3548 | "ricr=%04X icr =%04X dccr=%04X tmr=%04X tccr=%04X ccar=%04X\n", | 3548 | "ricr=%04X icr =%04X dccr=%04X tmr=%04X tccr=%04X ccar=%04X\n", |
3549 | Tcsr,Tdmr,Ticr,Rscr,Rdmr,Ricr,Icr,Dccr,Tmr,Tccr,Ccar ); | 3549 | Tcsr,Tdmr,Ticr,Rscr,Rdmr,Ricr,Icr,Dccr,Tmr,Tccr,Ccar ); |
3550 | } | 3550 | } |
3551 | spin_unlock_irqrestore(&info->irq_spinlock,flags); | 3551 | spin_unlock_irqrestore(&info->irq_spinlock,flags); |
3552 | 3552 | } | |
3553 | return ret; | ||
3554 | |||
3555 | } /* end of line_info() */ | ||
3556 | 3553 | ||
3557 | /* mgsl_read_proc() | 3554 | /* Called to print information about devices */ |
3558 | * | 3555 | static int mgsl_proc_show(struct seq_file *m, void *v) |
3559 | * Called to print information about devices | ||
3560 | * | ||
3561 | * Arguments: | ||
3562 | * page page of memory to hold returned info | ||
3563 | * start | ||
3564 | * off | ||
3565 | * count | ||
3566 | * eof | ||
3567 | * data | ||
3568 | * | ||
3569 | * Return Value: | ||
3570 | */ | ||
3571 | static int mgsl_read_proc(char *page, char **start, off_t off, int count, | ||
3572 | int *eof, void *data) | ||
3573 | { | 3556 | { |
3574 | int len = 0, l; | ||
3575 | off_t begin = 0; | ||
3576 | struct mgsl_struct *info; | 3557 | struct mgsl_struct *info; |
3577 | 3558 | ||
3578 | len += sprintf(page, "synclink driver:%s\n", driver_version); | 3559 | seq_printf(m, "synclink driver:%s\n", driver_version); |
3579 | 3560 | ||
3580 | info = mgsl_device_list; | 3561 | info = mgsl_device_list; |
3581 | while( info ) { | 3562 | while( info ) { |
3582 | l = line_info(page + len, info); | 3563 | line_info(m, info); |
3583 | len += l; | ||
3584 | if (len+begin > off+count) | ||
3585 | goto done; | ||
3586 | if (len+begin < off) { | ||
3587 | begin += len; | ||
3588 | len = 0; | ||
3589 | } | ||
3590 | info = info->next_device; | 3564 | info = info->next_device; |
3591 | } | 3565 | } |
3566 | return 0; | ||
3567 | } | ||
3592 | 3568 | ||
3593 | *eof = 1; | 3569 | static int mgsl_proc_open(struct inode *inode, struct file *file) |
3594 | done: | 3570 | { |
3595 | if (off >= len+begin) | 3571 | return single_open(file, mgsl_proc_show, NULL); |
3596 | return 0; | 3572 | } |
3597 | *start = page + (off-begin); | 3573 | |
3598 | return ((count < begin+len-off) ? count : begin+len-off); | 3574 | static const struct file_operations mgsl_proc_fops = { |
3599 | 3575 | .owner = THIS_MODULE, | |
3600 | } /* end of mgsl_read_proc() */ | 3576 | .open = mgsl_proc_open, |
3577 | .read = seq_read, | ||
3578 | .llseek = seq_lseek, | ||
3579 | .release = single_release, | ||
3580 | }; | ||
3601 | 3581 | ||
3602 | /* mgsl_allocate_dma_buffers() | 3582 | /* mgsl_allocate_dma_buffers() |
3603 | * | 3583 | * |
@@ -4335,13 +4315,13 @@ static const struct tty_operations mgsl_ops = { | |||
4335 | .send_xchar = mgsl_send_xchar, | 4315 | .send_xchar = mgsl_send_xchar, |
4336 | .break_ctl = mgsl_break, | 4316 | .break_ctl = mgsl_break, |
4337 | .wait_until_sent = mgsl_wait_until_sent, | 4317 | .wait_until_sent = mgsl_wait_until_sent, |
4338 | .read_proc = mgsl_read_proc, | ||
4339 | .set_termios = mgsl_set_termios, | 4318 | .set_termios = mgsl_set_termios, |
4340 | .stop = mgsl_stop, | 4319 | .stop = mgsl_stop, |
4341 | .start = mgsl_start, | 4320 | .start = mgsl_start, |
4342 | .hangup = mgsl_hangup, | 4321 | .hangup = mgsl_hangup, |
4343 | .tiocmget = tiocmget, | 4322 | .tiocmget = tiocmget, |
4344 | .tiocmset = tiocmset, | 4323 | .tiocmset = tiocmset, |
4324 | .proc_fops = &mgsl_proc_fops, | ||
4345 | }; | 4325 | }; |
4346 | 4326 | ||
4347 | /* | 4327 | /* |
diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c index efb3dc928a4..6ec6e13d47d 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); | |||
154 | static void tx_release(struct tty_struct *tty); | 155 | static void tx_release(struct tty_struct *tty); |
155 | 156 | ||
156 | static int ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg); | 157 | static int ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg); |
157 | static int read_proc(char *page, char **start, off_t off, int count,int *eof, void *data); | ||
158 | static int chars_in_buffer(struct tty_struct *tty); | 158 | static int chars_in_buffer(struct tty_struct *tty); |
159 | static void throttle(struct tty_struct * tty); | 159 | static void throttle(struct tty_struct * tty); |
160 | static void unthrottle(struct tty_struct * tty); | 160 | static 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 | */ |
1232 | static inline int line_info(char *buf, struct slgt_info *info) | 1232 | static 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 | */ |
1302 | static int read_proc(char *page, char **start, off_t off, int count, | 1299 | static 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; | 1313 | static int synclink_gt_proc_open(struct inode *inode, struct file *file) |
1325 | done: | 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 | ||
1318 | static 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 | ||
3574 | static void slgt_cleanup(void) | 3568 | static void slgt_cleanup(void) |
diff --git a/drivers/char/synclinkmp.c b/drivers/char/synclinkmp.c index 8eb6c89a980..26de60efe4b 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); | |||
520 | static void tx_release(struct tty_struct *tty); | 521 | static void tx_release(struct tty_struct *tty); |
521 | 522 | ||
522 | static int ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg); | 523 | static int ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg); |
523 | static int read_proc(char *page, char **start, off_t off, int count,int *eof, void *data); | ||
524 | static int chars_in_buffer(struct tty_struct *tty); | 524 | static int chars_in_buffer(struct tty_struct *tty); |
525 | static void throttle(struct tty_struct * tty); | 525 | static void throttle(struct tty_struct * tty); |
526 | static void unthrottle(struct tty_struct * tty); | 526 | static 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 | ||
1357 | static inline int line_info(char *buf, SLMP_INFO *info) | 1357 | static 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 | */ |
1433 | static int read_proc(char *page, char **start, off_t off, int count, | 1430 | static 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; | 1444 | static int synclinkmp_proc_open(struct inode *inode, struct file *file) |
1456 | done: | 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 | ||
1449 | static 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 | */ |
1465 | static int chars_in_buffer(struct tty_struct *tty) | 1459 | static 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 | ||
diff --git a/drivers/char/sysrq.c b/drivers/char/sysrq.c index 33a9351c896..ebea9b2c30a 100644 --- a/drivers/char/sysrq.c +++ b/drivers/char/sysrq.c | |||
@@ -35,7 +35,7 @@ | |||
35 | #include <linux/vt_kern.h> | 35 | #include <linux/vt_kern.h> |
36 | #include <linux/workqueue.h> | 36 | #include <linux/workqueue.h> |
37 | #include <linux/kexec.h> | 37 | #include <linux/kexec.h> |
38 | #include <linux/irq.h> | 38 | #include <linux/interrupt.h> |
39 | #include <linux/hrtimer.h> | 39 | #include <linux/hrtimer.h> |
40 | #include <linux/oom.h> | 40 | #include <linux/oom.h> |
41 | 41 | ||
@@ -346,6 +346,19 @@ static struct sysrq_key_op sysrq_moom_op = { | |||
346 | .enable_mask = SYSRQ_ENABLE_SIGNAL, | 346 | .enable_mask = SYSRQ_ENABLE_SIGNAL, |
347 | }; | 347 | }; |
348 | 348 | ||
349 | #ifdef CONFIG_BLOCK | ||
350 | static void sysrq_handle_thaw(int key, struct tty_struct *tty) | ||
351 | { | ||
352 | emergency_thaw_all(); | ||
353 | } | ||
354 | static struct sysrq_key_op sysrq_thaw_op = { | ||
355 | .handler = sysrq_handle_thaw, | ||
356 | .help_msg = "thaw-filesystems(J)", | ||
357 | .action_msg = "Emergency Thaw of all frozen filesystems", | ||
358 | .enable_mask = SYSRQ_ENABLE_SIGNAL, | ||
359 | }; | ||
360 | #endif | ||
361 | |||
349 | static void sysrq_handle_kill(int key, struct tty_struct *tty) | 362 | static void sysrq_handle_kill(int key, struct tty_struct *tty) |
350 | { | 363 | { |
351 | send_sig_all(SIGKILL); | 364 | send_sig_all(SIGKILL); |
@@ -396,9 +409,13 @@ static struct sysrq_key_op *sysrq_key_table[36] = { | |||
396 | &sysrq_moom_op, /* f */ | 409 | &sysrq_moom_op, /* f */ |
397 | /* g: May be registered by ppc for kgdb */ | 410 | /* g: May be registered by ppc for kgdb */ |
398 | NULL, /* g */ | 411 | NULL, /* g */ |
399 | NULL, /* h */ | 412 | NULL, /* h - reserved for help */ |
400 | &sysrq_kill_op, /* i */ | 413 | &sysrq_kill_op, /* i */ |
414 | #ifdef CONFIG_BLOCK | ||
415 | &sysrq_thaw_op, /* j */ | ||
416 | #else | ||
401 | NULL, /* j */ | 417 | NULL, /* j */ |
418 | #endif | ||
402 | &sysrq_SAK_op, /* k */ | 419 | &sysrq_SAK_op, /* k */ |
403 | #ifdef CONFIG_SMP | 420 | #ifdef CONFIG_SMP |
404 | &sysrq_showallcpus_op, /* l */ | 421 | &sysrq_showallcpus_op, /* l */ |
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index 224f271d8cb..33dac94922a 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c | |||
@@ -464,7 +464,7 @@ void tty_wakeup(struct tty_struct *tty) | |||
464 | tty_ldisc_deref(ld); | 464 | tty_ldisc_deref(ld); |
465 | } | 465 | } |
466 | } | 466 | } |
467 | wake_up_interruptible(&tty->write_wait); | 467 | wake_up_interruptible_poll(&tty->write_wait, POLLOUT); |
468 | } | 468 | } |
469 | 469 | ||
470 | EXPORT_SYMBOL_GPL(tty_wakeup); | 470 | EXPORT_SYMBOL_GPL(tty_wakeup); |
@@ -587,8 +587,8 @@ static void do_tty_hangup(struct work_struct *work) | |||
587 | * FIXME: Once we trust the LDISC code better we can wait here for | 587 | * FIXME: Once we trust the LDISC code better we can wait here for |
588 | * ldisc completion and fix the driver call race | 588 | * ldisc completion and fix the driver call race |
589 | */ | 589 | */ |
590 | wake_up_interruptible(&tty->write_wait); | 590 | wake_up_interruptible_poll(&tty->write_wait, POLLOUT); |
591 | wake_up_interruptible(&tty->read_wait); | 591 | wake_up_interruptible_poll(&tty->read_wait, POLLIN); |
592 | /* | 592 | /* |
593 | * Shutdown the current line discipline, and reset it to | 593 | * Shutdown the current line discipline, and reset it to |
594 | * N_TTY. | 594 | * N_TTY. |
@@ -879,7 +879,7 @@ void stop_tty(struct tty_struct *tty) | |||
879 | if (tty->link && tty->link->packet) { | 879 | if (tty->link && tty->link->packet) { |
880 | tty->ctrl_status &= ~TIOCPKT_START; | 880 | tty->ctrl_status &= ~TIOCPKT_START; |
881 | tty->ctrl_status |= TIOCPKT_STOP; | 881 | tty->ctrl_status |= TIOCPKT_STOP; |
882 | wake_up_interruptible(&tty->link->read_wait); | 882 | wake_up_interruptible_poll(&tty->link->read_wait, POLLIN); |
883 | } | 883 | } |
884 | spin_unlock_irqrestore(&tty->ctrl_lock, flags); | 884 | spin_unlock_irqrestore(&tty->ctrl_lock, flags); |
885 | if (tty->ops->stop) | 885 | if (tty->ops->stop) |
@@ -913,7 +913,7 @@ void start_tty(struct tty_struct *tty) | |||
913 | if (tty->link && tty->link->packet) { | 913 | if (tty->link && tty->link->packet) { |
914 | tty->ctrl_status &= ~TIOCPKT_STOP; | 914 | tty->ctrl_status &= ~TIOCPKT_STOP; |
915 | tty->ctrl_status |= TIOCPKT_START; | 915 | tty->ctrl_status |= TIOCPKT_START; |
916 | wake_up_interruptible(&tty->link->read_wait); | 916 | wake_up_interruptible_poll(&tty->link->read_wait, POLLIN); |
917 | } | 917 | } |
918 | spin_unlock_irqrestore(&tty->ctrl_lock, flags); | 918 | spin_unlock_irqrestore(&tty->ctrl_lock, flags); |
919 | if (tty->ops->start) | 919 | if (tty->ops->start) |
@@ -970,7 +970,7 @@ static ssize_t tty_read(struct file *file, char __user *buf, size_t count, | |||
970 | void tty_write_unlock(struct tty_struct *tty) | 970 | void tty_write_unlock(struct tty_struct *tty) |
971 | { | 971 | { |
972 | mutex_unlock(&tty->atomic_write_lock); | 972 | mutex_unlock(&tty->atomic_write_lock); |
973 | wake_up_interruptible(&tty->write_wait); | 973 | wake_up_interruptible_poll(&tty->write_wait, POLLOUT); |
974 | } | 974 | } |
975 | 975 | ||
976 | int tty_write_lock(struct tty_struct *tty, int ndelay) | 976 | int tty_write_lock(struct tty_struct *tty, int ndelay) |
@@ -1623,21 +1623,21 @@ void tty_release_dev(struct file *filp) | |||
1623 | 1623 | ||
1624 | if (tty_closing) { | 1624 | if (tty_closing) { |
1625 | if (waitqueue_active(&tty->read_wait)) { | 1625 | if (waitqueue_active(&tty->read_wait)) { |
1626 | wake_up(&tty->read_wait); | 1626 | wake_up_poll(&tty->read_wait, POLLIN); |
1627 | do_sleep++; | 1627 | do_sleep++; |
1628 | } | 1628 | } |
1629 | if (waitqueue_active(&tty->write_wait)) { | 1629 | if (waitqueue_active(&tty->write_wait)) { |
1630 | wake_up(&tty->write_wait); | 1630 | wake_up_poll(&tty->write_wait, POLLOUT); |
1631 | do_sleep++; | 1631 | do_sleep++; |
1632 | } | 1632 | } |
1633 | } | 1633 | } |
1634 | if (o_tty_closing) { | 1634 | if (o_tty_closing) { |
1635 | if (waitqueue_active(&o_tty->read_wait)) { | 1635 | if (waitqueue_active(&o_tty->read_wait)) { |
1636 | wake_up(&o_tty->read_wait); | 1636 | wake_up_poll(&o_tty->read_wait, POLLIN); |
1637 | do_sleep++; | 1637 | do_sleep++; |
1638 | } | 1638 | } |
1639 | if (waitqueue_active(&o_tty->write_wait)) { | 1639 | if (waitqueue_active(&o_tty->write_wait)) { |
1640 | wake_up(&o_tty->write_wait); | 1640 | wake_up_poll(&o_tty->write_wait, POLLOUT); |
1641 | do_sleep++; | 1641 | do_sleep++; |
1642 | } | 1642 | } |
1643 | } | 1643 | } |