aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/cyclades.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/cyclades.c')
-rw-r--r--drivers/char/cyclades.c56
1 files changed, 22 insertions, 34 deletions
diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
index 6a59f72a9c21..1fdb9f657d8f 100644
--- a/drivers/char/cyclades.c
+++ b/drivers/char/cyclades.c
@@ -646,6 +646,7 @@
646#include <linux/spinlock.h> 646#include <linux/spinlock.h>
647#include <linux/bitops.h> 647#include <linux/bitops.h>
648#include <linux/firmware.h> 648#include <linux/firmware.h>
649#include <linux/device.h>
649 650
650#include <asm/system.h> 651#include <asm/system.h>
651#include <linux/io.h> 652#include <linux/io.h>
@@ -657,6 +658,7 @@
657 658
658#include <linux/stat.h> 659#include <linux/stat.h>
659#include <linux/proc_fs.h> 660#include <linux/proc_fs.h>
661#include <linux/seq_file.h>
660 662
661static void cy_throttle(struct tty_struct *tty); 663static void cy_throttle(struct tty_struct *tty);
662static void cy_send_xchar(struct tty_struct *tty, char ch); 664static void cy_send_xchar(struct tty_struct *tty, char ch);
@@ -868,8 +870,6 @@ static int cyz_issue_cmd(struct cyclades_card *, __u32, __u8, __u32);
868static unsigned detect_isa_irq(void __iomem *); 870static unsigned detect_isa_irq(void __iomem *);
869#endif /* CONFIG_ISA */ 871#endif /* CONFIG_ISA */
870 872
871static int cyclades_get_proc_info(char *, char **, off_t, int, int *, void *);
872
873#ifndef CONFIG_CYZ_INTR 873#ifndef CONFIG_CYZ_INTR
874static void cyz_poll(unsigned long); 874static void cyz_poll(unsigned long);
875 875
@@ -5216,31 +5216,22 @@ static struct pci_driver cy_pci_driver = {
5216}; 5216};
5217#endif 5217#endif
5218 5218
5219static int 5219static int cyclades_proc_show(struct seq_file *m, void *v)
5220cyclades_get_proc_info(char *buf, char **start, off_t offset, int length,
5221 int *eof, void *data)
5222{ 5220{
5223 struct cyclades_port *info; 5221 struct cyclades_port *info;
5224 unsigned int i, j; 5222 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; 5223 __u32 cur_jifs = jiffies;
5230 5224
5231 size = sprintf(buf, "Dev TimeOpen BytesOut IdleOut BytesIn " 5225 seq_puts(m, "Dev TimeOpen BytesOut IdleOut BytesIn "
5232 "IdleIn Overruns Ldisc\n"); 5226 "IdleIn Overruns Ldisc\n");
5233 5227
5234 pos += size;
5235 len += size;
5236
5237 /* Output one line for each known port */ 5228 /* Output one line for each known port */
5238 for (i = 0; i < NR_CARDS; i++) 5229 for (i = 0; i < NR_CARDS; i++)
5239 for (j = 0; j < cy_card[i].nports; j++) { 5230 for (j = 0; j < cy_card[i].nports; j++) {
5240 info = &cy_card[i].ports[j]; 5231 info = &cy_card[i].ports[j];
5241 5232
5242 if (info->port.count) 5233 if (info->port.count)
5243 size = sprintf(buf + len, "%3d %8lu %10lu %8lu " 5234 seq_printf(m, "%3d %8lu %10lu %8lu "
5244 "%10lu %8lu %9lu %6ld\n", info->line, 5235 "%10lu %8lu %9lu %6ld\n", info->line,
5245 (cur_jifs - info->idle_stats.in_use) / 5236 (cur_jifs - info->idle_stats.in_use) /
5246 HZ, info->idle_stats.xmit_bytes, 5237 HZ, info->idle_stats.xmit_bytes,
@@ -5251,30 +5242,26 @@ cyclades_get_proc_info(char *buf, char **start, off_t offset, int length,
5251 /* FIXME: double check locking */ 5242 /* FIXME: double check locking */
5252 (long)info->port.tty->ldisc.ops->num); 5243 (long)info->port.tty->ldisc.ops->num);
5253 else 5244 else
5254 size = sprintf(buf + len, "%3d %8lu %10lu %8lu " 5245 seq_printf(m, "%3d %8lu %10lu %8lu "
5255 "%10lu %8lu %9lu %6ld\n", 5246 "%10lu %8lu %9lu %6ld\n",
5256 info->line, 0L, 0L, 0L, 0L, 0L, 0L, 0L); 5247 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 } 5248 }
5267 *eof = 1; 5249 return 0;
5268done: 5250}
5269 *start = buf + (offset - begin); /* Start of wanted data */ 5251
5270 len -= (offset - begin); /* Start slop */ 5252static int cyclades_proc_open(struct inode *inode, struct file *file)
5271 if (len > length) 5253{
5272 len = length; /* Ending slop */ 5254 return single_open(file, cyclades_proc_show, NULL);
5273 if (len < 0)
5274 len = 0;
5275 return len;
5276} 5255}
5277 5256
5257static const struct file_operations cyclades_proc_fops = {
5258 .owner = THIS_MODULE,
5259 .open = cyclades_proc_open,
5260 .read = seq_read,
5261 .llseek = seq_lseek,
5262 .release = single_release,
5263};
5264
5278/* The serial driver boot-time initialization code! 5265/* The serial driver boot-time initialization code!
5279 Hardware I/O ports are mapped to character special devices on a 5266 Hardware I/O ports are mapped to character special devices on a
5280 first found, first allocated manner. That is, this code searches 5267 first found, first allocated manner. That is, this code searches
@@ -5311,9 +5298,9 @@ static const struct tty_operations cy_ops = {
5311 .hangup = cy_hangup, 5298 .hangup = cy_hangup,
5312 .break_ctl = cy_break, 5299 .break_ctl = cy_break,
5313 .wait_until_sent = cy_wait_until_sent, 5300 .wait_until_sent = cy_wait_until_sent,
5314 .read_proc = cyclades_get_proc_info,
5315 .tiocmget = cy_tiocmget, 5301 .tiocmget = cy_tiocmget,
5316 .tiocmset = cy_tiocmset, 5302 .tiocmset = cy_tiocmset,
5303 .proc_fops = &cyclades_proc_fops,
5317}; 5304};
5318 5305
5319static int __init cy_init(void) 5306static int __init cy_init(void)
@@ -5422,3 +5409,4 @@ module_exit(cy_cleanup_module);
5422 5409
5423MODULE_LICENSE("GPL"); 5410MODULE_LICENSE("GPL");
5424MODULE_VERSION(CY_VERSION); 5411MODULE_VERSION(CY_VERSION);
5412MODULE_ALIAS_CHARDEV_MAJOR(CYCLADES_MAJOR);