aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2006-12-08 05:38:42 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-08 11:28:55 -0500
commit96b066b85c8e5b28fa7f25a7f0644f70f46b8881 (patch)
treefa6fe7c55f54d36a74babf2753ce7592627cd6c9
parent40e82652128f67ffc2d8117e186736a92a15d64c (diff)
[PATCH] Char: stallion, remove many prototypes
Many prototypes are useless, since functions are declared before they are called. Also some code was easy to move to resolve this dependency and delete prototypes. 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>
-rw-r--r--drivers/char/stallion.c222
1 files changed, 91 insertions, 131 deletions
diff --git a/drivers/char/stallion.c b/drivers/char/stallion.c
index c476da100b00..a547c0c8fb2a 100644
--- a/drivers/char/stallion.c
+++ b/drivers/char/stallion.c
@@ -450,51 +450,11 @@ static unsigned int stl_baudrates[] = {
450 * Declare all those functions in this driver! 450 * Declare all those functions in this driver!
451 */ 451 */
452 452
453static void stl_argbrds(void);
454static int stl_parsebrd(struct stlconf *confp, char **argp);
455
456static unsigned long stl_atol(char *str);
457
458static int stl_open(struct tty_struct *tty, struct file *filp);
459static void stl_close(struct tty_struct *tty, struct file *filp);
460static int stl_write(struct tty_struct *tty, const unsigned char *buf, int count);
461static void stl_putchar(struct tty_struct *tty, unsigned char ch);
462static void stl_flushchars(struct tty_struct *tty);
463static int stl_writeroom(struct tty_struct *tty);
464static int stl_charsinbuffer(struct tty_struct *tty);
465static int stl_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg);
466static void stl_settermios(struct tty_struct *tty, struct termios *old);
467static void stl_throttle(struct tty_struct *tty);
468static void stl_unthrottle(struct tty_struct *tty);
469static void stl_stop(struct tty_struct *tty);
470static void stl_start(struct tty_struct *tty);
471static void stl_flushbuffer(struct tty_struct *tty);
472static void stl_breakctl(struct tty_struct *tty, int state);
473static void stl_waituntilsent(struct tty_struct *tty, int timeout);
474static void stl_sendxchar(struct tty_struct *tty, char ch);
475static void stl_hangup(struct tty_struct *tty);
476static int stl_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, unsigned long arg); 453static int stl_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, unsigned long arg);
477static int stl_portinfo(struct stlport *portp, int portnr, char *pos);
478static int stl_readproc(char *page, char **start, off_t off, int count, int *eof, void *data);
479
480static int stl_brdinit(struct stlbrd *brdp); 454static int stl_brdinit(struct stlbrd *brdp);
481static int stl_initports(struct stlbrd *brdp, struct stlpanel *panelp);
482static int stl_getserial(struct stlport *portp, struct serial_struct __user *sp);
483static int stl_setserial(struct stlport *portp, struct serial_struct __user *sp);
484static int stl_getbrdstats(combrd_t __user *bp);
485static int stl_getportstats(struct stlport *portp, comstats_t __user *cp); 455static int stl_getportstats(struct stlport *portp, comstats_t __user *cp);
486static int stl_clrportstats(struct stlport *portp, comstats_t __user *cp); 456static int stl_clrportstats(struct stlport *portp, comstats_t __user *cp);
487static int stl_getportstruct(struct stlport __user *arg);
488static int stl_getbrdstruct(struct stlbrd __user *arg);
489static int stl_waitcarrier(struct stlport *portp, struct file *filp); 457static int stl_waitcarrier(struct stlport *portp, struct file *filp);
490static int stl_eiointr(struct stlbrd *brdp);
491static int stl_echatintr(struct stlbrd *brdp);
492static int stl_echmcaintr(struct stlbrd *brdp);
493static int stl_echpciintr(struct stlbrd *brdp);
494static int stl_echpci64intr(struct stlbrd *brdp);
495static void stl_offintr(struct work_struct *);
496static struct stlbrd *stl_allocbrd(void);
497static struct stlport *stl_getport(int brdnr, int panelnr, int portnr);
498 458
499/* 459/*
500 * CD1400 uart specific handling functions. 460 * CD1400 uart specific handling functions.
@@ -700,31 +660,6 @@ static struct class *stallion_class;
700 * Check for any arguments passed in on the module load command line. 660 * Check for any arguments passed in on the module load command line.
701 */ 661 */
702 662
703static void __init stl_argbrds(void)
704{
705 struct stlconf conf;
706 struct stlbrd *brdp;
707 int i;
708
709 pr_debug("stl_argbrds()\n");
710
711 for (i = stl_nrbrds; (i < stl_nargs); i++) {
712 memset(&conf, 0, sizeof(conf));
713 if (stl_parsebrd(&conf, stl_brdsp[i]) == 0)
714 continue;
715 if ((brdp = stl_allocbrd()) == NULL)
716 continue;
717 stl_nrbrds = i + 1;
718 brdp->brdnr = i;
719 brdp->brdtype = conf.brdtype;
720 brdp->ioaddr1 = conf.ioaddr1;
721 brdp->ioaddr2 = conf.ioaddr2;
722 brdp->irq = conf.irq;
723 brdp->irqtype = conf.irqtype;
724 stl_brdinit(brdp);
725 }
726}
727
728/*****************************************************************************/ 663/*****************************************************************************/
729 664
730/* 665/*
@@ -826,6 +761,31 @@ static struct stlbrd *stl_allocbrd(void)
826 return brdp; 761 return brdp;
827} 762}
828 763
764static void __init stl_argbrds(void)
765{
766 struct stlconf conf;
767 struct stlbrd *brdp;
768 int i;
769
770 pr_debug("stl_argbrds()\n");
771
772 for (i = stl_nrbrds; (i < stl_nargs); i++) {
773 memset(&conf, 0, sizeof(conf));
774 if (stl_parsebrd(&conf, stl_brdsp[i]) == 0)
775 continue;
776 if ((brdp = stl_allocbrd()) == NULL)
777 continue;
778 stl_nrbrds = i + 1;
779 brdp->brdnr = i;
780 brdp->brdtype = conf.brdtype;
781 brdp->ioaddr1 = conf.ioaddr1;
782 brdp->ioaddr2 = conf.ioaddr2;
783 brdp->irq = conf.irq;
784 brdp->irqtype = conf.irqtype;
785 stl_brdinit(brdp);
786 }
787}
788
829/*****************************************************************************/ 789/*****************************************************************************/
830 790
831static int stl_open(struct tty_struct *tty, struct file *filp) 791static int stl_open(struct tty_struct *tty, struct file *filp)
@@ -972,6 +932,52 @@ static int stl_waitcarrier(struct stlport *portp, struct file *filp)
972 932
973/*****************************************************************************/ 933/*****************************************************************************/
974 934
935static void stl_flushbuffer(struct tty_struct *tty)
936{
937 struct stlport *portp;
938
939 pr_debug("stl_flushbuffer(tty=%p)\n", tty);
940
941 if (tty == NULL)
942 return;
943 portp = tty->driver_data;
944 if (portp == NULL)
945 return;
946
947 stl_flush(portp);
948 tty_wakeup(tty);
949}
950
951/*****************************************************************************/
952
953static void stl_waituntilsent(struct tty_struct *tty, int timeout)
954{
955 struct stlport *portp;
956 unsigned long tend;
957
958 pr_debug("stl_waituntilsent(tty=%p,timeout=%d)\n", tty, timeout);
959
960 if (tty == NULL)
961 return;
962 portp = tty->driver_data;
963 if (portp == NULL)
964 return;
965
966 if (timeout == 0)
967 timeout = HZ;
968 tend = jiffies + timeout;
969
970 while (stl_datastate(portp)) {
971 if (signal_pending(current))
972 break;
973 msleep_interruptible(20);
974 if (time_after_eq(jiffies, tend))
975 break;
976 }
977}
978
979/*****************************************************************************/
980
975static void stl_close(struct tty_struct *tty, struct file *filp) 981static void stl_close(struct tty_struct *tty, struct file *filp)
976{ 982{
977 struct stlport *portp; 983 struct stlport *portp;
@@ -1401,6 +1407,26 @@ static int stl_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd
1401 1407
1402/*****************************************************************************/ 1408/*****************************************************************************/
1403 1409
1410/*
1411 * Start the transmitter again. Just turn TX interrupts back on.
1412 */
1413
1414static void stl_start(struct tty_struct *tty)
1415{
1416 struct stlport *portp;
1417
1418 pr_debug("stl_start(tty=%p)\n", tty);
1419
1420 if (tty == NULL)
1421 return;
1422 portp = tty->driver_data;
1423 if (portp == NULL)
1424 return;
1425 stl_startrxtx(portp, -1, 1);
1426}
1427
1428/*****************************************************************************/
1429
1404static void stl_settermios(struct tty_struct *tty, struct termios *old) 1430static void stl_settermios(struct tty_struct *tty, struct termios *old)
1405{ 1431{
1406 struct stlport *portp; 1432 struct stlport *portp;
@@ -1495,26 +1521,6 @@ static void stl_stop(struct tty_struct *tty)
1495/*****************************************************************************/ 1521/*****************************************************************************/
1496 1522
1497/* 1523/*
1498 * Start the transmitter again. Just turn TX interrupts back on.
1499 */
1500
1501static void stl_start(struct tty_struct *tty)
1502{
1503 struct stlport *portp;
1504
1505 pr_debug("stl_start(tty=%p)\n", tty);
1506
1507 if (tty == NULL)
1508 return;
1509 portp = tty->driver_data;
1510 if (portp == NULL)
1511 return;
1512 stl_startrxtx(portp, -1, 1);
1513}
1514
1515/*****************************************************************************/
1516
1517/*
1518 * Hangup this port. This is pretty much like closing the port, only 1524 * Hangup this port. This is pretty much like closing the port, only
1519 * a little more brutal. No waiting for data to drain. Shutdown the 1525 * a little more brutal. No waiting for data to drain. Shutdown the
1520 * port and maybe drop signals. 1526 * port and maybe drop signals.
@@ -1554,24 +1560,6 @@ static void stl_hangup(struct tty_struct *tty)
1554 1560
1555/*****************************************************************************/ 1561/*****************************************************************************/
1556 1562
1557static void stl_flushbuffer(struct tty_struct *tty)
1558{
1559 struct stlport *portp;
1560
1561 pr_debug("stl_flushbuffer(tty=%p)\n", tty);
1562
1563 if (tty == NULL)
1564 return;
1565 portp = tty->driver_data;
1566 if (portp == NULL)
1567 return;
1568
1569 stl_flush(portp);
1570 tty_wakeup(tty);
1571}
1572
1573/*****************************************************************************/
1574
1575static void stl_breakctl(struct tty_struct *tty, int state) 1563static void stl_breakctl(struct tty_struct *tty, int state)
1576{ 1564{
1577 struct stlport *portp; 1565 struct stlport *portp;
@@ -1589,34 +1577,6 @@ static void stl_breakctl(struct tty_struct *tty, int state)
1589 1577
1590/*****************************************************************************/ 1578/*****************************************************************************/
1591 1579
1592static void stl_waituntilsent(struct tty_struct *tty, int timeout)
1593{
1594 struct stlport *portp;
1595 unsigned long tend;
1596
1597 pr_debug("stl_waituntilsent(tty=%p,timeout=%d)\n", tty, timeout);
1598
1599 if (tty == NULL)
1600 return;
1601 portp = tty->driver_data;
1602 if (portp == NULL)
1603 return;
1604
1605 if (timeout == 0)
1606 timeout = HZ;
1607 tend = jiffies + timeout;
1608
1609 while (stl_datastate(portp)) {
1610 if (signal_pending(current))
1611 break;
1612 msleep_interruptible(20);
1613 if (time_after_eq(jiffies, tend))
1614 break;
1615 }
1616}
1617
1618/*****************************************************************************/
1619
1620static void stl_sendxchar(struct tty_struct *tty, char ch) 1580static void stl_sendxchar(struct tty_struct *tty, char ch)
1621{ 1581{
1622 struct stlport *portp; 1582 struct stlport *portp;