diff options
author | Jiri Slaby <jirislaby@gmail.com> | 2006-12-08 05:39:30 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-08 11:29:01 -0500 |
commit | 096dcfce39f952292b019a2c42c241782c9ca226 (patch) | |
tree | 08824ab1635c102d8d7c7190a0406c058a23419b /drivers/char/cyclades.c | |
parent | 02f1175c8737802b5609aa2c0b1fb3ca2c23069f (diff) |
[PATCH] Char: cyclades, cleanup
- remove cvs rcsid and alter code that uses it.
- allow a semicolon after use of macro to not confuse parsers (e.g. indent)
by do {} while (0)
- JIFFIES_DIFF is simple subtraction, subtract directly
- returns cleanup -- do not put values in parenthesis and do not return nothing
at the end of void functions
- comments are /* */ in C (not //)
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/char/cyclades.c')
-rw-r--r-- | drivers/char/cyclades.c | 133 |
1 files changed, 50 insertions, 83 deletions
diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c index 31bc8e41587e..7da6c3babb10 100644 --- a/drivers/char/cyclades.c +++ b/drivers/char/cyclades.c | |||
@@ -1,7 +1,6 @@ | |||
1 | #undef BLOCKMOVE | 1 | #undef BLOCKMOVE |
2 | #define Z_WAKE | 2 | #define Z_WAKE |
3 | #undef Z_EXT_CHARS_IN_BUFFER | 3 | #undef Z_EXT_CHARS_IN_BUFFER |
4 | static char rcsid[] = "$Revision: 2.3.2.20 $$Date: 2004/02/25 18:14:16 $"; | ||
5 | 4 | ||
6 | /* | 5 | /* |
7 | * linux/drivers/char/cyclades.c | 6 | * linux/drivers/char/cyclades.c |
@@ -592,6 +591,8 @@ static char rcsid[] = "$Revision: 2.3.2.20 $$Date: 2004/02/25 18:14:16 $"; | |||
592 | * | 591 | * |
593 | */ | 592 | */ |
594 | 593 | ||
594 | #define CY_VERSION "2.4" | ||
595 | |||
595 | /* If you need to install more boards than NR_CARDS, change the constant | 596 | /* If you need to install more boards than NR_CARDS, change the constant |
596 | in the definition below. No other change is necessary to support up to | 597 | in the definition below. No other change is necessary to support up to |
597 | eight boards. Beyond that you'll have to extend cy_isa_addresses. */ | 598 | eight boards. Beyond that you'll have to extend cy_isa_addresses. */ |
@@ -624,9 +625,9 @@ static char rcsid[] = "$Revision: 2.3.2.20 $$Date: 2004/02/25 18:14:16 $"; | |||
624 | #undef CY_PCI_DEBUG | 625 | #undef CY_PCI_DEBUG |
625 | 626 | ||
626 | #if 0 | 627 | #if 0 |
627 | #define PAUSE __asm__("nop"); | 628 | #define PAUSE __asm__("nop") |
628 | #else | 629 | #else |
629 | #define PAUSE ; | 630 | #define PAUSE do {} while (0) |
630 | #endif | 631 | #endif |
631 | 632 | ||
632 | /* | 633 | /* |
@@ -697,8 +698,6 @@ static void cy_send_xchar(struct tty_struct *tty, char ch); | |||
697 | 698 | ||
698 | #define STD_COM_FLAGS (0) | 699 | #define STD_COM_FLAGS (0) |
699 | 700 | ||
700 | #define JIFFIES_DIFF(n, j) ((j) - (n)) | ||
701 | |||
702 | static struct tty_driver *cy_serial_driver; | 701 | static struct tty_driver *cy_serial_driver; |
703 | 702 | ||
704 | #ifdef CONFIG_ISA | 703 | #ifdef CONFIG_ISA |
@@ -870,26 +869,22 @@ static inline int serial_paranoia_check(struct cyclades_port *info, | |||
870 | char *name, const char *routine) | 869 | char *name, const char *routine) |
871 | { | 870 | { |
872 | #ifdef SERIAL_PARANOIA_CHECK | 871 | #ifdef SERIAL_PARANOIA_CHECK |
873 | static const char *badmagic = | ||
874 | "cyc Warning: bad magic number for serial struct (%s) in %s\n"; | ||
875 | static const char *badinfo = | ||
876 | "cyc Warning: null cyclades_port for (%s) in %s\n"; | ||
877 | static const char *badrange = | ||
878 | "cyc Warning: cyclades_port out of range for (%s) in %s\n"; | ||
879 | |||
880 | if (!info) { | 872 | if (!info) { |
881 | printk(badinfo, name, routine); | 873 | printk("cyc Warning: null cyclades_port for (%s) in %s\n", |
874 | name, routine); | ||
882 | return 1; | 875 | return 1; |
883 | } | 876 | } |
884 | 877 | ||
885 | if ((long)info < (long)(&cy_port[0]) || | 878 | if ((long)info < (long)(&cy_port[0]) || |
886 | (long)(&cy_port[NR_PORTS]) < (long)info) { | 879 | (long)(&cy_port[NR_PORTS]) < (long)info) { |
887 | printk(badrange, name, routine); | 880 | printk("cyc Warning: cyclades_port out of range for (%s) in " |
881 | "%s\n", name, routine); | ||
888 | return 1; | 882 | return 1; |
889 | } | 883 | } |
890 | 884 | ||
891 | if (info->magic != CYCLADES_MAGIC) { | 885 | if (info->magic != CYCLADES_MAGIC) { |
892 | printk(badmagic, name, routine); | 886 | printk("cyc Warning: bad magic number for serial struct (%s) " |
887 | "in %s\n", name, routine); | ||
893 | return 1; | 888 | return 1; |
894 | } | 889 | } |
895 | #endif | 890 | #endif |
@@ -991,12 +986,12 @@ static int cyy_issue_cmd(void __iomem * base_addr, u_char cmd, int index) | |||
991 | /* if the CCR never cleared, the previous command | 986 | /* if the CCR never cleared, the previous command |
992 | didn't finish within the "reasonable time" */ | 987 | didn't finish within the "reasonable time" */ |
993 | if (i == 100) | 988 | if (i == 100) |
994 | return (-1); | 989 | return -1; |
995 | 990 | ||
996 | /* Issue the new command */ | 991 | /* Issue the new command */ |
997 | cy_writeb(base_addr + (CyCCR << index), cmd); | 992 | cy_writeb(base_addr + (CyCCR << index), cmd); |
998 | 993 | ||
999 | return (0); | 994 | return 0; |
1000 | } /* cyy_issue_cmd */ | 995 | } /* cyy_issue_cmd */ |
1001 | 996 | ||
1002 | #ifdef CONFIG_ISA | 997 | #ifdef CONFIG_ISA |
@@ -1511,7 +1506,7 @@ cyz_fetch_msg(struct cyclades_card *cinfo, | |||
1511 | 1506 | ||
1512 | firm_id = cinfo->base_addr + ID_ADDRESS; | 1507 | firm_id = cinfo->base_addr + ID_ADDRESS; |
1513 | if (!ISZLOADED(*cinfo)) { | 1508 | if (!ISZLOADED(*cinfo)) { |
1514 | return (-1); | 1509 | return -1; |
1515 | } | 1510 | } |
1516 | zfw_ctrl = cinfo->base_addr + (cy_readl(&firm_id->zfwctrl_addr) & | 1511 | zfw_ctrl = cinfo->base_addr + (cy_readl(&firm_id->zfwctrl_addr) & |
1517 | 0xfffff); | 1512 | 0xfffff); |
@@ -1542,7 +1537,7 @@ cyz_issue_cmd(struct cyclades_card *cinfo, | |||
1542 | 1537 | ||
1543 | firm_id = cinfo->base_addr + ID_ADDRESS; | 1538 | firm_id = cinfo->base_addr + ID_ADDRESS; |
1544 | if (!ISZLOADED(*cinfo)) { | 1539 | if (!ISZLOADED(*cinfo)) { |
1545 | return (-1); | 1540 | return -1; |
1546 | } | 1541 | } |
1547 | zfw_ctrl = cinfo->base_addr + (cy_readl(&firm_id->zfwctrl_addr) & | 1542 | zfw_ctrl = cinfo->base_addr + (cy_readl(&firm_id->zfwctrl_addr) & |
1548 | 0xfffff); | 1543 | 0xfffff); |
@@ -1553,7 +1548,7 @@ cyz_issue_cmd(struct cyclades_card *cinfo, | |||
1553 | &((struct RUNTIME_9060 __iomem *)(cinfo->ctl_addr))->pci_doorbell; | 1548 | &((struct RUNTIME_9060 __iomem *)(cinfo->ctl_addr))->pci_doorbell; |
1554 | while ((cy_readl(pci_doorbell) & 0xff) != 0) { | 1549 | while ((cy_readl(pci_doorbell) & 0xff) != 0) { |
1555 | if (index++ == 1000) { | 1550 | if (index++ == 1000) { |
1556 | return ((int)(cy_readl(pci_doorbell) & 0xff)); | 1551 | return (int)(cy_readl(pci_doorbell) & 0xff); |
1557 | } | 1552 | } |
1558 | udelay(50L); | 1553 | udelay(50L); |
1559 | } | 1554 | } |
@@ -1561,7 +1556,7 @@ cyz_issue_cmd(struct cyclades_card *cinfo, | |||
1561 | cy_writel(&board_ctrl->hcmd_param, param); | 1556 | cy_writel(&board_ctrl->hcmd_param, param); |
1562 | cy_writel(pci_doorbell, (long)cmd); | 1557 | cy_writel(pci_doorbell, (long)cmd); |
1563 | 1558 | ||
1564 | return (0); | 1559 | return 0; |
1565 | } /* cyz_issue_cmd */ | 1560 | } /* cyz_issue_cmd */ |
1566 | 1561 | ||
1567 | static void | 1562 | static void |
@@ -1959,8 +1954,6 @@ static void cyz_poll(unsigned long arg) | |||
1959 | cyz_timerlist.expires = jiffies + cyz_polling_cycle; | 1954 | cyz_timerlist.expires = jiffies + cyz_polling_cycle; |
1960 | } | 1955 | } |
1961 | add_timer(&cyz_timerlist); | 1956 | add_timer(&cyz_timerlist); |
1962 | |||
1963 | return; | ||
1964 | } /* cyz_poll */ | 1957 | } /* cyz_poll */ |
1965 | 1958 | ||
1966 | #endif /* CONFIG_CYZ_INTR */ | 1959 | #endif /* CONFIG_CYZ_INTR */ |
@@ -2318,7 +2311,6 @@ static void shutdown(struct cyclades_port *info) | |||
2318 | #ifdef CY_DEBUG_OPEN | 2311 | #ifdef CY_DEBUG_OPEN |
2319 | printk(" cyc shutdown done\n"); | 2312 | printk(" cyc shutdown done\n"); |
2320 | #endif | 2313 | #endif |
2321 | return; | ||
2322 | } /* shutdown */ | 2314 | } /* shutdown */ |
2323 | 2315 | ||
2324 | /* | 2316 | /* |
@@ -2349,8 +2341,7 @@ block_til_ready(struct tty_struct *tty, struct file *filp, | |||
2349 | if (info->flags & ASYNC_CLOSING) { | 2341 | if (info->flags & ASYNC_CLOSING) { |
2350 | interruptible_sleep_on(&info->close_wait); | 2342 | interruptible_sleep_on(&info->close_wait); |
2351 | } | 2343 | } |
2352 | return ((info-> | 2344 | return (info->flags & ASYNC_HUP_NOTIFY) ? -EAGAIN: -ERESTARTSYS; |
2353 | flags & ASYNC_HUP_NOTIFY) ? -EAGAIN : -ERESTARTSYS); | ||
2354 | } | 2345 | } |
2355 | 2346 | ||
2356 | /* | 2347 | /* |
@@ -2629,8 +2620,7 @@ static int cy_open(struct tty_struct *tty, struct file *filp) | |||
2629 | if (tty_hung_up_p(filp) || (info->flags & ASYNC_CLOSING)) { | 2620 | if (tty_hung_up_p(filp) || (info->flags & ASYNC_CLOSING)) { |
2630 | if (info->flags & ASYNC_CLOSING) | 2621 | if (info->flags & ASYNC_CLOSING) |
2631 | interruptible_sleep_on(&info->close_wait); | 2622 | interruptible_sleep_on(&info->close_wait); |
2632 | return ((info-> | 2623 | return (info->flags & ASYNC_HUP_NOTIFY) ? -EAGAIN: -ERESTARTSYS; |
2633 | flags & ASYNC_HUP_NOTIFY) ? -EAGAIN : -ERESTARTSYS); | ||
2634 | } | 2624 | } |
2635 | 2625 | ||
2636 | /* | 2626 | /* |
@@ -2727,7 +2717,7 @@ static void cy_wait_until_sent(struct tty_struct *tty, int timeout) | |||
2727 | break; | 2717 | break; |
2728 | } | 2718 | } |
2729 | } else { | 2719 | } else { |
2730 | // Nothing to do! | 2720 | /* Nothing to do! */ |
2731 | } | 2721 | } |
2732 | /* Run one more char cycle */ | 2722 | /* Run one more char cycle */ |
2733 | msleep_interruptible(jiffies_to_msecs(char_time * 5)); | 2723 | msleep_interruptible(jiffies_to_msecs(char_time * 5)); |
@@ -2869,7 +2859,6 @@ static void cy_close(struct tty_struct *tty, struct file *filp) | |||
2869 | #endif | 2859 | #endif |
2870 | 2860 | ||
2871 | CY_UNLOCK(info, flags); | 2861 | CY_UNLOCK(info, flags); |
2872 | return; | ||
2873 | } /* cy_close */ | 2862 | } /* cy_close */ |
2874 | 2863 | ||
2875 | /* This routine gets called when tty_write has put something into | 2864 | /* This routine gets called when tty_write has put something into |
@@ -3053,7 +3042,7 @@ static int cy_chars_in_buffer(struct tty_struct *tty) | |||
3053 | #ifdef CY_DEBUG_IO | 3042 | #ifdef CY_DEBUG_IO |
3054 | printk("cyc:cy_chars_in_buffer ttyC%d %d\n", info->line, info->xmit_cnt + char_count); /* */ | 3043 | printk("cyc:cy_chars_in_buffer ttyC%d %d\n", info->line, info->xmit_cnt + char_count); /* */ |
3055 | #endif | 3044 | #endif |
3056 | return (info->xmit_cnt + char_count); | 3045 | return info->xmit_cnt + char_count; |
3057 | } | 3046 | } |
3058 | #endif /* Z_EXT_CHARS_IN_BUFFER */ | 3047 | #endif /* Z_EXT_CHARS_IN_BUFFER */ |
3059 | } /* cy_chars_in_buffer */ | 3048 | } /* cy_chars_in_buffer */ |
@@ -3918,7 +3907,7 @@ static int set_threshold(struct cyclades_port *info, unsigned long value) | |||
3918 | cyy_issue_cmd(base_addr, CyCOR_CHANGE | CyCOR3ch, index); | 3907 | cyy_issue_cmd(base_addr, CyCOR_CHANGE | CyCOR3ch, index); |
3919 | CY_UNLOCK(info, flags); | 3908 | CY_UNLOCK(info, flags); |
3920 | } else { | 3909 | } else { |
3921 | // Nothing to do! | 3910 | /* Nothing to do! */ |
3922 | } | 3911 | } |
3923 | return 0; | 3912 | return 0; |
3924 | } /* set_threshold */ | 3913 | } /* set_threshold */ |
@@ -3942,7 +3931,7 @@ get_threshold(struct cyclades_port *info, unsigned long __user * value) | |||
3942 | tmp = cy_readb(base_addr + (CyCOR3 << index)) & CyREC_FIFO; | 3931 | tmp = cy_readb(base_addr + (CyCOR3 << index)) & CyREC_FIFO; |
3943 | return put_user(tmp, value); | 3932 | return put_user(tmp, value); |
3944 | } else { | 3933 | } else { |
3945 | // Nothing to do! | 3934 | /* Nothing to do! */ |
3946 | return 0; | 3935 | return 0; |
3947 | } | 3936 | } |
3948 | } /* get_threshold */ | 3937 | } /* get_threshold */ |
@@ -3979,7 +3968,7 @@ static int set_timeout(struct cyclades_port *info, unsigned long value) | |||
3979 | cy_writeb(base_addr + (CyRTPR << index), value & 0xff); | 3968 | cy_writeb(base_addr + (CyRTPR << index), value & 0xff); |
3980 | CY_UNLOCK(info, flags); | 3969 | CY_UNLOCK(info, flags); |
3981 | } else { | 3970 | } else { |
3982 | // Nothing to do! | 3971 | /* Nothing to do! */ |
3983 | } | 3972 | } |
3984 | return 0; | 3973 | return 0; |
3985 | } /* set_timeout */ | 3974 | } /* set_timeout */ |
@@ -4002,7 +3991,7 @@ static int get_timeout(struct cyclades_port *info, unsigned long __user * value) | |||
4002 | tmp = cy_readb(base_addr + (CyRTPR << index)); | 3991 | tmp = cy_readb(base_addr + (CyRTPR << index)); |
4003 | return put_user(tmp, value); | 3992 | return put_user(tmp, value); |
4004 | } else { | 3993 | } else { |
4005 | // Nothing to do! | 3994 | /* Nothing to do! */ |
4006 | return 0; | 3995 | return 0; |
4007 | } | 3996 | } |
4008 | } /* get_timeout */ | 3997 | } /* get_timeout */ |
@@ -4249,8 +4238,6 @@ static void cy_set_termios(struct tty_struct *tty, struct ktermios *old_termios) | |||
4249 | (tty->termios->c_cflag & CLOCAL)) | 4238 | (tty->termios->c_cflag & CLOCAL)) |
4250 | wake_up_interruptible(&info->open_wait); | 4239 | wake_up_interruptible(&info->open_wait); |
4251 | #endif | 4240 | #endif |
4252 | |||
4253 | return; | ||
4254 | } /* cy_set_termios */ | 4241 | } /* cy_set_termios */ |
4255 | 4242 | ||
4256 | /* This function is used to send a high-priority XON/XOFF character to | 4243 | /* This function is used to send a high-priority XON/XOFF character to |
@@ -4337,8 +4324,6 @@ static void cy_throttle(struct tty_struct *tty) | |||
4337 | info->throttle = 1; | 4324 | info->throttle = 1; |
4338 | } | 4325 | } |
4339 | } | 4326 | } |
4340 | |||
4341 | return; | ||
4342 | } /* cy_throttle */ | 4327 | } /* cy_throttle */ |
4343 | 4328 | ||
4344 | /* | 4329 | /* |
@@ -4396,8 +4381,6 @@ static void cy_unthrottle(struct tty_struct *tty) | |||
4396 | info->throttle = 0; | 4381 | info->throttle = 0; |
4397 | } | 4382 | } |
4398 | } | 4383 | } |
4399 | |||
4400 | return; | ||
4401 | } /* cy_unthrottle */ | 4384 | } /* cy_unthrottle */ |
4402 | 4385 | ||
4403 | /* cy_start and cy_stop provide software output flow control as a | 4386 | /* cy_start and cy_stop provide software output flow control as a |
@@ -4434,10 +4417,8 @@ static void cy_stop(struct tty_struct *tty) | |||
4434 | cy_readb(base_addr + (CySRER << index)) & ~CyTxRdy); | 4417 | cy_readb(base_addr + (CySRER << index)) & ~CyTxRdy); |
4435 | CY_UNLOCK(info, flags); | 4418 | CY_UNLOCK(info, flags); |
4436 | } else { | 4419 | } else { |
4437 | // Nothing to do! | 4420 | /* Nothing to do! */ |
4438 | } | 4421 | } |
4439 | |||
4440 | return; | ||
4441 | } /* cy_stop */ | 4422 | } /* cy_stop */ |
4442 | 4423 | ||
4443 | static void cy_start(struct tty_struct *tty) | 4424 | static void cy_start(struct tty_struct *tty) |
@@ -4470,10 +4451,8 @@ static void cy_start(struct tty_struct *tty) | |||
4470 | cy_readb(base_addr + (CySRER << index)) | CyTxRdy); | 4451 | cy_readb(base_addr + (CySRER << index)) | CyTxRdy); |
4471 | CY_UNLOCK(info, flags); | 4452 | CY_UNLOCK(info, flags); |
4472 | } else { | 4453 | } else { |
4473 | // Nothing to do! | 4454 | /* Nothing to do! */ |
4474 | } | 4455 | } |
4475 | |||
4476 | return; | ||
4477 | } /* cy_start */ | 4456 | } /* cy_start */ |
4478 | 4457 | ||
4479 | static void cy_flush_buffer(struct tty_struct *tty) | 4458 | static void cy_flush_buffer(struct tty_struct *tty) |
@@ -4661,7 +4640,7 @@ static int __init cy_detect_isa(void) | |||
4661 | for (i = 0; i < NR_ISA_ADDRS; i++) { | 4640 | for (i = 0; i < NR_ISA_ADDRS; i++) { |
4662 | unsigned int isa_address = cy_isa_addresses[i]; | 4641 | unsigned int isa_address = cy_isa_addresses[i]; |
4663 | if (isa_address == 0x0000) { | 4642 | if (isa_address == 0x0000) { |
4664 | return (nboard); | 4643 | return nboard; |
4665 | } | 4644 | } |
4666 | 4645 | ||
4667 | /* probe for CD1400... */ | 4646 | /* probe for CD1400... */ |
@@ -4691,7 +4670,7 @@ static int __init cy_detect_isa(void) | |||
4691 | printk("but no more channels are available.\n"); | 4670 | printk("but no more channels are available.\n"); |
4692 | printk("Change NR_PORTS in cyclades.c and recompile " | 4671 | printk("Change NR_PORTS in cyclades.c and recompile " |
4693 | "kernel.\n"); | 4672 | "kernel.\n"); |
4694 | return (nboard); | 4673 | return nboard; |
4695 | } | 4674 | } |
4696 | /* fill the next cy_card structure available */ | 4675 | /* fill the next cy_card structure available */ |
4697 | for (j = 0; j < NR_CARDS; j++) { | 4676 | for (j = 0; j < NR_CARDS; j++) { |
@@ -4704,7 +4683,7 @@ static int __init cy_detect_isa(void) | |||
4704 | printk("but no more cards can be used .\n"); | 4683 | printk("but no more cards can be used .\n"); |
4705 | printk("Change NR_CARDS in cyclades.c and recompile " | 4684 | printk("Change NR_CARDS in cyclades.c and recompile " |
4706 | "kernel.\n"); | 4685 | "kernel.\n"); |
4707 | return (nboard); | 4686 | return nboard; |
4708 | } | 4687 | } |
4709 | 4688 | ||
4710 | /* allocate IRQ */ | 4689 | /* allocate IRQ */ |
@@ -4713,7 +4692,7 @@ static int __init cy_detect_isa(void) | |||
4713 | printk("Cyclom-Y/ISA found at 0x%lx ", | 4692 | printk("Cyclom-Y/ISA found at 0x%lx ", |
4714 | (unsigned long)cy_isa_address); | 4693 | (unsigned long)cy_isa_address); |
4715 | printk("but could not allocate IRQ#%d.\n", cy_isa_irq); | 4694 | printk("but could not allocate IRQ#%d.\n", cy_isa_irq); |
4716 | return (nboard); | 4695 | return nboard; |
4717 | } | 4696 | } |
4718 | 4697 | ||
4719 | /* set cy_card */ | 4698 | /* set cy_card */ |
@@ -4734,9 +4713,9 @@ static int __init cy_detect_isa(void) | |||
4734 | cy_isa_nchan, cy_next_channel); | 4713 | cy_isa_nchan, cy_next_channel); |
4735 | cy_next_channel += cy_isa_nchan; | 4714 | cy_next_channel += cy_isa_nchan; |
4736 | } | 4715 | } |
4737 | return (nboard); | 4716 | return nboard; |
4738 | #else | 4717 | #else |
4739 | return (0); | 4718 | return 0; |
4740 | #endif /* CONFIG_ISA */ | 4719 | #endif /* CONFIG_ISA */ |
4741 | } /* cy_detect_isa */ | 4720 | } /* cy_detect_isa */ |
4742 | 4721 | ||
@@ -4867,7 +4846,7 @@ static int __init cy_detect_pci(void) | |||
4867 | printk("but no channels are available.\n"); | 4846 | printk("but no channels are available.\n"); |
4868 | printk("Change NR_PORTS in cyclades.c and " | 4847 | printk("Change NR_PORTS in cyclades.c and " |
4869 | "recompile kernel.\n"); | 4848 | "recompile kernel.\n"); |
4870 | return (i); | 4849 | return i; |
4871 | } | 4850 | } |
4872 | /* fill the next cy_card structure available */ | 4851 | /* fill the next cy_card structure available */ |
4873 | for (j = 0; j < NR_CARDS; j++) { | 4852 | for (j = 0; j < NR_CARDS; j++) { |
@@ -4880,7 +4859,7 @@ static int __init cy_detect_pci(void) | |||
4880 | printk("but no more cards can be used.\n"); | 4859 | printk("but no more cards can be used.\n"); |
4881 | printk("Change NR_CARDS in cyclades.c and " | 4860 | printk("Change NR_CARDS in cyclades.c and " |
4882 | "recompile kernel.\n"); | 4861 | "recompile kernel.\n"); |
4883 | return (i); | 4862 | return i; |
4884 | } | 4863 | } |
4885 | 4864 | ||
4886 | /* allocate IRQ */ | 4865 | /* allocate IRQ */ |
@@ -4890,7 +4869,7 @@ static int __init cy_detect_pci(void) | |||
4890 | (ulong) cy_pci_phys2); | 4869 | (ulong) cy_pci_phys2); |
4891 | printk("but could not allocate IRQ%d.\n", | 4870 | printk("but could not allocate IRQ%d.\n", |
4892 | cy_pci_irq); | 4871 | cy_pci_irq); |
4893 | return (i); | 4872 | return i; |
4894 | } | 4873 | } |
4895 | 4874 | ||
4896 | /* set cy_card */ | 4875 | /* set cy_card */ |
@@ -5029,7 +5008,7 @@ static int __init cy_detect_pci(void) | |||
5029 | cy_writel(&((struct RUNTIME_9060 *) | 5008 | cy_writel(&((struct RUNTIME_9060 *) |
5030 | (cy_pci_addr0))->loc_addr_base, | 5009 | (cy_pci_addr0))->loc_addr_base, |
5031 | WIN_CREG); | 5010 | WIN_CREG); |
5032 | PAUSE | 5011 | PAUSE; |
5033 | printk("Cyclades-8Zo/PCI: FPGA id %lx, ver " | 5012 | printk("Cyclades-8Zo/PCI: FPGA id %lx, ver " |
5034 | "%lx\n", (ulong) (0xff & | 5013 | "%lx\n", (ulong) (0xff & |
5035 | cy_readl(&((struct CUSTOM_REG *) | 5014 | cy_readl(&((struct CUSTOM_REG *) |
@@ -5050,7 +5029,7 @@ static int __init cy_detect_pci(void) | |||
5050 | ensures that the driver will not attempt to talk to | 5029 | ensures that the driver will not attempt to talk to |
5051 | the board until it has been properly initialized. | 5030 | the board until it has been properly initialized. |
5052 | */ | 5031 | */ |
5053 | PAUSE | 5032 | PAUSE; |
5054 | if ((mailbox == ZO_V1) || (mailbox == ZO_V2)) | 5033 | if ((mailbox == ZO_V1) || (mailbox == ZO_V2)) |
5055 | cy_writel(cy_pci_addr2 + ID_ADDRESS, 0L); | 5034 | cy_writel(cy_pci_addr2 + ID_ADDRESS, 0L); |
5056 | 5035 | ||
@@ -5064,7 +5043,7 @@ static int __init cy_detect_pci(void) | |||
5064 | "no channels are available.\nChange " | 5043 | "no channels are available.\nChange " |
5065 | "NR_PORTS in cyclades.c and recompile " | 5044 | "NR_PORTS in cyclades.c and recompile " |
5066 | "kernel.\n", (ulong)cy_pci_phys2); | 5045 | "kernel.\n", (ulong)cy_pci_phys2); |
5067 | return (i); | 5046 | return i; |
5068 | } | 5047 | } |
5069 | 5048 | ||
5070 | /* fill the next cy_card structure available */ | 5049 | /* fill the next cy_card structure available */ |
@@ -5077,7 +5056,7 @@ static int __init cy_detect_pci(void) | |||
5077 | "no more cards can be used.\nChange " | 5056 | "no more cards can be used.\nChange " |
5078 | "NR_CARDS in cyclades.c and recompile " | 5057 | "NR_CARDS in cyclades.c and recompile " |
5079 | "kernel.\n", (ulong)cy_pci_phys2); | 5058 | "kernel.\n", (ulong)cy_pci_phys2); |
5080 | return (i); | 5059 | return i; |
5081 | } | 5060 | } |
5082 | #ifdef CONFIG_CYZ_INTR | 5061 | #ifdef CONFIG_CYZ_INTR |
5083 | /* allocate IRQ only if board has an IRQ */ | 5062 | /* allocate IRQ only if board has an IRQ */ |
@@ -5089,7 +5068,7 @@ static int __init cy_detect_pci(void) | |||
5089 | "but could not allocate " | 5068 | "but could not allocate " |
5090 | "IRQ%d.\n", (ulong)cy_pci_phys2, | 5069 | "IRQ%d.\n", (ulong)cy_pci_phys2, |
5091 | cy_pci_irq); | 5070 | cy_pci_irq); |
5092 | return (i); | 5071 | return i; |
5093 | } | 5072 | } |
5094 | } | 5073 | } |
5095 | #endif /* CONFIG_CYZ_INTR */ | 5074 | #endif /* CONFIG_CYZ_INTR */ |
@@ -5149,7 +5128,7 @@ static int __init cy_detect_pci(void) | |||
5149 | printk("Cyclades-Z/PCI: New Cyclades-Z board. FPGA not " | 5128 | printk("Cyclades-Z/PCI: New Cyclades-Z board. FPGA not " |
5150 | "loaded\n"); | 5129 | "loaded\n"); |
5151 | #endif | 5130 | #endif |
5152 | PAUSE | 5131 | PAUSE; |
5153 | /* This must be the new Cyclades-Ze/PCI. */ | 5132 | /* This must be the new Cyclades-Ze/PCI. */ |
5154 | cy_pci_nchan = ZE_V1_NPORTS; | 5133 | cy_pci_nchan = ZE_V1_NPORTS; |
5155 | 5134 | ||
@@ -5158,7 +5137,7 @@ static int __init cy_detect_pci(void) | |||
5158 | "are available.\nChange NR_PORTS in cyclades.c " | 5137 | "are available.\nChange NR_PORTS in cyclades.c " |
5159 | "and recompile kernel.\n", | 5138 | "and recompile kernel.\n", |
5160 | (ulong) cy_pci_phys2); | 5139 | (ulong) cy_pci_phys2); |
5161 | return (i); | 5140 | return i; |
5162 | } | 5141 | } |
5163 | 5142 | ||
5164 | /* fill the next cy_card structure available */ | 5143 | /* fill the next cy_card structure available */ |
@@ -5171,7 +5150,7 @@ static int __init cy_detect_pci(void) | |||
5171 | "cards can be used.\nChange NR_CARDS in " | 5150 | "cards can be used.\nChange NR_CARDS in " |
5172 | "cyclades.c and recompile kernel.\n", | 5151 | "cyclades.c and recompile kernel.\n", |
5173 | (ulong) cy_pci_phys2); | 5152 | (ulong) cy_pci_phys2); |
5174 | return (i); | 5153 | return i; |
5175 | } | 5154 | } |
5176 | #ifdef CONFIG_CYZ_INTR | 5155 | #ifdef CONFIG_CYZ_INTR |
5177 | /* allocate IRQ only if board has an IRQ */ | 5156 | /* allocate IRQ only if board has an IRQ */ |
@@ -5183,7 +5162,7 @@ static int __init cy_detect_pci(void) | |||
5183 | (ulong) cy_pci_phys2); | 5162 | (ulong) cy_pci_phys2); |
5184 | printk("but could not allocate IRQ%d.\n", | 5163 | printk("but could not allocate IRQ%d.\n", |
5185 | cy_pci_irq); | 5164 | cy_pci_irq); |
5186 | return (i); | 5165 | return i; |
5187 | } | 5166 | } |
5188 | } | 5167 | } |
5189 | #endif /* CONFIG_CYZ_INTR */ | 5168 | #endif /* CONFIG_CYZ_INTR */ |
@@ -5222,9 +5201,9 @@ static int __init cy_detect_pci(void) | |||
5222 | "used.\nChange NR_CARDS in cyclades.c and recompile " | 5201 | "used.\nChange NR_CARDS in cyclades.c and recompile " |
5223 | "kernel.\n", (unsigned int)Ze_phys2[0]); | 5202 | "kernel.\n", (unsigned int)Ze_phys2[0]); |
5224 | } | 5203 | } |
5225 | return (i); | 5204 | return i; |
5226 | #else | 5205 | #else |
5227 | return (0); | 5206 | return 0; |
5228 | #endif /* ifdef CONFIG_PCI */ | 5207 | #endif /* ifdef CONFIG_PCI */ |
5229 | } /* cy_detect_pci */ | 5208 | } /* cy_detect_pci */ |
5230 | 5209 | ||
@@ -5234,16 +5213,7 @@ static int __init cy_detect_pci(void) | |||
5234 | */ | 5213 | */ |
5235 | static inline void show_version(void) | 5214 | static inline void show_version(void) |
5236 | { | 5215 | { |
5237 | char *rcsvers, *rcsdate, *tmp; | 5216 | printk("Cyclades driver " CY_VERSION "\n"); |
5238 | rcsvers = strchr(rcsid, ' '); | ||
5239 | rcsvers++; | ||
5240 | tmp = strchr(rcsvers, ' '); | ||
5241 | *tmp++ = '\0'; | ||
5242 | rcsdate = strchr(tmp, ' '); | ||
5243 | rcsdate++; | ||
5244 | tmp = strrchr(rcsdate, ' '); | ||
5245 | *tmp = '\0'; | ||
5246 | printk("Cyclades driver %s %s\n", rcsvers, rcsdate); | ||
5247 | printk(" built %s %s\n", __DATE__, __TIME__); | 5217 | printk(" built %s %s\n", __DATE__, __TIME__); |
5248 | } /* show_version */ | 5218 | } /* show_version */ |
5249 | 5219 | ||
@@ -5272,14 +5242,11 @@ cyclades_get_proc_info(char *buf, char **start, off_t offset, int length, | |||
5272 | if (info->count) | 5242 | if (info->count) |
5273 | size = sprintf(buf + len, "%3d %8lu %10lu %8lu %10lu " | 5243 | size = sprintf(buf + len, "%3d %8lu %10lu %8lu %10lu " |
5274 | "%8lu %9lu %6ld\n", info->line, | 5244 | "%8lu %9lu %6ld\n", info->line, |
5275 | JIFFIES_DIFF(info->idle_stats.in_use, | 5245 | (cur_jifs - info->idle_stats.in_use) / HZ, |
5276 | cur_jifs) / HZ, | ||
5277 | info->idle_stats.xmit_bytes, | 5246 | info->idle_stats.xmit_bytes, |
5278 | JIFFIES_DIFF(info->idle_stats.xmit_idle, | 5247 | (cur_jifs - info->idle_stats.xmit_idle) / HZ, |
5279 | cur_jifs) / HZ, | ||
5280 | info->idle_stats.recv_bytes, | 5248 | info->idle_stats.recv_bytes, |
5281 | JIFFIES_DIFF(info->idle_stats.recv_idle, | 5249 | (cur_jifs - info->idle_stats.recv_idle) / HZ, |
5282 | cur_jifs) / HZ, | ||
5283 | info->idle_stats.overruns, | 5250 | info->idle_stats.overruns, |
5284 | (long)info->tty->ldisc.num); | 5251 | (long)info->tty->ldisc.num); |
5285 | else | 5252 | else |