aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/istallion.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/istallion.c')
-rw-r--r--drivers/char/istallion.c221
1 files changed, 70 insertions, 151 deletions
diff --git a/drivers/char/istallion.c b/drivers/char/istallion.c
index 4b10770fa937..5c3dc6b8411c 100644
--- a/drivers/char/istallion.c
+++ b/drivers/char/istallion.c
@@ -151,7 +151,7 @@ static char *stli_drvversion = "5.6.0";
151static char *stli_serialname = "ttyE"; 151static char *stli_serialname = "ttyE";
152 152
153static struct tty_driver *stli_serial; 153static struct tty_driver *stli_serial;
154 154static const struct tty_port_operations stli_port_ops;
155 155
156#define STLI_TXBUFSIZE 4096 156#define STLI_TXBUFSIZE 4096
157 157
@@ -626,8 +626,6 @@ static int stli_hostcmd(struct stlibrd *brdp, struct stliport *portp);
626static int stli_initopen(struct tty_struct *tty, struct stlibrd *brdp, struct stliport *portp); 626static int stli_initopen(struct tty_struct *tty, struct stlibrd *brdp, struct stliport *portp);
627static int stli_rawopen(struct stlibrd *brdp, struct stliport *portp, unsigned long arg, int wait); 627static int stli_rawopen(struct stlibrd *brdp, struct stliport *portp, unsigned long arg, int wait);
628static int stli_rawclose(struct stlibrd *brdp, struct stliport *portp, unsigned long arg, int wait); 628static int stli_rawclose(struct stlibrd *brdp, struct stliport *portp, unsigned long arg, int wait);
629static int stli_waitcarrier(struct tty_struct *tty, struct stlibrd *brdp,
630 struct stliport *portp, struct file *filp);
631static int stli_setport(struct tty_struct *tty); 629static int stli_setport(struct tty_struct *tty);
632static int stli_cmdwait(struct stlibrd *brdp, struct stliport *portp, unsigned long cmd, void *arg, int size, int copyback); 630static int stli_cmdwait(struct stlibrd *brdp, struct stliport *portp, unsigned long cmd, void *arg, int size, int copyback);
633static void stli_sendcmd(struct stlibrd *brdp, struct stliport *portp, unsigned long cmd, void *arg, int size, int copyback); 631static void stli_sendcmd(struct stlibrd *brdp, struct stliport *portp, unsigned long cmd, void *arg, int size, int copyback);
@@ -769,7 +767,7 @@ static int stli_parsebrd(struct stlconf *confp, char **argp)
769 break; 767 break;
770 } 768 }
771 if (i == ARRAY_SIZE(stli_brdstr)) { 769 if (i == ARRAY_SIZE(stli_brdstr)) {
772 printk("STALLION: unknown board name, %s?\n", argp[0]); 770 printk(KERN_WARNING "istallion: unknown board name, %s?\n", argp[0]);
773 return 0; 771 return 0;
774 } 772 }
775 773
@@ -787,6 +785,7 @@ static int stli_open(struct tty_struct *tty, struct file *filp)
787{ 785{
788 struct stlibrd *brdp; 786 struct stlibrd *brdp;
789 struct stliport *portp; 787 struct stliport *portp;
788 struct tty_port *port;
790 unsigned int minordev, brdnr, portnr; 789 unsigned int minordev, brdnr, portnr;
791 int rc; 790 int rc;
792 791
@@ -808,30 +807,19 @@ static int stli_open(struct tty_struct *tty, struct file *filp)
808 return -ENODEV; 807 return -ENODEV;
809 if (portp->devnr < 1) 808 if (portp->devnr < 1)
810 return -ENODEV; 809 return -ENODEV;
811 810 port = &portp->port;
812
813/*
814 * Check if this port is in the middle of closing. If so then wait
815 * until it is closed then return error status based on flag settings.
816 * The sleep here does not need interrupt protection since the wakeup
817 * for it is done with the same context.
818 */
819 if (portp->port.flags & ASYNC_CLOSING) {
820 interruptible_sleep_on(&portp->port.close_wait);
821 if (portp->port.flags & ASYNC_HUP_NOTIFY)
822 return -EAGAIN;
823 return -ERESTARTSYS;
824 }
825 811
826/* 812/*
827 * On the first open of the device setup the port hardware, and 813 * On the first open of the device setup the port hardware, and
828 * initialize the per port data structure. Since initializing the port 814 * initialize the per port data structure. Since initializing the port
829 * requires several commands to the board we will need to wait for any 815 * requires several commands to the board we will need to wait for any
830 * other open that is already initializing the port. 816 * other open that is already initializing the port.
817 *
818 * Review - locking
831 */ 819 */
832 tty_port_tty_set(&portp->port, tty); 820 tty_port_tty_set(port, tty);
833 tty->driver_data = portp; 821 tty->driver_data = portp;
834 portp->port.count++; 822 port->count++;
835 823
836 wait_event_interruptible(portp->raw_wait, 824 wait_event_interruptible(portp->raw_wait,
837 !test_bit(ST_INITIALIZING, &portp->state)); 825 !test_bit(ST_INITIALIZING, &portp->state));
@@ -841,7 +829,8 @@ static int stli_open(struct tty_struct *tty, struct file *filp)
841 if ((portp->port.flags & ASYNC_INITIALIZED) == 0) { 829 if ((portp->port.flags & ASYNC_INITIALIZED) == 0) {
842 set_bit(ST_INITIALIZING, &portp->state); 830 set_bit(ST_INITIALIZING, &portp->state);
843 if ((rc = stli_initopen(tty, brdp, portp)) >= 0) { 831 if ((rc = stli_initopen(tty, brdp, portp)) >= 0) {
844 portp->port.flags |= ASYNC_INITIALIZED; 832 /* Locking */
833 port->flags |= ASYNC_INITIALIZED;
845 clear_bit(TTY_IO_ERROR, &tty->flags); 834 clear_bit(TTY_IO_ERROR, &tty->flags);
846 } 835 }
847 clear_bit(ST_INITIALIZING, &portp->state); 836 clear_bit(ST_INITIALIZING, &portp->state);
@@ -849,31 +838,7 @@ static int stli_open(struct tty_struct *tty, struct file *filp)
849 if (rc < 0) 838 if (rc < 0)
850 return rc; 839 return rc;
851 } 840 }
852 841 return tty_port_block_til_ready(&portp->port, tty, filp);
853/*
854 * Check if this port is in the middle of closing. If so then wait
855 * until it is closed then return error status, based on flag settings.
856 * The sleep here does not need interrupt protection since the wakeup
857 * for it is done with the same context.
858 */
859 if (portp->port.flags & ASYNC_CLOSING) {
860 interruptible_sleep_on(&portp->port.close_wait);
861 if (portp->port.flags & ASYNC_HUP_NOTIFY)
862 return -EAGAIN;
863 return -ERESTARTSYS;
864 }
865
866/*
867 * Based on type of open being done check if it can overlap with any
868 * previous opens still in effect. If we are a normal serial device
869 * then also we might have to wait for carrier.
870 */
871 if (!(filp->f_flags & O_NONBLOCK)) {
872 if ((rc = stli_waitcarrier(tty, brdp, portp, filp)) != 0)
873 return rc;
874 }
875 portp->port.flags |= ASYNC_NORMAL_ACTIVE;
876 return 0;
877} 842}
878 843
879/*****************************************************************************/ 844/*****************************************************************************/
@@ -882,25 +847,16 @@ static void stli_close(struct tty_struct *tty, struct file *filp)
882{ 847{
883 struct stlibrd *brdp; 848 struct stlibrd *brdp;
884 struct stliport *portp; 849 struct stliport *portp;
850 struct tty_port *port;
885 unsigned long flags; 851 unsigned long flags;
886 852
887 portp = tty->driver_data; 853 portp = tty->driver_data;
888 if (portp == NULL) 854 if (portp == NULL)
889 return; 855 return;
856 port = &portp->port;
890 857
891 spin_lock_irqsave(&stli_lock, flags); 858 if (tty_port_close_start(port, tty, filp) == 0)
892 if (tty_hung_up_p(filp)) {
893 spin_unlock_irqrestore(&stli_lock, flags);
894 return;
895 }
896 if ((tty->count == 1) && (portp->port.count != 1))
897 portp->port.count = 1;
898 if (portp->port.count-- > 1) {
899 spin_unlock_irqrestore(&stli_lock, flags);
900 return; 859 return;
901 }
902
903 portp->port.flags |= ASYNC_CLOSING;
904 860
905/* 861/*
906 * May want to wait for data to drain before closing. The BUSY flag 862 * May want to wait for data to drain before closing. The BUSY flag
@@ -908,15 +864,19 @@ static void stli_close(struct tty_struct *tty, struct file *filp)
908 * updated by messages from the slave - indicating when all chars 864 * updated by messages from the slave - indicating when all chars
909 * really have drained. 865 * really have drained.
910 */ 866 */
867 spin_lock_irqsave(&stli_lock, flags);
911 if (tty == stli_txcooktty) 868 if (tty == stli_txcooktty)
912 stli_flushchars(tty); 869 stli_flushchars(tty);
913 tty->closing = 1;
914 spin_unlock_irqrestore(&stli_lock, flags); 870 spin_unlock_irqrestore(&stli_lock, flags);
915 871
872 /* We end up doing this twice for the moment. This needs looking at
873 eventually. Note we still use portp->closing_wait as a result */
916 if (portp->closing_wait != ASYNC_CLOSING_WAIT_NONE) 874 if (portp->closing_wait != ASYNC_CLOSING_WAIT_NONE)
917 tty_wait_until_sent(tty, portp->closing_wait); 875 tty_wait_until_sent(tty, portp->closing_wait);
918 876
919 portp->port.flags &= ~ASYNC_INITIALIZED; 877 /* FIXME: port locking here needs attending to */
878 port->flags &= ~ASYNC_INITIALIZED;
879
920 brdp = stli_brds[portp->brdnr]; 880 brdp = stli_brds[portp->brdnr];
921 stli_rawclose(brdp, portp, 0, 0); 881 stli_rawclose(brdp, portp, 0, 0);
922 if (tty->termios->c_cflag & HUPCL) { 882 if (tty->termios->c_cflag & HUPCL) {
@@ -934,17 +894,8 @@ static void stli_close(struct tty_struct *tty, struct file *filp)
934 set_bit(ST_DOFLUSHRX, &portp->state); 894 set_bit(ST_DOFLUSHRX, &portp->state);
935 stli_flushbuffer(tty); 895 stli_flushbuffer(tty);
936 896
937 tty->closing = 0; 897 tty_port_close_end(port, tty);
938 tty_port_tty_set(&portp->port, NULL); 898 tty_port_tty_set(port, NULL);
939
940 if (portp->openwaitcnt) {
941 if (portp->close_delay)
942 msleep_interruptible(jiffies_to_msecs(portp->close_delay));
943 wake_up_interruptible(&portp->port.open_wait);
944 }
945
946 portp->port.flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);
947 wake_up_interruptible(&portp->port.close_wait);
948} 899}
949 900
950/*****************************************************************************/ 901/*****************************************************************************/
@@ -1183,62 +1134,23 @@ static int stli_setport(struct tty_struct *tty)
1183 1134
1184/*****************************************************************************/ 1135/*****************************************************************************/
1185 1136
1186/* 1137static int stli_carrier_raised(struct tty_port *port)
1187 * Possibly need to wait for carrier (DCD signal) to come high. Say
1188 * maybe because if we are clocal then we don't need to wait...
1189 */
1190
1191static int stli_waitcarrier(struct tty_struct *tty, struct stlibrd *brdp,
1192 struct stliport *portp, struct file *filp)
1193{ 1138{
1194 unsigned long flags; 1139 struct stliport *portp = container_of(port, struct stliport, port);
1195 int rc, doclocal; 1140 return (portp->sigs & TIOCM_CD) ? 1 : 0;
1196 1141}
1197 rc = 0;
1198 doclocal = 0;
1199
1200 if (tty->termios->c_cflag & CLOCAL)
1201 doclocal++;
1202
1203 spin_lock_irqsave(&stli_lock, flags);
1204 portp->openwaitcnt++;
1205 if (! tty_hung_up_p(filp))
1206 portp->port.count--;
1207 spin_unlock_irqrestore(&stli_lock, flags);
1208
1209 for (;;) {
1210 stli_mkasysigs(&portp->asig, 1, 1);
1211 if ((rc = stli_cmdwait(brdp, portp, A_SETSIGNALS,
1212 &portp->asig, sizeof(asysigs_t), 0)) < 0)
1213 break;
1214 if (tty_hung_up_p(filp) ||
1215 ((portp->port.flags & ASYNC_INITIALIZED) == 0)) {
1216 if (portp->port.flags & ASYNC_HUP_NOTIFY)
1217 rc = -EBUSY;
1218 else
1219 rc = -ERESTARTSYS;
1220 break;
1221 }
1222 if (((portp->port.flags & ASYNC_CLOSING) == 0) &&
1223 (doclocal || (portp->sigs & TIOCM_CD))) {
1224 break;
1225 }
1226 if (signal_pending(current)) {
1227 rc = -ERESTARTSYS;
1228 break;
1229 }
1230 interruptible_sleep_on(&portp->port.open_wait);
1231 }
1232
1233 spin_lock_irqsave(&stli_lock, flags);
1234 if (! tty_hung_up_p(filp))
1235 portp->port.count++;
1236 portp->openwaitcnt--;
1237 spin_unlock_irqrestore(&stli_lock, flags);
1238 1142
1239 return rc; 1143static void stli_raise_dtr_rts(struct tty_port *port)
1144{
1145 struct stliport *portp = container_of(port, struct stliport, port);
1146 struct stlibrd *brdp = stli_brds[portp->brdnr];
1147 stli_mkasysigs(&portp->asig, 1, 1);
1148 if (stli_cmdwait(brdp, portp, A_SETSIGNALS, &portp->asig,
1149 sizeof(asysigs_t), 0) < 0)
1150 printk(KERN_WARNING "istallion: dtr raise failed.\n");
1240} 1151}
1241 1152
1153
1242/*****************************************************************************/ 1154/*****************************************************************************/
1243 1155
1244/* 1156/*
@@ -1550,7 +1462,7 @@ static int stli_getserial(struct stliport *portp, struct serial_struct __user *s
1550 sio.irq = 0; 1462 sio.irq = 0;
1551 sio.flags = portp->port.flags; 1463 sio.flags = portp->port.flags;
1552 sio.baud_base = portp->baud_base; 1464 sio.baud_base = portp->baud_base;
1553 sio.close_delay = portp->close_delay; 1465 sio.close_delay = portp->port.close_delay;
1554 sio.closing_wait = portp->closing_wait; 1466 sio.closing_wait = portp->closing_wait;
1555 sio.custom_divisor = portp->custom_divisor; 1467 sio.custom_divisor = portp->custom_divisor;
1556 sio.xmit_fifo_size = 0; 1468 sio.xmit_fifo_size = 0;
@@ -1582,7 +1494,7 @@ static int stli_setserial(struct tty_struct *tty, struct serial_struct __user *s
1582 return -EFAULT; 1494 return -EFAULT;
1583 if (!capable(CAP_SYS_ADMIN)) { 1495 if (!capable(CAP_SYS_ADMIN)) {
1584 if ((sio.baud_base != portp->baud_base) || 1496 if ((sio.baud_base != portp->baud_base) ||
1585 (sio.close_delay != portp->close_delay) || 1497 (sio.close_delay != portp->port.close_delay) ||
1586 ((sio.flags & ~ASYNC_USR_MASK) != 1498 ((sio.flags & ~ASYNC_USR_MASK) !=
1587 (portp->port.flags & ~ASYNC_USR_MASK))) 1499 (portp->port.flags & ~ASYNC_USR_MASK)))
1588 return -EPERM; 1500 return -EPERM;
@@ -1591,7 +1503,7 @@ static int stli_setserial(struct tty_struct *tty, struct serial_struct __user *s
1591 portp->port.flags = (portp->port.flags & ~ASYNC_USR_MASK) | 1503 portp->port.flags = (portp->port.flags & ~ASYNC_USR_MASK) |
1592 (sio.flags & ASYNC_USR_MASK); 1504 (sio.flags & ASYNC_USR_MASK);
1593 portp->baud_base = sio.baud_base; 1505 portp->baud_base = sio.baud_base;
1594 portp->close_delay = sio.close_delay; 1506 portp->port.close_delay = sio.close_delay;
1595 portp->closing_wait = sio.closing_wait; 1507 portp->closing_wait = sio.closing_wait;
1596 portp->custom_divisor = sio.custom_divisor; 1508 portp->custom_divisor = sio.custom_divisor;
1597 1509
@@ -1821,6 +1733,7 @@ static void stli_hangup(struct tty_struct *tty)
1821{ 1733{
1822 struct stliport *portp; 1734 struct stliport *portp;
1823 struct stlibrd *brdp; 1735 struct stlibrd *brdp;
1736 struct tty_port *port;
1824 unsigned long flags; 1737 unsigned long flags;
1825 1738
1826 portp = tty->driver_data; 1739 portp = tty->driver_data;
@@ -1831,8 +1744,11 @@ static void stli_hangup(struct tty_struct *tty)
1831 brdp = stli_brds[portp->brdnr]; 1744 brdp = stli_brds[portp->brdnr];
1832 if (brdp == NULL) 1745 if (brdp == NULL)
1833 return; 1746 return;
1747 port = &portp->port;
1834 1748
1835 portp->port.flags &= ~ASYNC_INITIALIZED; 1749 spin_lock_irqsave(&port->lock, flags);
1750 port->flags &= ~ASYNC_INITIALIZED;
1751 spin_unlock_irqrestore(&port->lock, flags);
1836 1752
1837 if (!test_bit(ST_CLOSING, &portp->state)) 1753 if (!test_bit(ST_CLOSING, &portp->state))
1838 stli_rawclose(brdp, portp, 0, 0); 1754 stli_rawclose(brdp, portp, 0, 0);
@@ -1853,12 +1769,9 @@ static void stli_hangup(struct tty_struct *tty)
1853 clear_bit(ST_TXBUSY, &portp->state); 1769 clear_bit(ST_TXBUSY, &portp->state);
1854 clear_bit(ST_RXSTOP, &portp->state); 1770 clear_bit(ST_RXSTOP, &portp->state);
1855 set_bit(TTY_IO_ERROR, &tty->flags); 1771 set_bit(TTY_IO_ERROR, &tty->flags);
1856 tty_port_tty_set(&portp->port, NULL);
1857 portp->port.flags &= ~ASYNC_NORMAL_ACTIVE;
1858 portp->port.count = 0;
1859 spin_unlock_irqrestore(&stli_lock, flags); 1772 spin_unlock_irqrestore(&stli_lock, flags);
1860 1773
1861 wake_up_interruptible(&portp->port.open_wait); 1774 tty_port_hangup(port);
1862} 1775}
1863 1776
1864/*****************************************************************************/ 1777/*****************************************************************************/
@@ -2132,7 +2045,7 @@ static void __stli_sendcmd(struct stlibrd *brdp, struct stliport *portp, unsigne
2132 unsigned char __iomem *bits; 2045 unsigned char __iomem *bits;
2133 2046
2134 if (test_bit(ST_CMDING, &portp->state)) { 2047 if (test_bit(ST_CMDING, &portp->state)) {
2135 printk(KERN_ERR "STALLION: command already busy, cmd=%x!\n", 2048 printk(KERN_ERR "istallion: command already busy, cmd=%x!\n",
2136 (int) cmd); 2049 (int) cmd);
2137 return; 2050 return;
2138 } 2051 }
@@ -2692,16 +2605,17 @@ static int stli_initports(struct stlibrd *brdp)
2692 for (i = 0, panelnr = 0, panelport = 0; (i < brdp->nrports); i++) { 2605 for (i = 0, panelnr = 0, panelport = 0; (i < brdp->nrports); i++) {
2693 portp = kzalloc(sizeof(struct stliport), GFP_KERNEL); 2606 portp = kzalloc(sizeof(struct stliport), GFP_KERNEL);
2694 if (!portp) { 2607 if (!portp) {
2695 printk("STALLION: failed to allocate port structure\n"); 2608 printk(KERN_WARNING "istallion: failed to allocate port structure\n");
2696 continue; 2609 continue;
2697 } 2610 }
2698 tty_port_init(&portp->port); 2611 tty_port_init(&portp->port);
2612 portp->port.ops = &stli_port_ops;
2699 portp->magic = STLI_PORTMAGIC; 2613 portp->magic = STLI_PORTMAGIC;
2700 portp->portnr = i; 2614 portp->portnr = i;
2701 portp->brdnr = brdp->brdnr; 2615 portp->brdnr = brdp->brdnr;
2702 portp->panelnr = panelnr; 2616 portp->panelnr = panelnr;
2703 portp->baud_base = STL_BAUDBASE; 2617 portp->baud_base = STL_BAUDBASE;
2704 portp->close_delay = STL_CLOSEDELAY; 2618 portp->port.close_delay = STL_CLOSEDELAY;
2705 portp->closing_wait = 30 * HZ; 2619 portp->closing_wait = 30 * HZ;
2706 init_waitqueue_head(&portp->port.open_wait); 2620 init_waitqueue_head(&portp->port.open_wait);
2707 init_waitqueue_head(&portp->port.close_wait); 2621 init_waitqueue_head(&portp->port.close_wait);
@@ -2758,7 +2672,7 @@ static void __iomem *stli_ecpgetmemptr(struct stlibrd *brdp, unsigned long offse
2758 unsigned char val; 2672 unsigned char val;
2759 2673
2760 if (offset > brdp->memsize) { 2674 if (offset > brdp->memsize) {
2761 printk(KERN_ERR "STALLION: shared memory pointer=%x out of " 2675 printk(KERN_ERR "istallion: shared memory pointer=%x out of "
2762 "range at line=%d(%d), brd=%d\n", 2676 "range at line=%d(%d), brd=%d\n",
2763 (int) offset, line, __LINE__, brdp->brdnr); 2677 (int) offset, line, __LINE__, brdp->brdnr);
2764 ptr = NULL; 2678 ptr = NULL;
@@ -2832,7 +2746,7 @@ static void __iomem *stli_ecpeigetmemptr(struct stlibrd *brdp, unsigned long off
2832 unsigned char val; 2746 unsigned char val;
2833 2747
2834 if (offset > brdp->memsize) { 2748 if (offset > brdp->memsize) {
2835 printk(KERN_ERR "STALLION: shared memory pointer=%x out of " 2749 printk(KERN_ERR "istallion: shared memory pointer=%x out of "
2836 "range at line=%d(%d), brd=%d\n", 2750 "range at line=%d(%d), brd=%d\n",
2837 (int) offset, line, __LINE__, brdp->brdnr); 2751 (int) offset, line, __LINE__, brdp->brdnr);
2838 ptr = NULL; 2752 ptr = NULL;
@@ -2884,7 +2798,7 @@ static void __iomem *stli_ecpmcgetmemptr(struct stlibrd *brdp, unsigned long off
2884 unsigned char val; 2798 unsigned char val;
2885 2799
2886 if (offset > brdp->memsize) { 2800 if (offset > brdp->memsize) {
2887 printk(KERN_ERR "STALLION: shared memory pointer=%x out of " 2801 printk(KERN_ERR "istallion: shared memory pointer=%x out of "
2888 "range at line=%d(%d), brd=%d\n", 2802 "range at line=%d(%d), brd=%d\n",
2889 (int) offset, line, __LINE__, brdp->brdnr); 2803 (int) offset, line, __LINE__, brdp->brdnr);
2890 ptr = NULL; 2804 ptr = NULL;
@@ -2929,7 +2843,7 @@ static void __iomem *stli_ecppcigetmemptr(struct stlibrd *brdp, unsigned long of
2929 unsigned char val; 2843 unsigned char val;
2930 2844
2931 if (offset > brdp->memsize) { 2845 if (offset > brdp->memsize) {
2932 printk(KERN_ERR "STALLION: shared memory pointer=%x out of " 2846 printk(KERN_ERR "istallion: shared memory pointer=%x out of "
2933 "range at line=%d(%d), board=%d\n", 2847 "range at line=%d(%d), board=%d\n",
2934 (int) offset, line, __LINE__, brdp->brdnr); 2848 (int) offset, line, __LINE__, brdp->brdnr);
2935 ptr = NULL; 2849 ptr = NULL;
@@ -2994,7 +2908,7 @@ static void __iomem *stli_onbgetmemptr(struct stlibrd *brdp, unsigned long offse
2994 void __iomem *ptr; 2908 void __iomem *ptr;
2995 2909
2996 if (offset > brdp->memsize) { 2910 if (offset > brdp->memsize) {
2997 printk(KERN_ERR "STALLION: shared memory pointer=%x out of " 2911 printk(KERN_ERR "istallion: shared memory pointer=%x out of "
2998 "range at line=%d(%d), brd=%d\n", 2912 "range at line=%d(%d), brd=%d\n",
2999 (int) offset, line, __LINE__, brdp->brdnr); 2913 (int) offset, line, __LINE__, brdp->brdnr);
3000 ptr = NULL; 2914 ptr = NULL;
@@ -3060,7 +2974,7 @@ static void __iomem *stli_onbegetmemptr(struct stlibrd *brdp, unsigned long offs
3060 unsigned char val; 2974 unsigned char val;
3061 2975
3062 if (offset > brdp->memsize) { 2976 if (offset > brdp->memsize) {
3063 printk(KERN_ERR "STALLION: shared memory pointer=%x out of " 2977 printk(KERN_ERR "istallion: shared memory pointer=%x out of "
3064 "range at line=%d(%d), brd=%d\n", 2978 "range at line=%d(%d), brd=%d\n",
3065 (int) offset, line, __LINE__, brdp->brdnr); 2979 (int) offset, line, __LINE__, brdp->brdnr);
3066 ptr = NULL; 2980 ptr = NULL;
@@ -3499,7 +3413,7 @@ static int stli_startbrd(struct stlibrd *brdp)
3499#endif 3413#endif
3500 3414
3501 if (nrdevs < (brdp->nrports + 1)) { 3415 if (nrdevs < (brdp->nrports + 1)) {
3502 printk(KERN_ERR "STALLION: slave failed to allocate memory for " 3416 printk(KERN_ERR "istallion: slave failed to allocate memory for "
3503 "all devices, devices=%d\n", nrdevs); 3417 "all devices, devices=%d\n", nrdevs);
3504 brdp->nrports = nrdevs - 1; 3418 brdp->nrports = nrdevs - 1;
3505 } 3419 }
@@ -3509,13 +3423,13 @@ static int stli_startbrd(struct stlibrd *brdp)
3509 brdp->bitsize = (nrdevs + 7) / 8; 3423 brdp->bitsize = (nrdevs + 7) / 8;
3510 memoff = readl(&hdrp->memp); 3424 memoff = readl(&hdrp->memp);
3511 if (memoff > brdp->memsize) { 3425 if (memoff > brdp->memsize) {
3512 printk(KERN_ERR "STALLION: corrupted shared memory region?\n"); 3426 printk(KERN_ERR "istallion: corrupted shared memory region?\n");
3513 rc = -EIO; 3427 rc = -EIO;
3514 goto stli_donestartup; 3428 goto stli_donestartup;
3515 } 3429 }
3516 memp = (cdkmem_t __iomem *) EBRDGETMEMPTR(brdp, memoff); 3430 memp = (cdkmem_t __iomem *) EBRDGETMEMPTR(brdp, memoff);
3517 if (readw(&memp->dtype) != TYP_ASYNCTRL) { 3431 if (readw(&memp->dtype) != TYP_ASYNCTRL) {
3518 printk(KERN_ERR "STALLION: no slave control device found\n"); 3432 printk(KERN_ERR "istallion: no slave control device found\n");
3519 goto stli_donestartup; 3433 goto stli_donestartup;
3520 } 3434 }
3521 memp++; 3435 memp++;
@@ -3600,7 +3514,7 @@ static int __devinit stli_brdinit(struct stlibrd *brdp)
3600 retval = stli_initonb(brdp); 3514 retval = stli_initonb(brdp);
3601 break; 3515 break;
3602 default: 3516 default:
3603 printk(KERN_ERR "STALLION: board=%d is unknown board " 3517 printk(KERN_ERR "istallion: board=%d is unknown board "
3604 "type=%d\n", brdp->brdnr, brdp->brdtype); 3518 "type=%d\n", brdp->brdnr, brdp->brdtype);
3605 retval = -ENODEV; 3519 retval = -ENODEV;
3606 } 3520 }
@@ -3609,7 +3523,7 @@ static int __devinit stli_brdinit(struct stlibrd *brdp)
3609 return retval; 3523 return retval;
3610 3524
3611 stli_initports(brdp); 3525 stli_initports(brdp);
3612 printk(KERN_INFO "STALLION: %s found, board=%d io=%x mem=%x " 3526 printk(KERN_INFO "istallion: %s found, board=%d io=%x mem=%x "
3613 "nrpanels=%d nrports=%d\n", stli_brdnames[brdp->brdtype], 3527 "nrpanels=%d nrports=%d\n", stli_brdnames[brdp->brdtype],
3614 brdp->brdnr, brdp->iobase, (int) brdp->memaddr, 3528 brdp->brdnr, brdp->iobase, (int) brdp->memaddr,
3615 brdp->nrpanels, brdp->nrports); 3529 brdp->nrpanels, brdp->nrports);
@@ -3703,7 +3617,7 @@ static int stli_eisamemprobe(struct stlibrd *brdp)
3703 if (! foundit) { 3617 if (! foundit) {
3704 brdp->memaddr = 0; 3618 brdp->memaddr = 0;
3705 brdp->membase = NULL; 3619 brdp->membase = NULL;
3706 printk(KERN_ERR "STALLION: failed to probe shared memory " 3620 printk(KERN_ERR "istallion: failed to probe shared memory "
3707 "region for %s in EISA slot=%d\n", 3621 "region for %s in EISA slot=%d\n",
3708 stli_brdnames[brdp->brdtype], (brdp->iobase >> 12)); 3622 stli_brdnames[brdp->brdtype], (brdp->iobase >> 12));
3709 return -ENODEV; 3623 return -ENODEV;
@@ -3848,7 +3762,7 @@ static int __devinit stli_pciprobe(struct pci_dev *pdev,
3848 mutex_lock(&stli_brdslock); 3762 mutex_lock(&stli_brdslock);
3849 brdnr = stli_getbrdnr(); 3763 brdnr = stli_getbrdnr();
3850 if (brdnr < 0) { 3764 if (brdnr < 0) {
3851 printk(KERN_INFO "STALLION: too many boards found, " 3765 printk(KERN_INFO "istallion: too many boards found, "
3852 "maximum supported %d\n", STL_MAXBRDS); 3766 "maximum supported %d\n", STL_MAXBRDS);
3853 mutex_unlock(&stli_brdslock); 3767 mutex_unlock(&stli_brdslock);
3854 retval = -EIO; 3768 retval = -EIO;
@@ -3920,7 +3834,7 @@ static struct stlibrd *stli_allocbrd(void)
3920 3834
3921 brdp = kzalloc(sizeof(struct stlibrd), GFP_KERNEL); 3835 brdp = kzalloc(sizeof(struct stlibrd), GFP_KERNEL);
3922 if (!brdp) { 3836 if (!brdp) {
3923 printk(KERN_ERR "STALLION: failed to allocate memory " 3837 printk(KERN_ERR "istallion: failed to allocate memory "
3924 "(size=%Zd)\n", sizeof(struct stlibrd)); 3838 "(size=%Zd)\n", sizeof(struct stlibrd));
3925 return NULL; 3839 return NULL;
3926 } 3840 }
@@ -4518,6 +4432,11 @@ static const struct tty_operations stli_ops = {
4518 .tiocmset = stli_tiocmset, 4432 .tiocmset = stli_tiocmset,
4519}; 4433};
4520 4434
4435static const struct tty_port_operations stli_port_ops = {
4436 .carrier_raised = stli_carrier_raised,
4437 .raise_dtr_rts = stli_raise_dtr_rts,
4438};
4439
4521/*****************************************************************************/ 4440/*****************************************************************************/
4522/* 4441/*
4523 * Loadable module initialization stuff. 4442 * Loadable module initialization stuff.
@@ -4554,7 +4473,7 @@ static int __init istallion_module_init(void)
4554 4473
4555 stli_txcookbuf = kmalloc(STLI_TXBUFSIZE, GFP_KERNEL); 4474 stli_txcookbuf = kmalloc(STLI_TXBUFSIZE, GFP_KERNEL);
4556 if (!stli_txcookbuf) { 4475 if (!stli_txcookbuf) {
4557 printk(KERN_ERR "STALLION: failed to allocate memory " 4476 printk(KERN_ERR "istallion: failed to allocate memory "
4558 "(size=%d)\n", STLI_TXBUFSIZE); 4477 "(size=%d)\n", STLI_TXBUFSIZE);
4559 retval = -ENOMEM; 4478 retval = -ENOMEM;
4560 goto err; 4479 goto err;
@@ -4579,7 +4498,7 @@ static int __init istallion_module_init(void)
4579 4498
4580 retval = tty_register_driver(stli_serial); 4499 retval = tty_register_driver(stli_serial);
4581 if (retval) { 4500 if (retval) {
4582 printk(KERN_ERR "STALLION: failed to register serial driver\n"); 4501 printk(KERN_ERR "istallion: failed to register serial driver\n");
4583 goto err_ttyput; 4502 goto err_ttyput;
4584 } 4503 }
4585 4504
@@ -4593,7 +4512,7 @@ static int __init istallion_module_init(void)
4593 */ 4512 */
4594 retval = register_chrdev(STL_SIOMEMMAJOR, "staliomem", &stli_fsiomem); 4513 retval = register_chrdev(STL_SIOMEMMAJOR, "staliomem", &stli_fsiomem);
4595 if (retval) { 4514 if (retval) {
4596 printk(KERN_ERR "STALLION: failed to register serial memory " 4515 printk(KERN_ERR "istallion: failed to register serial memory "
4597 "device\n"); 4516 "device\n");
4598 goto err_deinit; 4517 goto err_deinit;
4599 } 4518 }