]> err.no Git - linux-2.6/blobdiff - drivers/char/mxser.c
Merge branch 'core/softlockup-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[linux-2.6] / drivers / char / mxser.c
index e83ccee03161fd0e83fe7ce4d1f3e4f6e5cac6b2..4c756bbba94831aafa3895853394409688c896c6 100644 (file)
@@ -47,7 +47,7 @@
 
 #include "mxser.h"
 
-#define        MXSER_VERSION   "2.0.3"         /* 1.11 */
+#define        MXSER_VERSION   "2.0.4"         /* 1.12 */
 #define        MXSERMAJOR       174
 #define        MXSERCUMAJOR     175
 
 #define UART_MCR_AFE           0x20
 #define UART_LSR_SPECIAL       0x1E
 
+#define PCI_DEVICE_ID_POS104UL 0x1044
 #define PCI_DEVICE_ID_CB108    0x1080
+#define PCI_DEVICE_ID_CP102UF  0x1023
 #define PCI_DEVICE_ID_CB114    0x1142
 #define PCI_DEVICE_ID_CP114UL  0x1143
 #define PCI_DEVICE_ID_CB134I   0x1341
 #define PCI_DEVICE_ID_CP138U   0x1380
-#define PCI_DEVICE_ID_POS104UL 0x1044
 
 
 #define C168_ASIC_ID    1
@@ -142,7 +143,8 @@ static const struct mxser_cardinfo mxser_cards[] = {
        { "CB-134I series",     4, },
        { "CP-138U series",     8, },
        { "POS-104UL series",   4, },
-       { "CP-114UL series",    4, }
+       { "CP-114UL series",    4, },
+/*30*/ { "CP-102UF series",    2, }
 };
 
 /* driver_data correspond to the lines in the structure above
@@ -172,6 +174,7 @@ static struct pci_device_id mxser_pcibrds[] = {
        { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_CP138U),      .driver_data = 27 },
        { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_POS104UL),    .driver_data = 28 },
        { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_CP114UL),     .driver_data = 29 },
+       { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_CP102UF),     .driver_data = 30 },
        { }
 };
 MODULE_DEVICE_TABLE(pci, mxser_pcibrds);
@@ -243,10 +246,7 @@ struct mxser_port {
        unsigned char ldisc_stop_rx;
 
        int custom_divisor;
-       int close_delay;
-       unsigned short closing_wait;
        unsigned char err_shadow;
-       unsigned long event;
 
        struct async_icount icount; /* kernel counters for 4 input interrupts */
        int timeout;
@@ -1199,8 +1199,8 @@ static void mxser_close(struct tty_struct *tty, struct file *filp)
         * the line discipline to only process XON/XOFF characters.
         */
        tty->closing = 1;
-       if (info->closing_wait != ASYNC_CLOSING_WAIT_NONE)
-               tty_wait_until_sent(tty, info->closing_wait);
+       if (info->port.closing_wait != ASYNC_CLOSING_WAIT_NONE)
+               tty_wait_until_sent(tty, info->port.closing_wait);
        /*
         * At this point we stop accepting input.  To do this, we
         * disable the receive line status interrupts, and tell the
@@ -1231,11 +1231,10 @@ static void mxser_close(struct tty_struct *tty, struct file *filp)
        tty_ldisc_flush(tty);
 
        tty->closing = 0;
-       info->event = 0;
        info->port.tty = NULL;
        if (info->port.blocked_open) {
-               if (info->close_delay)
-                       schedule_timeout_interruptible(info->close_delay);
+               if (info->port.close_delay)
+                       schedule_timeout_interruptible(info->port.close_delay);
                wake_up_interruptible(&info->port.open_wait);
        }
 
@@ -1370,8 +1369,8 @@ static int mxser_get_serial_info(struct mxser_port *info,
                .irq = info->board->irq,
                .flags = info->port.flags,
                .baud_base = info->baud_base,
-               .close_delay = info->close_delay,
-               .closing_wait = info->closing_wait,
+               .close_delay = info->port.close_delay,
+               .closing_wait = info->port.closing_wait,
                .custom_divisor = info->custom_divisor,
                .hub6 = 0
        };
@@ -1402,7 +1401,7 @@ static int mxser_set_serial_info(struct mxser_port *info,
 
        if (!capable(CAP_SYS_ADMIN)) {
                if ((new_serial.baud_base != info->baud_base) ||
-                               (new_serial.close_delay != info->close_delay) ||
+                               (new_serial.close_delay != info->port.close_delay) ||
                                ((new_serial.flags & ~ASYNC_USR_MASK) != (info->port.flags & ~ASYNC_USR_MASK)))
                        return -EPERM;
                info->port.flags = ((info->port.flags & ~ASYNC_USR_MASK) |
@@ -1414,11 +1413,10 @@ static int mxser_set_serial_info(struct mxser_port *info,
                 */
                info->port.flags = ((info->port.flags & ~ASYNC_FLAGS) |
                                (new_serial.flags & ASYNC_FLAGS));
-               info->close_delay = new_serial.close_delay * HZ / 100;
-               info->closing_wait = new_serial.closing_wait * HZ / 100;
+               info->port.close_delay = new_serial.close_delay * HZ / 100;
+               info->port.closing_wait = new_serial.closing_wait * HZ / 100;
                info->port.tty->low_latency =
                                (info->port.flags & ASYNC_LOW_LATENCY) ? 1 : 0;
-               info->port.tty->low_latency = 0;
                if ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST &&
                                (new_serial.baud_base != info->baud_base ||
                                new_serial.custom_divisor !=
@@ -1468,27 +1466,6 @@ static int mxser_get_lsr_info(struct mxser_port *info,
        return put_user(result, value);
 }
 
-/*
- * This routine sends a break character out the serial port.
- */
-static void mxser_send_break(struct mxser_port *info, int duration)
-{
-       unsigned long flags;
-
-       if (!info->ioaddr)
-               return;
-       set_current_state(TASK_INTERRUPTIBLE);
-       spin_lock_irqsave(&info->slock, flags);
-       outb(inb(info->ioaddr + UART_LCR) | UART_LCR_SBC,
-               info->ioaddr + UART_LCR);
-       spin_unlock_irqrestore(&info->slock, flags);
-       schedule_timeout(duration);
-       spin_lock_irqsave(&info->slock, flags);
-       outb(inb(info->ioaddr + UART_LCR) & ~UART_LCR_SBC,
-               info->ioaddr + UART_LCR);
-       spin_unlock_irqrestore(&info->slock, flags);
-}
-
 static int mxser_tiocmget(struct tty_struct *tty, struct file *file)
 {
        struct mxser_port *info = tty->driver_data;
@@ -1876,21 +1853,6 @@ static int mxser_ioctl(struct tty_struct *tty, struct file *file,
                return -EIO;
 
        switch (cmd) {
-       case TCSBRK:            /* SVID version: non-zero arg --> no break */
-               retval = tty_check_change(tty);
-               if (retval)
-                       return retval;
-               tty_wait_until_sent(tty, 0);
-               if (!arg)
-                       mxser_send_break(info, HZ / 4); /* 1/4 second */
-               return 0;
-       case TCSBRKP:           /* support for POSIX tcsendbreak() */
-               retval = tty_check_change(tty);
-               if (retval)
-                       return retval;
-               tty_wait_until_sent(tty, 0);
-               mxser_send_break(info, arg ? arg * (HZ / 10) : HZ / 4);
-               return 0;
        case TIOCGSERIAL:
                lock_kernel();
                retval = mxser_get_serial_info(info, argp);
@@ -2214,7 +2176,6 @@ static void mxser_hangup(struct tty_struct *tty)
 
        mxser_flush_buffer(tty);
        mxser_shutdown(info);
-       info->event = 0;
        info->port.count = 0;
        info->port.flags &= ~ASYNC_NORMAL_ACTIVE;
        info->port.tty = NULL;
@@ -2224,7 +2185,7 @@ static void mxser_hangup(struct tty_struct *tty)
 /*
  * mxser_rs_break() --- routine which turns the break handling on or off
  */
-static void mxser_rs_break(struct tty_struct *tty, int break_state)
+static int mxser_rs_break(struct tty_struct *tty, int break_state)
 {
        struct mxser_port *info = tty->driver_data;
        unsigned long flags;
@@ -2237,6 +2198,7 @@ static void mxser_rs_break(struct tty_struct *tty, int break_state)
                outb(inb(info->ioaddr + UART_LCR) & ~UART_LCR_SBC,
                        info->ioaddr + UART_LCR);
        spin_unlock_irqrestore(&info->slock, flags);
+       return 0;
 }
 
 static void mxser_receive_chars(struct mxser_port *port, int *status)
@@ -2545,6 +2507,7 @@ static int __devinit mxser_initbrd(struct mxser_board *brd,
 
        for (i = 0; i < brd->info->nports; i++) {
                info = &brd->ports[i];
+               tty_port_init(&info->port);
                info->board = brd;
                info->stop_rx = 0;
                info->ldisc_stop_rx = 0;
@@ -2559,10 +2522,9 @@ static int __devinit mxser_initbrd(struct mxser_board *brd,
                process_txrx_fifo(info);
 
                info->custom_divisor = info->baud_base * 16;
-               info->close_delay = 5 * HZ / 10;
-               info->closing_wait = 30 * HZ;
+               info->port.close_delay = 5 * HZ / 10;
+               info->port.closing_wait = 30 * HZ;
                info->normal_termios = mxvar_sdriver->init_termios;
-               tty_port_init(&info->port);
                init_waitqueue_head(&info->delta_msr_wait);
                memset(&info->mon_data, 0, sizeof(struct mxser_mon));
                info->err_shadow = 0;