diff options
author | Alan Cox <alan@redhat.com> | 2008-07-22 11:18:30 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-22 13:03:28 -0700 |
commit | 781cff5cb2bc8d714270accf88db23a855de9816 (patch) | |
tree | d7255d4c208591fa53416c1e8c1556651b7a7bf0 /drivers/char/riscom8.c | |
parent | 6d889724332e875ac07b6c88e08d9564c180824d (diff) |
riscom8: Restore driver using new break functionality
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char/riscom8.c')
-rw-r--r-- | drivers/char/riscom8.c | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/drivers/char/riscom8.c b/drivers/char/riscom8.c index 724b2b20f4b2..2c6c8f33d6b4 100644 --- a/drivers/char/riscom8.c +++ b/drivers/char/riscom8.c @@ -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, @@ -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) { |