Commit c62429d9 authored by Jiri Slaby's avatar Jiri Slaby Committed by Linus Torvalds

[PATCH] Char: stallion, remove syntactic sugar

Remove useless parenthesis and brackets.
Signed-off-by: default avatarJiri Slaby <jirislaby@gmail.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 79cfe7ab
...@@ -639,13 +639,13 @@ static int __init stl_parsebrd(struct stlconf *confp, char **argp) ...@@ -639,13 +639,13 @@ static int __init stl_parsebrd(struct stlconf *confp, char **argp)
if ((argp[0] == NULL) || (*argp[0] == 0)) if ((argp[0] == NULL) || (*argp[0] == 0))
return 0; return 0;
for (sp = argp[0], i = 0; ((*sp != 0) && (i < 25)); sp++, i++) for (sp = argp[0], i = 0; (*sp != 0) && (i < 25); sp++, i++)
*sp = tolower(*sp); *sp = tolower(*sp);
for (i = 0; i < ARRAY_SIZE(stl_brdstr); i++) { for (i = 0; i < ARRAY_SIZE(stl_brdstr); i++)
if (strcmp(stl_brdstr[i].name, argp[0]) == 0) if (strcmp(stl_brdstr[i].name, argp[0]) == 0)
break; break;
}
if (i == ARRAY_SIZE(stl_brdstr)) { if (i == ARRAY_SIZE(stl_brdstr)) {
printk("STALLION: unknown board name, %s?\n", argp[0]); printk("STALLION: unknown board name, %s?\n", argp[0]);
return 0; return 0;
...@@ -707,7 +707,7 @@ static int stl_open(struct tty_struct *tty, struct file *filp) ...@@ -707,7 +707,7 @@ static int stl_open(struct tty_struct *tty, struct file *filp)
if (brdp == NULL) if (brdp == NULL)
return -ENODEV; return -ENODEV;
minordev = MINOR2PORT(minordev); minordev = MINOR2PORT(minordev);
for (portnr = -1, panelnr = 0; (panelnr < STL_MAXPANELS); panelnr++) { for (portnr = -1, panelnr = 0; panelnr < STL_MAXPANELS; panelnr++) {
if (brdp->panels[panelnr] == NULL) if (brdp->panels[panelnr] == NULL)
break; break;
if (minordev < brdp->panels[panelnr]->nrports) { if (minordev < brdp->panels[panelnr]->nrports) {
...@@ -766,10 +766,10 @@ static int stl_open(struct tty_struct *tty, struct file *filp) ...@@ -766,10 +766,10 @@ static int stl_open(struct tty_struct *tty, struct file *filp)
* previous opens still in effect. If we are a normal serial device * previous opens still in effect. If we are a normal serial device
* then also we might have to wait for carrier. * then also we might have to wait for carrier.
*/ */
if (!(filp->f_flags & O_NONBLOCK)) { if (!(filp->f_flags & O_NONBLOCK))
if ((rc = stl_waitcarrier(portp, filp)) != 0) if ((rc = stl_waitcarrier(portp, filp)) != 0)
return rc; return rc;
}
portp->flags |= ASYNC_NORMAL_ACTIVE; portp->flags |= ASYNC_NORMAL_ACTIVE;
return 0; return 0;
...@@ -813,9 +813,8 @@ static int stl_waitcarrier(struct stlport *portp, struct file *filp) ...@@ -813,9 +813,8 @@ static int stl_waitcarrier(struct stlport *portp, struct file *filp)
break; break;
} }
if (((portp->flags & ASYNC_CLOSING) == 0) && if (((portp->flags & ASYNC_CLOSING) == 0) &&
(doclocal || (portp->sigs & TIOCM_CD))) { (doclocal || (portp->sigs & TIOCM_CD)))
break; break;
}
if (signal_pending(current)) { if (signal_pending(current)) {
rc = -ERESTARTSYS; rc = -ERESTARTSYS;
break; break;
...@@ -1091,7 +1090,7 @@ static int stl_writeroom(struct tty_struct *tty) ...@@ -1091,7 +1090,7 @@ static int stl_writeroom(struct tty_struct *tty)
head = portp->tx.head; head = portp->tx.head;
tail = portp->tx.tail; tail = portp->tx.tail;
return ((head >= tail) ? (STL_TXBUFSIZE - (head - tail) - 1) : (tail - head - 1)); return (head >= tail) ? (STL_TXBUFSIZE - (head - tail) - 1) : (tail - head - 1);
} }
/*****************************************************************************/ /*****************************************************************************/
...@@ -1261,10 +1260,9 @@ static int stl_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd ...@@ -1261,10 +1260,9 @@ static int stl_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd
return -ENODEV; return -ENODEV;
if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) && if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) &&
(cmd != COM_GETPORTSTATS) && (cmd != COM_CLRPORTSTATS)) { (cmd != COM_GETPORTSTATS) && (cmd != COM_CLRPORTSTATS))
if (tty->flags & (1 << TTY_IO_ERROR)) if (tty->flags & (1 << TTY_IO_ERROR))
return -EIO; return -EIO;
}
rc = 0; rc = 0;
...@@ -1538,7 +1536,7 @@ static int stl_portinfo(struct stlport *portp, int portnr, char *pos) ...@@ -1538,7 +1536,7 @@ static int stl_portinfo(struct stlport *portp, int portnr, char *pos)
*sp = ' '; *sp = ' ';
sp += cnt; sp += cnt;
for (cnt = (sp - pos); (cnt < (MAXLINE - 1)); cnt++) for (cnt = sp - pos; cnt < (MAXLINE - 1); cnt++)
*sp++ = ' '; *sp++ = ' ';
if (cnt >= MAXLINE) if (cnt >= MAXLINE)
pos[(MAXLINE - 2)] = '+'; pos[(MAXLINE - 2)] = '+';
...@@ -1582,7 +1580,7 @@ static int stl_readproc(char *page, char **start, off_t off, int count, int *eof ...@@ -1582,7 +1580,7 @@ static int stl_readproc(char *page, char **start, off_t off, int count, int *eof
* We scan through for each board, panel and port. The offset is * We scan through for each board, panel and port. The offset is
* calculated on the fly, and irrelevant ports are skipped. * calculated on the fly, and irrelevant ports are skipped.
*/ */
for (brdnr = 0; (brdnr < stl_nrbrds); brdnr++) { for (brdnr = 0; brdnr < stl_nrbrds; brdnr++) {
brdp = stl_brds[brdnr]; brdp = stl_brds[brdnr];
if (brdp == NULL) if (brdp == NULL)
continue; continue;
...@@ -1596,7 +1594,7 @@ static int stl_readproc(char *page, char **start, off_t off, int count, int *eof ...@@ -1596,7 +1594,7 @@ static int stl_readproc(char *page, char **start, off_t off, int count, int *eof
} }
totalport = brdnr * STL_MAXPORTS; totalport = brdnr * STL_MAXPORTS;
for (panelnr = 0; (panelnr < brdp->nrpanels); panelnr++) { for (panelnr = 0; panelnr < brdp->nrpanels; panelnr++) {
panelp = brdp->panels[panelnr]; panelp = brdp->panels[panelnr];
if (panelp == NULL) if (panelp == NULL)
continue; continue;
...@@ -1608,7 +1606,7 @@ static int stl_readproc(char *page, char **start, off_t off, int count, int *eof ...@@ -1608,7 +1606,7 @@ static int stl_readproc(char *page, char **start, off_t off, int count, int *eof
continue; continue;
} }
for (portnr = 0; (portnr < panelp->nrports); portnr++, for (portnr = 0; portnr < panelp->nrports; portnr++,
totalport++) { totalport++) {
portp = panelp->ports[portnr]; portp = panelp->ports[portnr];
if (portp == NULL) if (portp == NULL)
...@@ -1626,7 +1624,7 @@ static int stl_readproc(char *page, char **start, off_t off, int count, int *eof ...@@ -1626,7 +1624,7 @@ static int stl_readproc(char *page, char **start, off_t off, int count, int *eof
stl_readdone: stl_readdone:
*start = page; *start = page;
return (pos - page); return pos - page;
} }
/*****************************************************************************/ /*****************************************************************************/
...@@ -1685,7 +1683,7 @@ static int stl_echatintr(struct stlbrd *brdp) ...@@ -1685,7 +1683,7 @@ static int stl_echatintr(struct stlbrd *brdp)
while (inb(brdp->iostatus) & ECH_INTRPEND) { while (inb(brdp->iostatus) & ECH_INTRPEND) {
handled = 1; handled = 1;
for (bnknr = 0; (bnknr < brdp->nrbnks); bnknr++) { for (bnknr = 0; bnknr < brdp->nrbnks; bnknr++) {
ioaddr = brdp->bnkstataddr[bnknr]; ioaddr = brdp->bnkstataddr[bnknr];
if (inb(ioaddr) & ECH_PNLINTRPEND) { if (inb(ioaddr) & ECH_PNLINTRPEND) {
panelp = brdp->bnk2panel[bnknr]; panelp = brdp->bnk2panel[bnknr];
...@@ -1714,7 +1712,7 @@ static int stl_echmcaintr(struct stlbrd *brdp) ...@@ -1714,7 +1712,7 @@ static int stl_echmcaintr(struct stlbrd *brdp)
while (inb(brdp->iostatus) & ECH_INTRPEND) { while (inb(brdp->iostatus) & ECH_INTRPEND) {
handled = 1; handled = 1;
for (bnknr = 0; (bnknr < brdp->nrbnks); bnknr++) { for (bnknr = 0; bnknr < brdp->nrbnks; bnknr++) {
ioaddr = brdp->bnkstataddr[bnknr]; ioaddr = brdp->bnkstataddr[bnknr];
if (inb(ioaddr) & ECH_PNLINTRPEND) { if (inb(ioaddr) & ECH_PNLINTRPEND) {
panelp = brdp->bnk2panel[bnknr]; panelp = brdp->bnk2panel[bnknr];
...@@ -1740,7 +1738,7 @@ static int stl_echpciintr(struct stlbrd *brdp) ...@@ -1740,7 +1738,7 @@ static int stl_echpciintr(struct stlbrd *brdp)
while (1) { while (1) {
recheck = 0; recheck = 0;
for (bnknr = 0; (bnknr < brdp->nrbnks); bnknr++) { for (bnknr = 0; bnknr < brdp->nrbnks; bnknr++) {
outb(brdp->bnkpageaddr[bnknr], brdp->ioctrl); outb(brdp->bnkpageaddr[bnknr], brdp->ioctrl);
ioaddr = brdp->bnkstataddr[bnknr]; ioaddr = brdp->bnkstataddr[bnknr];
if (inb(ioaddr) & ECH_PNLINTRPEND) { if (inb(ioaddr) & ECH_PNLINTRPEND) {
...@@ -1771,7 +1769,7 @@ static int stl_echpci64intr(struct stlbrd *brdp) ...@@ -1771,7 +1769,7 @@ static int stl_echpci64intr(struct stlbrd *brdp)
while (inb(brdp->ioctrl) & 0x1) { while (inb(brdp->ioctrl) & 0x1) {
handled = 1; handled = 1;
for (bnknr = 0; (bnknr < brdp->nrbnks); bnknr++) { for (bnknr = 0; bnknr < brdp->nrbnks; bnknr++) {
ioaddr = brdp->bnkstataddr[bnknr]; ioaddr = brdp->bnkstataddr[bnknr];
if (inb(ioaddr) & ECH_PNLINTRPEND) { if (inb(ioaddr) & ECH_PNLINTRPEND) {
panelp = brdp->bnk2panel[bnknr]; panelp = brdp->bnk2panel[bnknr];
...@@ -1804,20 +1802,19 @@ static void stl_offintr(struct work_struct *work) ...@@ -1804,20 +1802,19 @@ static void stl_offintr(struct work_struct *work)
return; return;
lock_kernel(); lock_kernel();
if (test_bit(ASYI_TXLOW, &portp->istate)) { if (test_bit(ASYI_TXLOW, &portp->istate))
tty_wakeup(tty); tty_wakeup(tty);
}
if (test_bit(ASYI_DCDCHANGE, &portp->istate)) { if (test_bit(ASYI_DCDCHANGE, &portp->istate)) {
clear_bit(ASYI_DCDCHANGE, &portp->istate); clear_bit(ASYI_DCDCHANGE, &portp->istate);
oldsigs = portp->sigs; oldsigs = portp->sigs;
portp->sigs = stl_getsignals(portp); portp->sigs = stl_getsignals(portp);
if ((portp->sigs & TIOCM_CD) && ((oldsigs & TIOCM_CD) == 0)) if ((portp->sigs & TIOCM_CD) && ((oldsigs & TIOCM_CD) == 0))
wake_up_interruptible(&portp->open_wait); wake_up_interruptible(&portp->open_wait);
if ((oldsigs & TIOCM_CD) && ((portp->sigs & TIOCM_CD) == 0)) { if ((oldsigs & TIOCM_CD) && ((portp->sigs & TIOCM_CD) == 0))
if (portp->flags & ASYNC_CHECK_CD) if (portp->flags & ASYNC_CHECK_CD)
tty_hangup(tty); /* FIXME: module removal race here - AKPM */ tty_hangup(tty); /* FIXME: module removal race here - AKPM */
} }
}
unlock_kernel(); unlock_kernel();
} }
...@@ -1840,7 +1837,7 @@ static int __devinit stl_initports(struct stlbrd *brdp, struct stlpanel *panelp) ...@@ -1840,7 +1837,7 @@ static int __devinit stl_initports(struct stlbrd *brdp, struct stlpanel *panelp)
* All UART's are initialized (if found!). Now go through and setup * All UART's are initialized (if found!). Now go through and setup
* each ports data structures. * each ports data structures.
*/ */
for (i = 0; (i < panelp->nrports); i++) { for (i = 0; i < panelp->nrports; i++) {
portp = kzalloc(sizeof(struct stlport), GFP_KERNEL); portp = kzalloc(sizeof(struct stlport), GFP_KERNEL);
if (!portp) { if (!portp) {
printk("STALLION: failed to allocate memory " printk("STALLION: failed to allocate memory "
...@@ -1867,7 +1864,7 @@ static int __devinit stl_initports(struct stlbrd *brdp, struct stlpanel *panelp) ...@@ -1867,7 +1864,7 @@ static int __devinit stl_initports(struct stlbrd *brdp, struct stlpanel *panelp)
stl_portinit(brdp, panelp, portp); stl_portinit(brdp, panelp, portp);
} }
return(0); return 0;
} }
static void stl_cleanup_panels(struct stlbrd *brdp) static void stl_cleanup_panels(struct stlbrd *brdp)
...@@ -2092,7 +2089,7 @@ static int __devinit stl_initech(struct stlbrd *brdp) ...@@ -2092,7 +2089,7 @@ static int __devinit stl_initech(struct stlbrd *brdp)
outb((status | ECH_BRDRESET), brdp->ioaddr1); outb((status | ECH_BRDRESET), brdp->ioaddr1);
brdp->ioctrlval = ECH_INTENABLE | brdp->ioctrlval = ECH_INTENABLE |
((brdp->irqtype) ? ECH_INTLEVEL : ECH_INTEDGE); ((brdp->irqtype) ? ECH_INTLEVEL : ECH_INTEDGE);
for (i = 0; (i < 10); i++) for (i = 0; i < 10; i++)
outb((brdp->ioctrlval | ECH_BRDENABLE), brdp->ioctrl); outb((brdp->ioctrlval | ECH_BRDENABLE), brdp->ioctrl);
brdp->iosize1 = 2; brdp->iosize1 = 2;
brdp->iosize2 = 32; brdp->iosize2 = 32;
...@@ -2180,7 +2177,7 @@ static int __devinit stl_initech(struct stlbrd *brdp) ...@@ -2180,7 +2177,7 @@ static int __devinit stl_initech(struct stlbrd *brdp)
panelnr = 0; panelnr = 0;
nxtid = 0; nxtid = 0;
for (i = 0; (i < STL_MAXPANELS); i++) { for (i = 0; i < STL_MAXPANELS; i++) {
if (brdp->brdtype == BRD_ECHPCI) { if (brdp->brdtype == BRD_ECHPCI) {
outb(nxtid, brdp->ioctrl); outb(nxtid, brdp->ioctrl);
ioaddr = brdp->ioaddr2; ioaddr = brdp->ioaddr2;
...@@ -2213,9 +2210,8 @@ static int __devinit stl_initech(struct stlbrd *brdp) ...@@ -2213,9 +2210,8 @@ static int __devinit stl_initech(struct stlbrd *brdp)
brdp->bnkpageaddr[banknr] = nxtid; brdp->bnkpageaddr[banknr] = nxtid;
brdp->bnkstataddr[banknr++] = ioaddr + 4 + brdp->bnkstataddr[banknr++] = ioaddr + 4 +
ECH_PNLSTATUS; ECH_PNLSTATUS;
} else { } else
panelp->nrports = 8; panelp->nrports = 8;
}
} else { } else {
panelp->uartp = &stl_cd1400uart; panelp->uartp = &stl_cd1400uart;
panelp->isr = stl_cd1400echintr; panelp->isr = stl_cd1400echintr;
...@@ -2311,7 +2307,7 @@ static int __devinit stl_brdinit(struct stlbrd *brdp) ...@@ -2311,7 +2307,7 @@ static int __devinit stl_brdinit(struct stlbrd *brdp)
goto err_free; goto err_free;
} }
for (i = 0; (i < STL_MAXPANELS); i++) for (i = 0; i < STL_MAXPANELS; i++)
if (brdp->panels[i] != NULL) if (brdp->panels[i] != NULL)
stl_initports(brdp, brdp->panels[i]); stl_initports(brdp, brdp->panels[i]);
...@@ -2343,14 +2339,14 @@ static int __devinit stl_getbrdnr(void) ...@@ -2343,14 +2339,14 @@ static int __devinit stl_getbrdnr(void)
{ {
int i; int i;
for (i = 0; (i < STL_MAXBRDS); i++) { for (i = 0; i < STL_MAXBRDS; i++)
if (stl_brds[i] == NULL) { if (stl_brds[i] == NULL) {
if (i >= stl_nrbrds) if (i >= stl_nrbrds)
stl_nrbrds = i + 1; stl_nrbrds = i + 1;
return(i); return i;
} }
}
return(-1); return -1;
} }
/*****************************************************************************/ /*****************************************************************************/
...@@ -2471,10 +2467,10 @@ static int stl_getbrdstats(combrd_t __user *bp) ...@@ -2471,10 +2467,10 @@ static int stl_getbrdstats(combrd_t __user *bp)
if (copy_from_user(&stl_brdstats, bp, sizeof(combrd_t))) if (copy_from_user(&stl_brdstats, bp, sizeof(combrd_t)))
return -EFAULT; return -EFAULT;
if (stl_brdstats.brd >= STL_MAXBRDS) if (stl_brdstats.brd >= STL_MAXBRDS)
return(-ENODEV); return -ENODEV;
brdp = stl_brds[stl_brdstats.brd]; brdp = stl_brds[stl_brdstats.brd];
if (brdp == NULL) if (brdp == NULL)
return(-ENODEV); return -ENODEV;
memset(&stl_brdstats, 0, sizeof(combrd_t)); memset(&stl_brdstats, 0, sizeof(combrd_t));
stl_brdstats.brd = brdp->brdnr; stl_brdstats.brd = brdp->brdnr;
...@@ -2486,7 +2482,7 @@ static int stl_getbrdstats(combrd_t __user *bp) ...@@ -2486,7 +2482,7 @@ static int stl_getbrdstats(combrd_t __user *bp)
stl_brdstats.irq = brdp->irq; stl_brdstats.irq = brdp->irq;
stl_brdstats.nrpanels = brdp->nrpanels; stl_brdstats.nrpanels = brdp->nrpanels;
stl_brdstats.nrports = brdp->nrports; stl_brdstats.nrports = brdp->nrports;
for (i = 0; (i < brdp->nrpanels); i++) { for (i = 0; i < brdp->nrpanels; i++) {
panelp = brdp->panels[i]; panelp = brdp->panels[i];
stl_brdstats.panels[i].panel = i; stl_brdstats.panels[i].panel = i;
stl_brdstats.panels[i].hwid = panelp->hwid; stl_brdstats.panels[i].hwid = panelp->hwid;
...@@ -2507,19 +2503,19 @@ static struct stlport *stl_getport(int brdnr, int panelnr, int portnr) ...@@ -2507,19 +2503,19 @@ static struct stlport *stl_getport(int brdnr, int panelnr, int portnr)
struct stlbrd *brdp; struct stlbrd *brdp;
struct stlpanel *panelp; struct stlpanel *panelp;
if ((brdnr < 0) || (brdnr >= STL_MAXBRDS)) if (brdnr < 0 || brdnr >= STL_MAXBRDS)
return(NULL); return NULL;
brdp = stl_brds[brdnr]; brdp = stl_brds[brdnr];
if (brdp == NULL) if (brdp == NULL)
return(NULL); return NULL;
if ((panelnr < 0) || (panelnr >= brdp->nrpanels)) if (panelnr < 0 || panelnr >= brdp->nrpanels)
return(NULL); return NULL;
panelp = brdp->panels[panelnr]; panelp = brdp->panels[panelnr];
if (panelp == NULL) if (panelp == NULL)
return(NULL); return NULL;
if ((portnr < 0) || (portnr >= panelp->nrports)) if (portnr < 0 || portnr >= panelp->nrports)
return(NULL); return NULL;
return(panelp->ports[portnr]); return panelp->ports[portnr];
} }
/*****************************************************************************/ /*****************************************************************************/
...@@ -2541,7 +2537,7 @@ static int stl_getportstats(struct stlport *portp, comstats_t __user *cp) ...@@ -2541,7 +2537,7 @@ static int stl_getportstats(struct stlport *portp, comstats_t __user *cp)
portp = stl_getport(stl_comstats.brd, stl_comstats.panel, portp = stl_getport(stl_comstats.brd, stl_comstats.panel,
stl_comstats.port); stl_comstats.port);
if (portp == NULL) if (portp == NULL)
return(-ENODEV); return -ENODEV;
} }
portp->stats.state = portp->istate; portp->stats.state = portp->istate;
...@@ -2556,7 +2552,7 @@ static int stl_getportstats(struct stlport *portp, comstats_t __user *cp) ...@@ -2556,7 +2552,7 @@ static int stl_getportstats(struct stlport *portp, comstats_t __user *cp)
portp->stats.rxbuffered = 0; portp->stats.rxbuffered = 0;
spin_lock_irqsave(&stallion_lock, flags); spin_lock_irqsave(&stallion_lock, flags);
if (portp->tty != NULL) { if (portp->tty != NULL)
if (portp->tty->driver_data == portp) { if (portp->tty->driver_data == portp) {
portp->stats.ttystate = portp->tty->flags; portp->stats.ttystate = portp->tty->flags;
/* No longer available as a statistic */ /* No longer available as a statistic */
...@@ -2568,13 +2564,12 @@ static int stl_getportstats(struct stlport *portp, comstats_t __user *cp) ...@@ -2568,13 +2564,12 @@ static int stl_getportstats(struct stlport *portp, comstats_t __user *cp)
portp->stats.lflags = portp->tty->termios->c_lflag; portp->stats.lflags = portp->tty->termios->c_lflag;
} }
} }
}
spin_unlock_irqrestore(&stallion_lock, flags); spin_unlock_irqrestore(&stallion_lock, flags);
head = portp->tx.head; head = portp->tx.head;
tail = portp->tx.tail; tail = portp->tx.tail;
portp->stats.txbuffered = ((head >= tail) ? (head - tail) : portp->stats.txbuffered = (head >= tail) ? (head - tail) :
(STL_TXBUFSIZE - (tail - head))); (STL_TXBUFSIZE - (tail - head));
portp->stats.signals = (unsigned long) stl_getsignals(portp); portp->stats.signals = (unsigned long) stl_getsignals(portp);
...@@ -2596,7 +2591,7 @@ static int stl_clrportstats(struct stlport *portp, comstats_t __user *cp) ...@@ -2596,7 +2591,7 @@ static int stl_clrportstats(struct stlport *portp, comstats_t __user *cp)
portp = stl_getport(stl_comstats.brd, stl_comstats.panel, portp = stl_getport(stl_comstats.brd, stl_comstats.panel,
stl_comstats.port); stl_comstats.port);
if (portp == NULL) if (portp == NULL)
return(-ENODEV); return -ENODEV;
} }
memset(&portp->stats, 0, sizeof(comstats_t)); memset(&portp->stats, 0, sizeof(comstats_t));
...@@ -2642,7 +2637,7 @@ static int stl_getbrdstruct(struct stlbrd __user *arg) ...@@ -2642,7 +2637,7 @@ static int stl_getbrdstruct(struct stlbrd __user *arg)
return -ENODEV; return -ENODEV;
brdp = stl_brds[stl_dummybrd.brdnr]; brdp = stl_brds[stl_dummybrd.brdnr];
if (!brdp) if (!brdp)
return(-ENODEV); return -ENODEV;
return copy_to_user(arg, brdp, sizeof(struct stlbrd)) ? -EFAULT : 0; return copy_to_user(arg, brdp, sizeof(struct stlbrd)) ? -EFAULT : 0;
} }
...@@ -2663,7 +2658,7 @@ static int stl_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, uns ...@@ -2663,7 +2658,7 @@ static int stl_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, uns
brdnr = iminor(ip); brdnr = iminor(ip);
if (brdnr >= STL_MAXBRDS) if (brdnr >= STL_MAXBRDS)
return(-ENODEV); return -ENODEV;
rc = 0; rc = 0;
switch (cmd) { switch (cmd) {
...@@ -2687,7 +2682,7 @@ static int stl_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, uns ...@@ -2687,7 +2682,7 @@ static int stl_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, uns
break; break;
} }
return(rc); return rc;
} }
static const struct tty_operations stl_ops = { static const struct tty_operations stl_ops = {
...@@ -2732,13 +2727,13 @@ static int stl_cd1400getreg(struct stlport *portp, int regnr) ...@@ -2732,13 +2727,13 @@ static int stl_cd1400getreg(struct stlport *portp, int regnr)
static void stl_cd1400setreg(struct stlport *portp, int regnr, int value) static void stl_cd1400setreg(struct stlport *portp, int regnr, int value)
{ {
outb((regnr + portp->uartaddr), portp->ioaddr); outb(regnr + portp->uartaddr, portp->ioaddr);
outb(value, portp->ioaddr + EREG_DATA); outb(value, portp->ioaddr + EREG_DATA);
} }
static int stl_cd1400updatereg(struct stlport *portp, int regnr, int value) static int stl_cd1400updatereg(struct stlport *portp, int regnr, int value)
{ {
outb((regnr + portp->uartaddr), portp->ioaddr); outb(regnr + portp->uartaddr, portp->ioaddr);
if (inb(portp->ioaddr + EREG_DATA) != value) { if (inb(portp->ioaddr + EREG_DATA) != value) {
outb(value, portp->ioaddr + EREG_DATA); outb(value, portp->ioaddr + EREG_DATA);
return 1; return 1;
...@@ -2771,13 +2766,12 @@ static int stl_cd1400panelinit(struct stlbrd *brdp, struct stlpanel *panelp) ...@@ -2771,13 +2766,12 @@ static int stl_cd1400panelinit(struct stlbrd *brdp, struct stlpanel *panelp)
*/ */
chipmask = 0; chipmask = 0;
nrchips = panelp->nrports / CD1400_PORTS; nrchips = panelp->nrports / CD1400_PORTS;
for (i = 0; (i < nrchips); i++) { for (i = 0; i < nrchips; i++) {
if (brdp->brdtype == BRD_ECHPCI) { if (brdp->brdtype == BRD_ECHPCI) {
outb((panelp->pagenr + (i >> 1)), brdp->ioctrl); outb((panelp->pagenr + (i >> 1)), brdp->ioctrl);
ioaddr = panelp->iobase; ioaddr = panelp->iobase;
} else { } else
ioaddr = panelp->iobase + (EREG_BANKSIZE * (i >> 1)); ioaddr = panelp->iobase + (EREG_BANKSIZE * (i >> 1));
}
uartaddr = (i & 0x01) ? 0x080 : 0; uartaddr = (i & 0x01) ? 0x080 : 0;
outb((GFRCR + uartaddr), ioaddr); outb((GFRCR + uartaddr), ioaddr);
outb(0, (ioaddr + EREG_DATA)); outb(0, (ioaddr + EREG_DATA));
...@@ -2785,10 +2779,10 @@ static int stl_cd1400panelinit(struct stlbrd *brdp, struct stlpanel *panelp) ...@@ -2785,10 +2779,10 @@ static int stl_cd1400panelinit(struct stlbrd *brdp, struct stlpanel *panelp)
outb(CCR_RESETFULL, (ioaddr + EREG_DATA)); outb(CCR_RESETFULL, (ioaddr + EREG_DATA));
outb(CCR_RESETFULL, (ioaddr + EREG_DATA)); outb(CCR_RESETFULL, (ioaddr + EREG_DATA));
outb((GFRCR + uartaddr), ioaddr); outb((GFRCR + uartaddr), ioaddr);
for (j = 0; (j < CCR_MAXWAIT); j++) { for (j = 0; j < CCR_MAXWAIT; j++)
if ((gfrcr = inb(ioaddr + EREG_DATA)) != 0) if ((gfrcr = inb(ioaddr + EREG_DATA)) != 0)
break; break;
}
if ((j >= CCR_MAXWAIT) || (gfrcr < 0x40) || (gfrcr > 0x60)) { if ((j >= CCR_MAXWAIT) || (gfrcr < 0x40) || (gfrcr > 0x60)) {
printk("STALLION: cd1400 not responding, " printk("STALLION: cd1400 not responding, "
"brd=%d panel=%d chip=%d\n", "brd=%d panel=%d chip=%d\n",
...@@ -2846,11 +2840,9 @@ static void stl_cd1400ccrwait(struct stlport *portp) ...@@ -2846,11 +2840,9 @@ static void stl_cd1400ccrwait(struct stlport *portp)
{ {
int i; int i;
for (i = 0; (i < CCR_MAXWAIT); i++) { for (i = 0; i < CCR_MAXWAIT; i++)
if (stl_cd1400getreg(portp, CCR) == 0) { if (stl_cd1400getreg(portp, CCR) == 0)
return; return;
}
}
printk("STALLION: cd1400 not responding, port=%d panel=%d brd=%d\n", printk("STALLION: cd1400 not responding, port=%d panel=%d brd=%d\n",
portp->portnr, portp->panelnr, portp->brdnr); portp->portnr, portp->panelnr, portp->brdnr);
...@@ -2986,8 +2978,8 @@ static void stl_cd1400setport(struct stlport *portp, struct ktermios *tiosp) ...@@ -2986,8 +2978,8 @@ static void stl_cd1400setport(struct stlport *portp, struct ktermios *tiosp)
baudrate = STL_CD1400MAXBAUD; baudrate = STL_CD1400MAXBAUD;
if (baudrate > 0) { if (baudrate > 0) {
for (clk = 0; (clk < CD1400_NUMCLKS); clk++) { for (clk = 0; clk < CD1400_NUMCLKS; clk++) {
clkdiv = ((portp->clk / stl_cd1400clkdivs[clk]) / baudrate); clkdiv = (portp->clk / stl_cd1400clkdivs[clk]) / baudrate;
if (clkdiv < 0x100) if (clkdiv < 0x100)
break; break;
} }
...@@ -3002,9 +2994,8 @@ static void stl_cd1400setport(struct stlport *portp, struct ktermios *tiosp) ...@@ -3002,9 +2994,8 @@ static void stl_cd1400setport(struct stlport *portp, struct ktermios *tiosp)
mcor2 |= MCOR2_DCD; mcor2 |= MCOR2_DCD;
sreron |= SRER_MODEM; sreron |= SRER_MODEM;
portp->flags |= ASYNC_CHECK_CD; portp->flags |= ASYNC_CHECK_CD;
} else { } else
portp->flags &= ~ASYNC_CHECK_CD; portp->flags &= ~ASYNC_CHECK_CD;
}
/* /*
* Setup cd1400 enhanced modes if we can. In particular we want to * 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,18 +3639,16 @@ static void stl_cd1400rxisr(struct stlpanel *panelp, int ioaddr)
do_SAK(tty); do_SAK(tty);
BRDENABLE(portp->brdnr, portp->pagenr); BRDENABLE(portp->brdnr, portp->pagenr);
} }
} else if (status & ST_PARITY) { } else if (status & ST_PARITY)
status = TTY_PARITY; status = TTY_PARITY;
} else if (status & ST_FRAMING) { else if (status & ST_FRAMING)
status = TTY_FRAME; status = TTY_FRAME;
} else if(status & ST_OVERRUN) { else if(status & ST_OVERRUN)
status = TTY_OVERRUN; status = TTY_OVERRUN;
} else { else
status = 0; status = 0;
} } else
} else {
status = 0; status = 0;
}
tty_insert_flip_char(tty, ch, status); tty_insert_flip_char(tty, ch, status);
tty_schedule_flip(tty); tty_schedule_flip(tty);
} }
...@@ -3786,7 +3775,7 @@ static int stl_sc26198panelinit(struct stlbrd *brdp, struct stlpanel *panelp) ...@@ -3786,7 +3775,7 @@ static int stl_sc26198panelinit(struct stlbrd *brdp, struct stlpanel *panelp)
if (brdp->brdtype == BRD_ECHPCI) if (brdp->brdtype == BRD_ECHPCI)
outb(panelp->pagenr, brdp->ioctrl); outb(panelp->pagenr, brdp->ioctrl);
for (i = 0; (i < nrchips); i++) { for (i = 0; i < nrchips; i++) {
ioaddr = panelp->iobase + (i * 4); ioaddr = panelp->iobase + (i * 4);
outb(SCCR, (ioaddr + XP_ADDR)); outb(SCCR, (ioaddr + XP_ADDR));
outb(CR_RESETALL, (ioaddr + XP_DATA)); outb(CR_RESETALL, (ioaddr + XP_DATA));
...@@ -3906,9 +3895,8 @@ static void stl_sc26198setport(struct stlport *portp, struct ktermios *tiosp) ...@@ -3906,9 +3895,8 @@ static void stl_sc26198setport(struct stlport *portp, struct ktermios *tiosp)
mr1 |= (MR1_PARENB | MR1_PARODD); mr1 |= (MR1_PARENB | MR1_PARODD);
else else
mr1 |= (MR1_PARENB | MR1_PAREVEN); mr1 |= (MR1_PARENB | MR1_PAREVEN);
} else { } else
mr1 |= MR1_PARNONE; mr1 |= MR1_PARNONE;
}
mr1 |= MR1_ERRBLOCK; mr1 |= MR1_ERRBLOCK;
...@@ -3948,12 +3936,10 @@ static void stl_sc26198setport(struct stlport *portp, struct ktermios *tiosp) ...@@ -3948,12 +3936,10 @@ static void stl_sc26198setport(struct stlport *portp, struct ktermios *tiosp)
if (baudrate > STL_SC26198MAXBAUD) if (baudrate > STL_SC26198MAXBAUD)
baudrate = STL_SC26198MAXBAUD; baudrate = STL_SC26198MAXBAUD;
if (baudrate > 0) { if (baudrate > 0)
for (clk = 0; (clk < SC26198_NRBAUDS); clk++) { for (clk = 0; clk < SC26198_NRBAUDS; clk++)
if (baudrate <= sc26198_baudtable[clk]) if (baudrate <= sc26198_baudtable[clk])
break; break;
}
}
/* /*
* Check what form of modem signaling is required and set it up. * 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,9 +3961,9 @@ static void stl_sc26198setport(struct stlport *portp, struct ktermios *tiosp)
if (tiosp->c_iflag & IXON) { if (tiosp->c_iflag & IXON) {
mr0 |= MR0_SWFTX | MR0_SWFT; mr0 |= MR0_SWFTX | MR0_SWFT;
imron |= IR_XONXOFF; imron |= IR_XONXOFF;
} else { } else
imroff |= IR_XONXOFF; imroff |= IR_XONXOFF;
}
if (tiosp->c_iflag & IXOFF) if (tiosp->c_iflag & IXOFF)
mr0 |= MR0_SWFRX; mr0 |= MR0_SWFRX;
...@@ -4188,9 +4174,9 @@ static void stl_sc26198sendbreak(struct stlport *portp, int len) ...@@ -4188,9 +4174,9 @@ static void stl_sc26198sendbreak(struct stlport *portp, int len)
if (len == 1) { if (len == 1) {
stl_sc26198setreg(portp, SCCR, CR_TXSTARTBREAK); stl_sc26198setreg(portp, SCCR, CR_TXSTARTBREAK);
portp->stats.txbreaks++; portp->stats.txbreaks++;
} else { } else
stl_sc26198setreg(portp, SCCR, CR_TXSTOPBREAK); stl_sc26198setreg(portp, SCCR, CR_TXSTOPBREAK);
}
BRDDISABLE(portp->brdnr); BRDDISABLE(portp->brdnr);
spin_unlock_irqrestore(&brd_lock, flags); spin_unlock_irqrestore(&brd_lock, flags);
} }
...@@ -4374,7 +4360,7 @@ static void stl_sc26198wait(struct stlport *portp) ...@@ -4374,7 +4360,7 @@ static void stl_sc26198wait(struct stlport *portp)
if (portp == NULL) if (portp == NULL)
return; return;
for (i = 0; (i < 20); i++) for (i = 0; i < 20; i++)
stl_sc26198getglobreg(portp, TSTR); stl_sc26198getglobreg(portp, TSTR);
} }
...@@ -4583,18 +4569,16 @@ static void stl_sc26198rxbadch(struct stlport *portp, unsigned char status, char ...@@ -4583,18 +4569,16 @@ static void stl_sc26198rxbadch(struct stlport *portp, unsigned char status, char
do_SAK(tty); do_SAK(tty);
BRDENABLE(portp->brdnr, portp->pagenr); BRDENABLE(portp->brdnr, portp->pagenr);
} }
} else if (status & SR_RXPARITY) { } else if (status & SR_RXPARITY)
status = TTY_PARITY; status = TTY_PARITY;
} else if (status & SR_RXFRAMING) { else if (status & SR_RXFRAMING)
status = TTY_FRAME; status = TTY_FRAME;
} else if(status & SR_RXOVERRUN) { else if(status & SR_RXOVERRUN)
status = TTY_OVERRUN; status = TTY_OVERRUN;
} else { else
status = 0; status = 0;
} } else
} else {
status = 0; status = 0;
}
tty_insert_flip_char(tty, ch, status); tty_insert_flip_char(tty, ch, status);
tty_schedule_flip(tty); tty_schedule_flip(tty);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment