diff options
author | Jiri Slaby <jirislaby@gmail.com> | 2006-12-08 05:39:14 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-08 11:28:59 -0500 |
commit | c62429d93e003043109a0af86cb6bf1da45a1b71 (patch) | |
tree | 75745b348a34c51d3055075deb7cc4497c5e5797 /drivers/char/stallion.c | |
parent | 79cfe7ab54dbf2784159f5be6b665153cafcee3c (diff) |
[PATCH] Char: stallion, remove syntactic sugar
Remove useless parenthesis and brackets.
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/stallion.c')
-rw-r--r-- | drivers/char/stallion.c | 178 |
1 files changed, 81 insertions, 97 deletions
diff --git a/drivers/char/stallion.c b/drivers/char/stallion.c index 87bda40be61a..2db2e9fbb5c6 100644 --- a/drivers/char/stallion.c +++ b/drivers/char/stallion.c | |||
@@ -639,13 +639,13 @@ static int __init stl_parsebrd(struct stlconf *confp, char **argp) | |||
639 | if ((argp[0] == NULL) || (*argp[0] == 0)) | 639 | if ((argp[0] == NULL) || (*argp[0] == 0)) |
640 | return 0; | 640 | return 0; |
641 | 641 | ||
642 | for (sp = argp[0], i = 0; ((*sp != 0) && (i < 25)); sp++, i++) | 642 | for (sp = argp[0], i = 0; (*sp != 0) && (i < 25); sp++, i++) |
643 | *sp = tolower(*sp); | 643 | *sp = tolower(*sp); |
644 | 644 | ||
645 | for (i = 0; i < ARRAY_SIZE(stl_brdstr); i++) { | 645 | for (i = 0; i < ARRAY_SIZE(stl_brdstr); i++) |
646 | if (strcmp(stl_brdstr[i].name, argp[0]) == 0) | 646 | if (strcmp(stl_brdstr[i].name, argp[0]) == 0) |
647 | break; | 647 | break; |
648 | } | 648 | |
649 | if (i == ARRAY_SIZE(stl_brdstr)) { | 649 | if (i == ARRAY_SIZE(stl_brdstr)) { |
650 | printk("STALLION: unknown board name, %s?\n", argp[0]); | 650 | printk("STALLION: unknown board name, %s?\n", argp[0]); |
651 | return 0; | 651 | return 0; |
@@ -707,7 +707,7 @@ static int stl_open(struct tty_struct *tty, struct file *filp) | |||
707 | if (brdp == NULL) | 707 | if (brdp == NULL) |
708 | return -ENODEV; | 708 | return -ENODEV; |
709 | minordev = MINOR2PORT(minordev); | 709 | minordev = MINOR2PORT(minordev); |
710 | for (portnr = -1, panelnr = 0; (panelnr < STL_MAXPANELS); panelnr++) { | 710 | for (portnr = -1, panelnr = 0; panelnr < STL_MAXPANELS; panelnr++) { |
711 | if (brdp->panels[panelnr] == NULL) | 711 | if (brdp->panels[panelnr] == NULL) |
712 | break; | 712 | break; |
713 | if (minordev < brdp->panels[panelnr]->nrports) { | 713 | if (minordev < brdp->panels[panelnr]->nrports) { |
@@ -766,10 +766,10 @@ static int stl_open(struct tty_struct *tty, struct file *filp) | |||
766 | * previous opens still in effect. If we are a normal serial device | 766 | * previous opens still in effect. If we are a normal serial device |
767 | * then also we might have to wait for carrier. | 767 | * then also we might have to wait for carrier. |
768 | */ | 768 | */ |
769 | if (!(filp->f_flags & O_NONBLOCK)) { | 769 | if (!(filp->f_flags & O_NONBLOCK)) |
770 | if ((rc = stl_waitcarrier(portp, filp)) != 0) | 770 | if ((rc = stl_waitcarrier(portp, filp)) != 0) |
771 | return rc; | 771 | return rc; |
772 | } | 772 | |
773 | portp->flags |= ASYNC_NORMAL_ACTIVE; | 773 | portp->flags |= ASYNC_NORMAL_ACTIVE; |
774 | 774 | ||
775 | return 0; | 775 | return 0; |
@@ -813,9 +813,8 @@ static int stl_waitcarrier(struct stlport *portp, struct file *filp) | |||
813 | break; | 813 | break; |
814 | } | 814 | } |
815 | if (((portp->flags & ASYNC_CLOSING) == 0) && | 815 | if (((portp->flags & ASYNC_CLOSING) == 0) && |
816 | (doclocal || (portp->sigs & TIOCM_CD))) { | 816 | (doclocal || (portp->sigs & TIOCM_CD))) |
817 | break; | 817 | break; |
818 | } | ||
819 | if (signal_pending(current)) { | 818 | if (signal_pending(current)) { |
820 | rc = -ERESTARTSYS; | 819 | rc = -ERESTARTSYS; |
821 | break; | 820 | break; |
@@ -1091,7 +1090,7 @@ static int stl_writeroom(struct tty_struct *tty) | |||
1091 | 1090 | ||
1092 | head = portp->tx.head; | 1091 | head = portp->tx.head; |
1093 | tail = portp->tx.tail; | 1092 | tail = portp->tx.tail; |
1094 | return ((head >= tail) ? (STL_TXBUFSIZE - (head - tail) - 1) : (tail - head - 1)); | 1093 | return (head >= tail) ? (STL_TXBUFSIZE - (head - tail) - 1) : (tail - head - 1); |
1095 | } | 1094 | } |
1096 | 1095 | ||
1097 | /*****************************************************************************/ | 1096 | /*****************************************************************************/ |
@@ -1261,10 +1260,9 @@ static int stl_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd | |||
1261 | return -ENODEV; | 1260 | return -ENODEV; |
1262 | 1261 | ||
1263 | if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) && | 1262 | if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) && |
1264 | (cmd != COM_GETPORTSTATS) && (cmd != COM_CLRPORTSTATS)) { | 1263 | (cmd != COM_GETPORTSTATS) && (cmd != COM_CLRPORTSTATS)) |
1265 | if (tty->flags & (1 << TTY_IO_ERROR)) | 1264 | if (tty->flags & (1 << TTY_IO_ERROR)) |
1266 | return -EIO; | 1265 | return -EIO; |
1267 | } | ||
1268 | 1266 | ||
1269 | rc = 0; | 1267 | rc = 0; |
1270 | 1268 | ||
@@ -1538,7 +1536,7 @@ static int stl_portinfo(struct stlport *portp, int portnr, char *pos) | |||
1538 | *sp = ' '; | 1536 | *sp = ' '; |
1539 | sp += cnt; | 1537 | sp += cnt; |
1540 | 1538 | ||
1541 | for (cnt = (sp - pos); (cnt < (MAXLINE - 1)); cnt++) | 1539 | for (cnt = sp - pos; cnt < (MAXLINE - 1); cnt++) |
1542 | *sp++ = ' '; | 1540 | *sp++ = ' '; |
1543 | if (cnt >= MAXLINE) | 1541 | if (cnt >= MAXLINE) |
1544 | pos[(MAXLINE - 2)] = '+'; | 1542 | pos[(MAXLINE - 2)] = '+'; |
@@ -1582,7 +1580,7 @@ static int stl_readproc(char *page, char **start, off_t off, int count, int *eof | |||
1582 | * We scan through for each board, panel and port. The offset is | 1580 | * We scan through for each board, panel and port. The offset is |
1583 | * calculated on the fly, and irrelevant ports are skipped. | 1581 | * calculated on the fly, and irrelevant ports are skipped. |
1584 | */ | 1582 | */ |
1585 | for (brdnr = 0; (brdnr < stl_nrbrds); brdnr++) { | 1583 | for (brdnr = 0; brdnr < stl_nrbrds; brdnr++) { |
1586 | brdp = stl_brds[brdnr]; | 1584 | brdp = stl_brds[brdnr]; |
1587 | if (brdp == NULL) | 1585 | if (brdp == NULL) |
1588 | continue; | 1586 | continue; |
@@ -1596,7 +1594,7 @@ static int stl_readproc(char *page, char **start, off_t off, int count, int *eof | |||
1596 | } | 1594 | } |
1597 | 1595 | ||
1598 | totalport = brdnr * STL_MAXPORTS; | 1596 | totalport = brdnr * STL_MAXPORTS; |
1599 | for (panelnr = 0; (panelnr < brdp->nrpanels); panelnr++) { | 1597 | for (panelnr = 0; panelnr < brdp->nrpanels; panelnr++) { |
1600 | panelp = brdp->panels[panelnr]; | 1598 | panelp = brdp->panels[panelnr]; |
1601 | if (panelp == NULL) | 1599 | if (panelp == NULL) |
1602 | continue; | 1600 | continue; |
@@ -1608,7 +1606,7 @@ static int stl_readproc(char *page, char **start, off_t off, int count, int *eof | |||
1608 | continue; | 1606 | continue; |
1609 | } | 1607 | } |
1610 | 1608 | ||
1611 | for (portnr = 0; (portnr < panelp->nrports); portnr++, | 1609 | for (portnr = 0; portnr < panelp->nrports; portnr++, |
1612 | totalport++) { | 1610 | totalport++) { |
1613 | portp = panelp->ports[portnr]; | 1611 | portp = panelp->ports[portnr]; |
1614 | if (portp == NULL) | 1612 | if (portp == NULL) |
@@ -1626,7 +1624,7 @@ static int stl_readproc(char *page, char **start, off_t off, int count, int *eof | |||
1626 | 1624 | ||
1627 | stl_readdone: | 1625 | stl_readdone: |
1628 | *start = page; | 1626 | *start = page; |
1629 | return (pos - page); | 1627 | return pos - page; |
1630 | } | 1628 | } |
1631 | 1629 | ||
1632 | /*****************************************************************************/ | 1630 | /*****************************************************************************/ |
@@ -1685,7 +1683,7 @@ static int stl_echatintr(struct stlbrd *brdp) | |||
1685 | 1683 | ||
1686 | while (inb(brdp->iostatus) & ECH_INTRPEND) { | 1684 | while (inb(brdp->iostatus) & ECH_INTRPEND) { |
1687 | handled = 1; | 1685 | handled = 1; |
1688 | for (bnknr = 0; (bnknr < brdp->nrbnks); bnknr++) { | 1686 | for (bnknr = 0; bnknr < brdp->nrbnks; bnknr++) { |
1689 | ioaddr = brdp->bnkstataddr[bnknr]; | 1687 | ioaddr = brdp->bnkstataddr[bnknr]; |
1690 | if (inb(ioaddr) & ECH_PNLINTRPEND) { | 1688 | if (inb(ioaddr) & ECH_PNLINTRPEND) { |
1691 | panelp = brdp->bnk2panel[bnknr]; | 1689 | panelp = brdp->bnk2panel[bnknr]; |
@@ -1714,7 +1712,7 @@ static int stl_echmcaintr(struct stlbrd *brdp) | |||
1714 | 1712 | ||
1715 | while (inb(brdp->iostatus) & ECH_INTRPEND) { | 1713 | while (inb(brdp->iostatus) & ECH_INTRPEND) { |
1716 | handled = 1; | 1714 | handled = 1; |
1717 | for (bnknr = 0; (bnknr < brdp->nrbnks); bnknr++) { | 1715 | for (bnknr = 0; bnknr < brdp->nrbnks; bnknr++) { |
1718 | ioaddr = brdp->bnkstataddr[bnknr]; | 1716 | ioaddr = brdp->bnkstataddr[bnknr]; |
1719 | if (inb(ioaddr) & ECH_PNLINTRPEND) { | 1717 | if (inb(ioaddr) & ECH_PNLINTRPEND) { |
1720 | panelp = brdp->bnk2panel[bnknr]; | 1718 | panelp = brdp->bnk2panel[bnknr]; |
@@ -1740,7 +1738,7 @@ static int stl_echpciintr(struct stlbrd *brdp) | |||
1740 | 1738 | ||
1741 | while (1) { | 1739 | while (1) { |
1742 | recheck = 0; | 1740 | recheck = 0; |
1743 | for (bnknr = 0; (bnknr < brdp->nrbnks); bnknr++) { | 1741 | for (bnknr = 0; bnknr < brdp->nrbnks; bnknr++) { |
1744 | outb(brdp->bnkpageaddr[bnknr], brdp->ioctrl); | 1742 | outb(brdp->bnkpageaddr[bnknr], brdp->ioctrl); |
1745 | ioaddr = brdp->bnkstataddr[bnknr]; | 1743 | ioaddr = brdp->bnkstataddr[bnknr]; |
1746 | if (inb(ioaddr) & ECH_PNLINTRPEND) { | 1744 | if (inb(ioaddr) & ECH_PNLINTRPEND) { |
@@ -1771,7 +1769,7 @@ static int stl_echpci64intr(struct stlbrd *brdp) | |||
1771 | 1769 | ||
1772 | while (inb(brdp->ioctrl) & 0x1) { | 1770 | while (inb(brdp->ioctrl) & 0x1) { |
1773 | handled = 1; | 1771 | handled = 1; |
1774 | for (bnknr = 0; (bnknr < brdp->nrbnks); bnknr++) { | 1772 | for (bnknr = 0; bnknr < brdp->nrbnks; bnknr++) { |
1775 | ioaddr = brdp->bnkstataddr[bnknr]; | 1773 | ioaddr = brdp->bnkstataddr[bnknr]; |
1776 | if (inb(ioaddr) & ECH_PNLINTRPEND) { | 1774 | if (inb(ioaddr) & ECH_PNLINTRPEND) { |
1777 | panelp = brdp->bnk2panel[bnknr]; | 1775 | panelp = brdp->bnk2panel[bnknr]; |
@@ -1804,19 +1802,18 @@ static void stl_offintr(struct work_struct *work) | |||
1804 | return; | 1802 | return; |
1805 | 1803 | ||
1806 | lock_kernel(); | 1804 | lock_kernel(); |
1807 | if (test_bit(ASYI_TXLOW, &portp->istate)) { | 1805 | if (test_bit(ASYI_TXLOW, &portp->istate)) |
1808 | tty_wakeup(tty); | 1806 | tty_wakeup(tty); |
1809 | } | 1807 | |
1810 | if (test_bit(ASYI_DCDCHANGE, &portp->istate)) { | 1808 | if (test_bit(ASYI_DCDCHANGE, &portp->istate)) { |
1811 | clear_bit(ASYI_DCDCHANGE, &portp->istate); | 1809 | clear_bit(ASYI_DCDCHANGE, &portp->istate); |
1812 | oldsigs = portp->sigs; | 1810 | oldsigs = portp->sigs; |
1813 | portp->sigs = stl_getsignals(portp); | 1811 | portp->sigs = stl_getsignals(portp); |
1814 | if ((portp->sigs & TIOCM_CD) && ((oldsigs & TIOCM_CD) == 0)) | 1812 | if ((portp->sigs & TIOCM_CD) && ((oldsigs & TIOCM_CD) == 0)) |
1815 | wake_up_interruptible(&portp->open_wait); | 1813 | wake_up_interruptible(&portp->open_wait); |
1816 | if ((oldsigs & TIOCM_CD) && ((portp->sigs & TIOCM_CD) == 0)) { | 1814 | if ((oldsigs & TIOCM_CD) && ((portp->sigs & TIOCM_CD) == 0)) |
1817 | if (portp->flags & ASYNC_CHECK_CD) | 1815 | if (portp->flags & ASYNC_CHECK_CD) |
1818 | tty_hangup(tty); /* FIXME: module removal race here - AKPM */ | 1816 | tty_hangup(tty); /* FIXME: module removal race here - AKPM */ |
1819 | } | ||
1820 | } | 1817 | } |
1821 | unlock_kernel(); | 1818 | unlock_kernel(); |
1822 | } | 1819 | } |
@@ -1840,7 +1837,7 @@ static int __devinit stl_initports(struct stlbrd *brdp, struct stlpanel *panelp) | |||
1840 | * All UART's are initialized (if found!). Now go through and setup | 1837 | * All UART's are initialized (if found!). Now go through and setup |
1841 | * each ports data structures. | 1838 | * each ports data structures. |
1842 | */ | 1839 | */ |
1843 | for (i = 0; (i < panelp->nrports); i++) { | 1840 | for (i = 0; i < panelp->nrports; i++) { |
1844 | portp = kzalloc(sizeof(struct stlport), GFP_KERNEL); | 1841 | portp = kzalloc(sizeof(struct stlport), GFP_KERNEL); |
1845 | if (!portp) { | 1842 | if (!portp) { |
1846 | printk("STALLION: failed to allocate memory " | 1843 | printk("STALLION: failed to allocate memory " |
@@ -1867,7 +1864,7 @@ static int __devinit stl_initports(struct stlbrd *brdp, struct stlpanel *panelp) | |||
1867 | stl_portinit(brdp, panelp, portp); | 1864 | stl_portinit(brdp, panelp, portp); |
1868 | } | 1865 | } |
1869 | 1866 | ||
1870 | return(0); | 1867 | return 0; |
1871 | } | 1868 | } |
1872 | 1869 | ||
1873 | static void stl_cleanup_panels(struct stlbrd *brdp) | 1870 | static void stl_cleanup_panels(struct stlbrd *brdp) |
@@ -2092,7 +2089,7 @@ static int __devinit stl_initech(struct stlbrd *brdp) | |||
2092 | outb((status | ECH_BRDRESET), brdp->ioaddr1); | 2089 | outb((status | ECH_BRDRESET), brdp->ioaddr1); |
2093 | brdp->ioctrlval = ECH_INTENABLE | | 2090 | brdp->ioctrlval = ECH_INTENABLE | |
2094 | ((brdp->irqtype) ? ECH_INTLEVEL : ECH_INTEDGE); | 2091 | ((brdp->irqtype) ? ECH_INTLEVEL : ECH_INTEDGE); |
2095 | for (i = 0; (i < 10); i++) | 2092 | for (i = 0; i < 10; i++) |
2096 | outb((brdp->ioctrlval | ECH_BRDENABLE), brdp->ioctrl); | 2093 | outb((brdp->ioctrlval | ECH_BRDENABLE), brdp->ioctrl); |
2097 | brdp->iosize1 = 2; | 2094 | brdp->iosize1 = 2; |
2098 | brdp->iosize2 = 32; | 2095 | brdp->iosize2 = 32; |
@@ -2180,7 +2177,7 @@ static int __devinit stl_initech(struct stlbrd *brdp) | |||
2180 | panelnr = 0; | 2177 | panelnr = 0; |
2181 | nxtid = 0; | 2178 | nxtid = 0; |
2182 | 2179 | ||
2183 | for (i = 0; (i < STL_MAXPANELS); i++) { | 2180 | for (i = 0; i < STL_MAXPANELS; i++) { |
2184 | if (brdp->brdtype == BRD_ECHPCI) { | 2181 | if (brdp->brdtype == BRD_ECHPCI) { |
2185 | outb(nxtid, brdp->ioctrl); | 2182 | outb(nxtid, brdp->ioctrl); |
2186 | ioaddr = brdp->ioaddr2; | 2183 | ioaddr = brdp->ioaddr2; |
@@ -2213,9 +2210,8 @@ static int __devinit stl_initech(struct stlbrd *brdp) | |||
2213 | brdp->bnkpageaddr[banknr] = nxtid; | 2210 | brdp->bnkpageaddr[banknr] = nxtid; |
2214 | brdp->bnkstataddr[banknr++] = ioaddr + 4 + | 2211 | brdp->bnkstataddr[banknr++] = ioaddr + 4 + |
2215 | ECH_PNLSTATUS; | 2212 | ECH_PNLSTATUS; |
2216 | } else { | 2213 | } else |
2217 | panelp->nrports = 8; | 2214 | panelp->nrports = 8; |
2218 | } | ||
2219 | } else { | 2215 | } else { |
2220 | panelp->uartp = &stl_cd1400uart; | 2216 | panelp->uartp = &stl_cd1400uart; |
2221 | panelp->isr = stl_cd1400echintr; | 2217 | panelp->isr = stl_cd1400echintr; |
@@ -2311,7 +2307,7 @@ static int __devinit stl_brdinit(struct stlbrd *brdp) | |||
2311 | goto err_free; | 2307 | goto err_free; |
2312 | } | 2308 | } |
2313 | 2309 | ||
2314 | for (i = 0; (i < STL_MAXPANELS); i++) | 2310 | for (i = 0; i < STL_MAXPANELS; i++) |
2315 | if (brdp->panels[i] != NULL) | 2311 | if (brdp->panels[i] != NULL) |
2316 | stl_initports(brdp, brdp->panels[i]); | 2312 | stl_initports(brdp, brdp->panels[i]); |
2317 | 2313 | ||
@@ -2343,14 +2339,14 @@ static int __devinit stl_getbrdnr(void) | |||
2343 | { | 2339 | { |
2344 | int i; | 2340 | int i; |
2345 | 2341 | ||
2346 | for (i = 0; (i < STL_MAXBRDS); i++) { | 2342 | for (i = 0; i < STL_MAXBRDS; i++) |
2347 | if (stl_brds[i] == NULL) { | 2343 | if (stl_brds[i] == NULL) { |
2348 | if (i >= stl_nrbrds) | 2344 | if (i >= stl_nrbrds) |
2349 | stl_nrbrds = i + 1; | 2345 | stl_nrbrds = i + 1; |
2350 | return(i); | 2346 | return i; |
2351 | } | 2347 | } |
2352 | } | 2348 | |
2353 | return(-1); | 2349 | return -1; |
2354 | } | 2350 | } |
2355 | 2351 | ||
2356 | /*****************************************************************************/ | 2352 | /*****************************************************************************/ |
@@ -2471,10 +2467,10 @@ static int stl_getbrdstats(combrd_t __user *bp) | |||
2471 | if (copy_from_user(&stl_brdstats, bp, sizeof(combrd_t))) | 2467 | if (copy_from_user(&stl_brdstats, bp, sizeof(combrd_t))) |
2472 | return -EFAULT; | 2468 | return -EFAULT; |
2473 | if (stl_brdstats.brd >= STL_MAXBRDS) | 2469 | if (stl_brdstats.brd >= STL_MAXBRDS) |
2474 | return(-ENODEV); | 2470 | return -ENODEV; |
2475 | brdp = stl_brds[stl_brdstats.brd]; | 2471 | brdp = stl_brds[stl_brdstats.brd]; |
2476 | if (brdp == NULL) | 2472 | if (brdp == NULL) |
2477 | return(-ENODEV); | 2473 | return -ENODEV; |
2478 | 2474 | ||
2479 | memset(&stl_brdstats, 0, sizeof(combrd_t)); | 2475 | memset(&stl_brdstats, 0, sizeof(combrd_t)); |
2480 | stl_brdstats.brd = brdp->brdnr; | 2476 | stl_brdstats.brd = brdp->brdnr; |
@@ -2486,7 +2482,7 @@ static int stl_getbrdstats(combrd_t __user *bp) | |||
2486 | stl_brdstats.irq = brdp->irq; | 2482 | stl_brdstats.irq = brdp->irq; |
2487 | stl_brdstats.nrpanels = brdp->nrpanels; | 2483 | stl_brdstats.nrpanels = brdp->nrpanels; |
2488 | stl_brdstats.nrports = brdp->nrports; | 2484 | stl_brdstats.nrports = brdp->nrports; |
2489 | for (i = 0; (i < brdp->nrpanels); i++) { | 2485 | for (i = 0; i < brdp->nrpanels; i++) { |
2490 | panelp = brdp->panels[i]; | 2486 | panelp = brdp->panels[i]; |
2491 | stl_brdstats.panels[i].panel = i; | 2487 | stl_brdstats.panels[i].panel = i; |
2492 | stl_brdstats.panels[i].hwid = panelp->hwid; | 2488 | stl_brdstats.panels[i].hwid = panelp->hwid; |
@@ -2507,19 +2503,19 @@ static struct stlport *stl_getport(int brdnr, int panelnr, int portnr) | |||
2507 | struct stlbrd *brdp; | 2503 | struct stlbrd *brdp; |
2508 | struct stlpanel *panelp; | 2504 | struct stlpanel *panelp; |
2509 | 2505 | ||
2510 | if ((brdnr < 0) || (brdnr >= STL_MAXBRDS)) | 2506 | if (brdnr < 0 || brdnr >= STL_MAXBRDS) |
2511 | return(NULL); | 2507 | return NULL; |
2512 | brdp = stl_brds[brdnr]; | 2508 | brdp = stl_brds[brdnr]; |
2513 | if (brdp == NULL) | 2509 | if (brdp == NULL) |
2514 | return(NULL); | 2510 | return NULL; |
2515 | if ((panelnr < 0) || (panelnr >= brdp->nrpanels)) | 2511 | if (panelnr < 0 || panelnr >= brdp->nrpanels) |
2516 | return(NULL); | 2512 | return NULL; |
2517 | panelp = brdp->panels[panelnr]; | 2513 | panelp = brdp->panels[panelnr]; |
2518 | if (panelp == NULL) | 2514 | if (panelp == NULL) |
2519 | return(NULL); | 2515 | return NULL; |
2520 | if ((portnr < 0) || (portnr >= panelp->nrports)) | 2516 | if (portnr < 0 || portnr >= panelp->nrports) |
2521 | return(NULL); | 2517 | return NULL; |
2522 | return(panelp->ports[portnr]); | 2518 | return panelp->ports[portnr]; |
2523 | } | 2519 | } |
2524 | 2520 | ||
2525 | /*****************************************************************************/ | 2521 | /*****************************************************************************/ |
@@ -2541,7 +2537,7 @@ static int stl_getportstats(struct stlport *portp, comstats_t __user *cp) | |||
2541 | portp = stl_getport(stl_comstats.brd, stl_comstats.panel, | 2537 | portp = stl_getport(stl_comstats.brd, stl_comstats.panel, |
2542 | stl_comstats.port); | 2538 | stl_comstats.port); |
2543 | if (portp == NULL) | 2539 | if (portp == NULL) |
2544 | return(-ENODEV); | 2540 | return -ENODEV; |
2545 | } | 2541 | } |
2546 | 2542 | ||
2547 | portp->stats.state = portp->istate; | 2543 | portp->stats.state = portp->istate; |
@@ -2556,7 +2552,7 @@ static int stl_getportstats(struct stlport *portp, comstats_t __user *cp) | |||
2556 | portp->stats.rxbuffered = 0; | 2552 | portp->stats.rxbuffered = 0; |
2557 | 2553 | ||
2558 | spin_lock_irqsave(&stallion_lock, flags); | 2554 | spin_lock_irqsave(&stallion_lock, flags); |
2559 | if (portp->tty != NULL) { | 2555 | if (portp->tty != NULL) |
2560 | if (portp->tty->driver_data == portp) { | 2556 | if (portp->tty->driver_data == portp) { |
2561 | portp->stats.ttystate = portp->tty->flags; | 2557 | portp->stats.ttystate = portp->tty->flags; |
2562 | /* No longer available as a statistic */ | 2558 | /* No longer available as a statistic */ |
@@ -2568,13 +2564,12 @@ static int stl_getportstats(struct stlport *portp, comstats_t __user *cp) | |||
2568 | portp->stats.lflags = portp->tty->termios->c_lflag; | 2564 | portp->stats.lflags = portp->tty->termios->c_lflag; |
2569 | } | 2565 | } |
2570 | } | 2566 | } |
2571 | } | ||
2572 | spin_unlock_irqrestore(&stallion_lock, flags); | 2567 | spin_unlock_irqrestore(&stallion_lock, flags); |
2573 | 2568 | ||
2574 | head = portp->tx.head; | 2569 | head = portp->tx.head; |
2575 | tail = portp->tx.tail; | 2570 | tail = portp->tx.tail; |
2576 | portp->stats.txbuffered = ((head >= tail) ? (head - tail) : | 2571 | portp->stats.txbuffered = (head >= tail) ? (head - tail) : |
2577 | (STL_TXBUFSIZE - (tail - head))); | 2572 | (STL_TXBUFSIZE - (tail - head)); |
2578 | 2573 | ||
2579 | portp->stats.signals = (unsigned long) stl_getsignals(portp); | 2574 | portp->stats.signals = (unsigned long) stl_getsignals(portp); |
2580 | 2575 | ||
@@ -2596,7 +2591,7 @@ static int stl_clrportstats(struct stlport *portp, comstats_t __user *cp) | |||
2596 | portp = stl_getport(stl_comstats.brd, stl_comstats.panel, | 2591 | portp = stl_getport(stl_comstats.brd, stl_comstats.panel, |
2597 | stl_comstats.port); | 2592 | stl_comstats.port); |
2598 | if (portp == NULL) | 2593 | if (portp == NULL) |
2599 | return(-ENODEV); | 2594 | return -ENODEV; |
2600 | } | 2595 | } |
2601 | 2596 | ||
2602 | memset(&portp->stats, 0, sizeof(comstats_t)); | 2597 | memset(&portp->stats, 0, sizeof(comstats_t)); |
@@ -2642,7 +2637,7 @@ static int stl_getbrdstruct(struct stlbrd __user *arg) | |||
2642 | return -ENODEV; | 2637 | return -ENODEV; |
2643 | brdp = stl_brds[stl_dummybrd.brdnr]; | 2638 | brdp = stl_brds[stl_dummybrd.brdnr]; |
2644 | if (!brdp) | 2639 | if (!brdp) |
2645 | return(-ENODEV); | 2640 | return -ENODEV; |
2646 | return copy_to_user(arg, brdp, sizeof(struct stlbrd)) ? -EFAULT : 0; | 2641 | return copy_to_user(arg, brdp, sizeof(struct stlbrd)) ? -EFAULT : 0; |
2647 | } | 2642 | } |
2648 | 2643 | ||
@@ -2663,7 +2658,7 @@ static int stl_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, uns | |||
2663 | 2658 | ||
2664 | brdnr = iminor(ip); | 2659 | brdnr = iminor(ip); |
2665 | if (brdnr >= STL_MAXBRDS) | 2660 | if (brdnr >= STL_MAXBRDS) |
2666 | return(-ENODEV); | 2661 | return -ENODEV; |
2667 | rc = 0; | 2662 | rc = 0; |
2668 | 2663 | ||
2669 | switch (cmd) { | 2664 | switch (cmd) { |
@@ -2687,7 +2682,7 @@ static int stl_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, uns | |||
2687 | break; | 2682 | break; |
2688 | } | 2683 | } |
2689 | 2684 | ||
2690 | return(rc); | 2685 | return rc; |
2691 | } | 2686 | } |
2692 | 2687 | ||
2693 | static const struct tty_operations stl_ops = { | 2688 | static const struct tty_operations stl_ops = { |
@@ -2732,13 +2727,13 @@ static int stl_cd1400getreg(struct stlport *portp, int regnr) | |||
2732 | 2727 | ||
2733 | static void stl_cd1400setreg(struct stlport *portp, int regnr, int value) | 2728 | static void stl_cd1400setreg(struct stlport *portp, int regnr, int value) |
2734 | { | 2729 | { |
2735 | outb((regnr + portp->uartaddr), portp->ioaddr); | 2730 | outb(regnr + portp->uartaddr, portp->ioaddr); |
2736 | outb(value, portp->ioaddr + EREG_DATA); | 2731 | outb(value, portp->ioaddr + EREG_DATA); |
2737 | } | 2732 | } |
2738 | 2733 | ||
2739 | static int stl_cd1400updatereg(struct stlport *portp, int regnr, int value) | 2734 | static int stl_cd1400updatereg(struct stlport *portp, int regnr, int value) |
2740 | { | 2735 | { |
2741 | outb((regnr + portp->uartaddr), portp->ioaddr); | 2736 | outb(regnr + portp->uartaddr, portp->ioaddr); |
2742 | if (inb(portp->ioaddr + EREG_DATA) != value) { | 2737 | if (inb(portp->ioaddr + EREG_DATA) != value) { |
2743 | outb(value, portp->ioaddr + EREG_DATA); | 2738 | outb(value, portp->ioaddr + EREG_DATA); |
2744 | return 1; | 2739 | return 1; |
@@ -2771,13 +2766,12 @@ static int stl_cd1400panelinit(struct stlbrd *brdp, struct stlpanel *panelp) | |||
2771 | */ | 2766 | */ |
2772 | chipmask = 0; | 2767 | chipmask = 0; |
2773 | nrchips = panelp->nrports / CD1400_PORTS; | 2768 | nrchips = panelp->nrports / CD1400_PORTS; |
2774 | for (i = 0; (i < nrchips); i++) { | 2769 | for (i = 0; i < nrchips; i++) { |
2775 | if (brdp->brdtype == BRD_ECHPCI) { | 2770 | if (brdp->brdtype == BRD_ECHPCI) { |
2776 | outb((panelp->pagenr + (i >> 1)), brdp->ioctrl); | 2771 | outb((panelp->pagenr + (i >> 1)), brdp->ioctrl); |
2777 | ioaddr = panelp->iobase; | 2772 | ioaddr = panelp->iobase; |
2778 | } else { | 2773 | } else |
2779 | ioaddr = panelp->iobase + (EREG_BANKSIZE * (i >> 1)); | 2774 | ioaddr = panelp->iobase + (EREG_BANKSIZE * (i >> 1)); |
2780 | } | ||
2781 | uartaddr = (i & 0x01) ? 0x080 : 0; | 2775 | uartaddr = (i & 0x01) ? 0x080 : 0; |
2782 | outb((GFRCR + uartaddr), ioaddr); | 2776 | outb((GFRCR + uartaddr), ioaddr); |
2783 | outb(0, (ioaddr + EREG_DATA)); | 2777 | outb(0, (ioaddr + EREG_DATA)); |
@@ -2785,10 +2779,10 @@ static int stl_cd1400panelinit(struct stlbrd *brdp, struct stlpanel *panelp) | |||
2785 | outb(CCR_RESETFULL, (ioaddr + EREG_DATA)); | 2779 | outb(CCR_RESETFULL, (ioaddr + EREG_DATA)); |
2786 | outb(CCR_RESETFULL, (ioaddr + EREG_DATA)); | 2780 | outb(CCR_RESETFULL, (ioaddr + EREG_DATA)); |
2787 | outb((GFRCR + uartaddr), ioaddr); | 2781 | outb((GFRCR + uartaddr), ioaddr); |
2788 | for (j = 0; (j < CCR_MAXWAIT); j++) { | 2782 | for (j = 0; j < CCR_MAXWAIT; j++) |
2789 | if ((gfrcr = inb(ioaddr + EREG_DATA)) != 0) | 2783 | if ((gfrcr = inb(ioaddr + EREG_DATA)) != 0) |
2790 | break; | 2784 | break; |
2791 | } | 2785 | |
2792 | if ((j >= CCR_MAXWAIT) || (gfrcr < 0x40) || (gfrcr > 0x60)) { | 2786 | if ((j >= CCR_MAXWAIT) || (gfrcr < 0x40) || (gfrcr > 0x60)) { |
2793 | printk("STALLION: cd1400 not responding, " | 2787 | printk("STALLION: cd1400 not responding, " |
2794 | "brd=%d panel=%d chip=%d\n", | 2788 | "brd=%d panel=%d chip=%d\n", |
@@ -2846,11 +2840,9 @@ static void stl_cd1400ccrwait(struct stlport *portp) | |||
2846 | { | 2840 | { |
2847 | int i; | 2841 | int i; |
2848 | 2842 | ||
2849 | for (i = 0; (i < CCR_MAXWAIT); i++) { | 2843 | for (i = 0; i < CCR_MAXWAIT; i++) |
2850 | if (stl_cd1400getreg(portp, CCR) == 0) { | 2844 | if (stl_cd1400getreg(portp, CCR) == 0) |
2851 | return; | 2845 | return; |
2852 | } | ||
2853 | } | ||
2854 | 2846 | ||
2855 | printk("STALLION: cd1400 not responding, port=%d panel=%d brd=%d\n", | 2847 | printk("STALLION: cd1400 not responding, port=%d panel=%d brd=%d\n", |
2856 | portp->portnr, portp->panelnr, portp->brdnr); | 2848 | portp->portnr, portp->panelnr, portp->brdnr); |
@@ -2986,8 +2978,8 @@ static void stl_cd1400setport(struct stlport *portp, struct ktermios *tiosp) | |||
2986 | baudrate = STL_CD1400MAXBAUD; | 2978 | baudrate = STL_CD1400MAXBAUD; |
2987 | 2979 | ||
2988 | if (baudrate > 0) { | 2980 | if (baudrate > 0) { |
2989 | for (clk = 0; (clk < CD1400_NUMCLKS); clk++) { | 2981 | for (clk = 0; clk < CD1400_NUMCLKS; clk++) { |
2990 | clkdiv = ((portp->clk / stl_cd1400clkdivs[clk]) / baudrate); | 2982 | clkdiv = (portp->clk / stl_cd1400clkdivs[clk]) / baudrate; |
2991 | if (clkdiv < 0x100) | 2983 | if (clkdiv < 0x100) |
2992 | break; | 2984 | break; |
2993 | } | 2985 | } |
@@ -3002,9 +2994,8 @@ static void stl_cd1400setport(struct stlport *portp, struct ktermios *tiosp) | |||
3002 | mcor2 |= MCOR2_DCD; | 2994 | mcor2 |= MCOR2_DCD; |
3003 | sreron |= SRER_MODEM; | 2995 | sreron |= SRER_MODEM; |
3004 | portp->flags |= ASYNC_CHECK_CD; | 2996 | portp->flags |= ASYNC_CHECK_CD; |
3005 | } else { | 2997 | } else |
3006 | portp->flags &= ~ASYNC_CHECK_CD; | 2998 | portp->flags &= ~ASYNC_CHECK_CD; |
3007 | } | ||
3008 | 2999 | ||
3009 | /* | 3000 | /* |
3010 | * Setup cd1400 enhanced modes if we can. In particular we want to | 3001 | * Setup cd1400 enhanced modes if we can. In particular we want to |
@@ -3648,18 +3639,16 @@ static void stl_cd1400rxisr(struct stlpanel *panelp, int ioaddr) | |||
3648 | do_SAK(tty); | 3639 | do_SAK(tty); |
3649 | BRDENABLE(portp->brdnr, portp->pagenr); | 3640 | BRDENABLE(portp->brdnr, portp->pagenr); |
3650 | } | 3641 | } |
3651 | } else if (status & ST_PARITY) { | 3642 | } else if (status & ST_PARITY) |
3652 | status = TTY_PARITY; | 3643 | status = TTY_PARITY; |
3653 | } else if (status & ST_FRAMING) { | 3644 | else if (status & ST_FRAMING) |
3654 | status = TTY_FRAME; | 3645 | status = TTY_FRAME; |
3655 | } else if(status & ST_OVERRUN) { | 3646 | else if(status & ST_OVERRUN) |
3656 | status = TTY_OVERRUN; | 3647 | status = TTY_OVERRUN; |
3657 | } else { | 3648 | else |
3658 | status = 0; | 3649 | status = 0; |
3659 | } | 3650 | } else |
3660 | } else { | ||
3661 | status = 0; | 3651 | status = 0; |
3662 | } | ||
3663 | tty_insert_flip_char(tty, ch, status); | 3652 | tty_insert_flip_char(tty, ch, status); |
3664 | tty_schedule_flip(tty); | 3653 | tty_schedule_flip(tty); |
3665 | } | 3654 | } |
@@ -3786,7 +3775,7 @@ static int stl_sc26198panelinit(struct stlbrd *brdp, struct stlpanel *panelp) | |||
3786 | if (brdp->brdtype == BRD_ECHPCI) | 3775 | if (brdp->brdtype == BRD_ECHPCI) |
3787 | outb(panelp->pagenr, brdp->ioctrl); | 3776 | outb(panelp->pagenr, brdp->ioctrl); |
3788 | 3777 | ||
3789 | for (i = 0; (i < nrchips); i++) { | 3778 | for (i = 0; i < nrchips; i++) { |
3790 | ioaddr = panelp->iobase + (i * 4); | 3779 | ioaddr = panelp->iobase + (i * 4); |
3791 | outb(SCCR, (ioaddr + XP_ADDR)); | 3780 | outb(SCCR, (ioaddr + XP_ADDR)); |
3792 | outb(CR_RESETALL, (ioaddr + XP_DATA)); | 3781 | outb(CR_RESETALL, (ioaddr + XP_DATA)); |
@@ -3906,9 +3895,8 @@ static void stl_sc26198setport(struct stlport *portp, struct ktermios *tiosp) | |||
3906 | mr1 |= (MR1_PARENB | MR1_PARODD); | 3895 | mr1 |= (MR1_PARENB | MR1_PARODD); |
3907 | else | 3896 | else |
3908 | mr1 |= (MR1_PARENB | MR1_PAREVEN); | 3897 | mr1 |= (MR1_PARENB | MR1_PAREVEN); |
3909 | } else { | 3898 | } else |
3910 | mr1 |= MR1_PARNONE; | 3899 | mr1 |= MR1_PARNONE; |
3911 | } | ||
3912 | 3900 | ||
3913 | mr1 |= MR1_ERRBLOCK; | 3901 | mr1 |= MR1_ERRBLOCK; |
3914 | 3902 | ||
@@ -3948,12 +3936,10 @@ static void stl_sc26198setport(struct stlport *portp, struct ktermios *tiosp) | |||
3948 | if (baudrate > STL_SC26198MAXBAUD) | 3936 | if (baudrate > STL_SC26198MAXBAUD) |
3949 | baudrate = STL_SC26198MAXBAUD; | 3937 | baudrate = STL_SC26198MAXBAUD; |
3950 | 3938 | ||
3951 | if (baudrate > 0) { | 3939 | if (baudrate > 0) |
3952 | for (clk = 0; (clk < SC26198_NRBAUDS); clk++) { | 3940 | for (clk = 0; clk < SC26198_NRBAUDS; clk++) |
3953 | if (baudrate <= sc26198_baudtable[clk]) | 3941 | if (baudrate <= sc26198_baudtable[clk]) |
3954 | break; | 3942 | break; |
3955 | } | ||
3956 | } | ||
3957 | 3943 | ||
3958 | /* | 3944 | /* |
3959 | * Check what form of modem signaling is required and set it up. | 3945 | * Check what form of modem signaling is required and set it up. |
@@ -3975,9 +3961,9 @@ static void stl_sc26198setport(struct stlport *portp, struct ktermios *tiosp) | |||
3975 | if (tiosp->c_iflag & IXON) { | 3961 | if (tiosp->c_iflag & IXON) { |
3976 | mr0 |= MR0_SWFTX | MR0_SWFT; | 3962 | mr0 |= MR0_SWFTX | MR0_SWFT; |
3977 | imron |= IR_XONXOFF; | 3963 | imron |= IR_XONXOFF; |
3978 | } else { | 3964 | } else |
3979 | imroff |= IR_XONXOFF; | 3965 | imroff |= IR_XONXOFF; |
3980 | } | 3966 | |
3981 | if (tiosp->c_iflag & IXOFF) | 3967 | if (tiosp->c_iflag & IXOFF) |
3982 | mr0 |= MR0_SWFRX; | 3968 | mr0 |= MR0_SWFRX; |
3983 | 3969 | ||
@@ -4188,9 +4174,9 @@ static void stl_sc26198sendbreak(struct stlport *portp, int len) | |||
4188 | if (len == 1) { | 4174 | if (len == 1) { |
4189 | stl_sc26198setreg(portp, SCCR, CR_TXSTARTBREAK); | 4175 | stl_sc26198setreg(portp, SCCR, CR_TXSTARTBREAK); |
4190 | portp->stats.txbreaks++; | 4176 | portp->stats.txbreaks++; |
4191 | } else { | 4177 | } else |
4192 | stl_sc26198setreg(portp, SCCR, CR_TXSTOPBREAK); | 4178 | stl_sc26198setreg(portp, SCCR, CR_TXSTOPBREAK); |
4193 | } | 4179 | |
4194 | BRDDISABLE(portp->brdnr); | 4180 | BRDDISABLE(portp->brdnr); |
4195 | spin_unlock_irqrestore(&brd_lock, flags); | 4181 | spin_unlock_irqrestore(&brd_lock, flags); |
4196 | } | 4182 | } |
@@ -4374,7 +4360,7 @@ static void stl_sc26198wait(struct stlport *portp) | |||
4374 | if (portp == NULL) | 4360 | if (portp == NULL) |
4375 | return; | 4361 | return; |
4376 | 4362 | ||
4377 | for (i = 0; (i < 20); i++) | 4363 | for (i = 0; i < 20; i++) |
4378 | stl_sc26198getglobreg(portp, TSTR); | 4364 | stl_sc26198getglobreg(portp, TSTR); |
4379 | } | 4365 | } |
4380 | 4366 | ||
@@ -4583,18 +4569,16 @@ static void stl_sc26198rxbadch(struct stlport *portp, unsigned char status, char | |||
4583 | do_SAK(tty); | 4569 | do_SAK(tty); |
4584 | BRDENABLE(portp->brdnr, portp->pagenr); | 4570 | BRDENABLE(portp->brdnr, portp->pagenr); |
4585 | } | 4571 | } |
4586 | } else if (status & SR_RXPARITY) { | 4572 | } else if (status & SR_RXPARITY) |
4587 | status = TTY_PARITY; | 4573 | status = TTY_PARITY; |
4588 | } else if (status & SR_RXFRAMING) { | 4574 | else if (status & SR_RXFRAMING) |
4589 | status = TTY_FRAME; | 4575 | status = TTY_FRAME; |
4590 | } else if(status & SR_RXOVERRUN) { | 4576 | else if(status & SR_RXOVERRUN) |
4591 | status = TTY_OVERRUN; | 4577 | status = TTY_OVERRUN; |
4592 | } else { | 4578 | else |
4593 | status = 0; | 4579 | status = 0; |
4594 | } | 4580 | } else |
4595 | } else { | ||
4596 | status = 0; | 4581 | status = 0; |
4597 | } | ||
4598 | 4582 | ||
4599 | tty_insert_flip_char(tty, ch, status); | 4583 | tty_insert_flip_char(tty, ch, status); |
4600 | tty_schedule_flip(tty); | 4584 | tty_schedule_flip(tty); |