Skip to content

Commit

Permalink
riscom8: Restore driver using new break functionality
Browse files Browse the repository at this point in the history
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Alan Cox authored and Linus Torvalds committed Jul 22, 2008
1 parent 6d88972 commit 781cff5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 19 deletions.
2 changes: 1 addition & 1 deletion drivers/char/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ config N_HDLC

config RISCOM8
tristate "SDL RISCom/8 card support"
depends on SERIAL_NONSTANDARD && BROKEN
depends on SERIAL_NONSTANDARD
help
This is a driver for the SDL Communications RISCom/8 multiport card,
which gives you many serial ports. You would need something like
Expand Down
27 changes: 9 additions & 18 deletions drivers/char/riscom8.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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)
Expand All @@ -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) {
Expand Down

0 comments on commit 781cff5

Please sign in to comment.