]> err.no Git - linux-2.6/blobdiff - drivers/char/riscom8.c
Merge git://oss.sgi.com:8090/xfs/linux-2.6
[linux-2.6] / drivers / char / riscom8.c
index 3ca8957ba32703ea716db57b70f4f098408f01dc..2c6c8f33d6b43e7dda4d7b03fb8f0615698d0bb3 100644 (file)
@@ -1032,8 +1032,8 @@ static void rc_close(struct tty_struct *tty, struct file *filp)
         * the line discipline to only process XON/XOFF characters.
         */
        tty->closing = 1;
-       if (port->closing_wait != ASYNC_CLOSING_WAIT_NONE)
-               tty_wait_until_sent(tty, port->closing_wait);
+       if (port->port.closing_wait != ASYNC_CLOSING_WAIT_NONE)
+               tty_wait_until_sent(tty, port->port.closing_wait);
        /*
         * At this point we stop accepting input.  To do this, we
         * disable the receive line status interrupts, and tell the
@@ -1065,8 +1065,8 @@ static void rc_close(struct tty_struct *tty, struct file *filp)
        tty->closing = 0;
        port->port.tty = NULL;
        if (port->port.blocked_open) {
-               if (port->close_delay)
-                       msleep_interruptible(jiffies_to_msecs(port->close_delay));
+               if (port->port.close_delay)
+                       msleep_interruptible(jiffies_to_msecs(port->port.close_delay));
                wake_up_interruptible(&port->port.open_wait);
        }
        port->port.flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);
@@ -1250,11 +1250,15 @@ static int rc_tiocmset(struct tty_struct *tty, struct file *file,
        return 0;
 }
 
-static void rc_send_break(struct riscom_port *port, unsigned long length)
+static int rc_send_break(struct tty_struct *tty, int length)
 {
+       struct riscom_port *port = (struct riscom_port *)tty->driver_data;
        struct riscom_board *bp = port_Board(port);
        unsigned long flags;
 
+       if (length == 0 || length == -1)
+               return -EOPNOTSUPP;
+
        spin_lock_irqsave(&riscom_lock, flags);
 
        port->break_length = RISCOM_TPS / HZ * length;
@@ -1268,6 +1272,7 @@ static void rc_send_break(struct riscom_port *port, unsigned long length)
        rc_wait_CCR(bp);
 
        spin_unlock_irqrestore(&riscom_lock, flags);
+       return 0;
 }
 
 static int rc_set_serial_info(struct riscom_port *port,
@@ -1295,8 +1300,8 @@ static int rc_set_serial_info(struct riscom_port *port,
                        (tmp.flags & ASYNC_SPD_MASK));
 
        if (!capable(CAP_SYS_ADMIN)) {
-               if ((tmp.close_delay != port->close_delay) ||
-                   (tmp.closing_wait != port->closing_wait) ||
+               if ((tmp.close_delay != port->port.close_delay) ||
+                   (tmp.closing_wait != port->port.closing_wait) ||
                    ((tmp.flags & ~ASYNC_USR_MASK) !=
                     (port->port.flags & ~ASYNC_USR_MASK)))
                        return -EPERM;
@@ -1305,8 +1310,8 @@ static int rc_set_serial_info(struct riscom_port *port,
        } else  {
                port->port.flags = ((port->port.flags & ~ASYNC_FLAGS) |
                               (tmp.flags & ASYNC_FLAGS));
-               port->close_delay = tmp.close_delay;
-               port->closing_wait = tmp.closing_wait;
+               port->port.close_delay = tmp.close_delay;
+               port->port.closing_wait = tmp.closing_wait;
        }
        if (change_speed)  {
                unsigned long flags;
@@ -1331,8 +1336,8 @@ static int rc_get_serial_info(struct riscom_port *port,
        tmp.irq  = bp->irq;
        tmp.flags = port->port.flags;
        tmp.baud_base = (RC_OSCFREQ + CD180_TPC/2) / CD180_TPC;
-       tmp.close_delay = port->close_delay * HZ/100;
-       tmp.closing_wait = port->closing_wait * HZ/100;
+       tmp.close_delay = port->port.close_delay * HZ/100;
+       tmp.closing_wait = port->port.closing_wait * HZ/100;
        tmp.xmit_fifo_size = CD180_NFIFO;
        return copy_to_user(retinfo, &tmp, sizeof(tmp)) ? -EFAULT : 0;
 }
@@ -1342,27 +1347,12 @@ static int rc_ioctl(struct tty_struct *tty, struct file *filp,
 {
        struct riscom_port *port = (struct riscom_port *)tty->driver_data;
        void __user *argp = (void __user *)arg;
-       int retval = 0;
+       int retval;
 
        if (rc_paranoia_check(port, tty->name, "rc_ioctl"))
                return -ENODEV;
 
        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)
-                       rc_send_break(port, HZ/4);      /* 1/4 second */
-               break;
-       case TCSBRKP:   /* support for POSIX tcsendbreak() */
-               retval = tty_check_change(tty);
-               if (retval)
-                       return retval;
-               tty_wait_until_sent(tty, 0);
-               rc_send_break(port, arg ? arg*(HZ/10) : HZ/4);
-               break;
        case TIOCGSERIAL:
                lock_kernel();
                retval = rc_get_serial_info(port, argp);
@@ -1517,6 +1507,7 @@ static const struct tty_operations riscom_ops = {
        .hangup = rc_hangup,
        .tiocmget = rc_tiocmget,
        .tiocmset = rc_tiocmset,
+       .break_ctl = rc_send_break,
 };
 
 static int __init rc_init_drivers(void)
@@ -1538,7 +1529,7 @@ static int __init rc_init_drivers(void)
                B9600 | CS8 | CREAD | HUPCL | CLOCAL;
        riscom_driver->init_termios.c_ispeed = 9600;
        riscom_driver->init_termios.c_ospeed = 9600;
-       riscom_driver->flags = TTY_DRIVER_REAL_RAW;
+       riscom_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_HARDWARE_BREAK;
        tty_set_operations(riscom_driver, &riscom_ops);
        error = tty_register_driver(riscom_driver);
        if (error != 0) {
@@ -1549,10 +1540,8 @@ static int __init rc_init_drivers(void)
        }
        memset(rc_port, 0, sizeof(rc_port));
        for (i = 0; i < RC_NPORT * RC_NBOARD; i++)  {
-               rc_port[i].magic = RISCOM8_MAGIC;
-               rc_port[i].close_delay = 50 * HZ / 100;
-               rc_port[i].closing_wait = 3000 * HZ / 100;
                tty_port_init(&rc_port[i].port);
+               rc_port[i].magic = RISCOM8_MAGIC;
        }
        return 0;
 }