aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/riscom8.c
diff options
context:
space:
mode:
authorAlan Cox <alan@redhat.com>2008-07-22 06:18:30 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-22 16:03:28 -0400
commit781cff5cb2bc8d714270accf88db23a855de9816 (patch)
treed7255d4c208591fa53416c1e8c1556651b7a7bf0 /drivers/char/riscom8.c
parent6d889724332e875ac07b6c88e08d9564c180824d (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.c27
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,
1250 return 0; 1250 return 0;
1251} 1251}
1252 1252
1253static void rc_send_break(struct riscom_port *port, unsigned long length) 1253static int rc_send_break(struct tty_struct *tty, int length)
1254{ 1254{
1255 struct riscom_port *port = (struct riscom_port *)tty->driver_data;
1255 struct riscom_board *bp = port_Board(port); 1256 struct riscom_board *bp = port_Board(port);
1256 unsigned long flags; 1257 unsigned long flags;
1257 1258
1259 if (length == 0 || length == -1)
1260 return -EOPNOTSUPP;
1261
1258 spin_lock_irqsave(&riscom_lock, flags); 1262 spin_lock_irqsave(&riscom_lock, flags);
1259 1263
1260 port->break_length = RISCOM_TPS / HZ * length; 1264 port->break_length = RISCOM_TPS / HZ * length;
@@ -1268,6 +1272,7 @@ static void rc_send_break(struct riscom_port *port, unsigned long length)
1268 rc_wait_CCR(bp); 1272 rc_wait_CCR(bp);
1269 1273
1270 spin_unlock_irqrestore(&riscom_lock, flags); 1274 spin_unlock_irqrestore(&riscom_lock, flags);
1275 return 0;
1271} 1276}
1272 1277
1273static int rc_set_serial_info(struct riscom_port *port, 1278static int rc_set_serial_info(struct riscom_port *port,
@@ -1342,27 +1347,12 @@ static int rc_ioctl(struct tty_struct *tty, struct file *filp,
1342{ 1347{
1343 struct riscom_port *port = (struct riscom_port *)tty->driver_data; 1348 struct riscom_port *port = (struct riscom_port *)tty->driver_data;
1344 void __user *argp = (void __user *)arg; 1349 void __user *argp = (void __user *)arg;
1345 int retval = 0; 1350 int retval;
1346 1351
1347 if (rc_paranoia_check(port, tty->name, "rc_ioctl")) 1352 if (rc_paranoia_check(port, tty->name, "rc_ioctl"))
1348 return -ENODEV; 1353 return -ENODEV;
1349 1354
1350 switch (cmd) { 1355 switch (cmd) {
1351 case TCSBRK: /* SVID version: non-zero arg --> no break */
1352 retval = tty_check_change(tty);
1353 if (retval)
1354 return retval;
1355 tty_wait_until_sent(tty, 0);
1356 if (!arg)
1357 rc_send_break(port, HZ/4); /* 1/4 second */
1358 break;
1359 case TCSBRKP: /* support for POSIX tcsendbreak() */
1360 retval = tty_check_change(tty);
1361 if (retval)
1362 return retval;
1363 tty_wait_until_sent(tty, 0);
1364 rc_send_break(port, arg ? arg*(HZ/10) : HZ/4);
1365 break;
1366 case TIOCGSERIAL: 1356 case TIOCGSERIAL:
1367 lock_kernel(); 1357 lock_kernel();
1368 retval = rc_get_serial_info(port, argp); 1358 retval = rc_get_serial_info(port, argp);
@@ -1517,6 +1507,7 @@ static const struct tty_operations riscom_ops = {
1517 .hangup = rc_hangup, 1507 .hangup = rc_hangup,
1518 .tiocmget = rc_tiocmget, 1508 .tiocmget = rc_tiocmget,
1519 .tiocmset = rc_tiocmset, 1509 .tiocmset = rc_tiocmset,
1510 .break_ctl = rc_send_break,
1520}; 1511};
1521 1512
1522static int __init rc_init_drivers(void) 1513static int __init rc_init_drivers(void)
@@ -1538,7 +1529,7 @@ static int __init rc_init_drivers(void)
1538 B9600 | CS8 | CREAD | HUPCL | CLOCAL; 1529 B9600 | CS8 | CREAD | HUPCL | CLOCAL;
1539 riscom_driver->init_termios.c_ispeed = 9600; 1530 riscom_driver->init_termios.c_ispeed = 9600;
1540 riscom_driver->init_termios.c_ospeed = 9600; 1531 riscom_driver->init_termios.c_ospeed = 9600;
1541 riscom_driver->flags = TTY_DRIVER_REAL_RAW; 1532 riscom_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_HARDWARE_BREAK;
1542 tty_set_operations(riscom_driver, &riscom_ops); 1533 tty_set_operations(riscom_driver, &riscom_ops);
1543 error = tty_register_driver(riscom_driver); 1534 error = tty_register_driver(riscom_driver);
1544 if (error != 0) { 1535 if (error != 0) {