From dcbf1280796be7c0b74c4231f0ac9dd8aa1e2591 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Tue, 22 Jul 2008 11:18:12 +0100 Subject: [PATCH] epca: Restore driver Convert the driver to use the added hardware break support Signed-off-by: Alan Cox Signed-off-by: Linus Torvalds --- drivers/char/Kconfig | 2 +- drivers/char/epca.c | 38 +++++++++----------------------------- 2 files changed, 10 insertions(+), 30 deletions(-) diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index a185263b58..9ead63cd56 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig @@ -167,7 +167,7 @@ config CYZ_INTR config DIGIEPCA tristate "Digiboard Intelligent Async Support" - depends on SERIAL_NONSTANDARD && (ISA || EISA || PCI) && BROKEN + depends on SERIAL_NONSTANDARD && (ISA || EISA || PCI) ---help--- This is a driver for Digi International's Xx, Xeve, and Xem series of cards which provide multiple serial ports. You would need diff --git a/drivers/char/epca.c b/drivers/char/epca.c index 94dca7b082..9d9ae1ca29 100644 --- a/drivers/char/epca.c +++ b/drivers/char/epca.c @@ -184,7 +184,7 @@ static void pc_stop(struct tty_struct *); static void pc_start(struct tty_struct *); static void pc_throttle(struct tty_struct *tty); static void pc_unthrottle(struct tty_struct *tty); -static void digi_send_break(struct channel *ch, int msec); +static int pc_send_break(struct tty_struct *tty, int msec); static void setup_empty_event(struct tty_struct *tty, struct channel *ch); static void epca_setup(char *, int *); @@ -1040,6 +1040,7 @@ static const struct tty_operations pc_ops = { .throttle = pc_throttle, .unthrottle = pc_unthrottle, .hangup = pc_hangup, + .break_ctl = pc_send_break }; static int info_open(struct tty_struct *tty, struct file *filp) @@ -1132,7 +1133,7 @@ static int __init pc_init(void) pc_driver->init_termios.c_lflag = 0; pc_driver->init_termios.c_ispeed = 9600; pc_driver->init_termios.c_ospeed = 9600; - pc_driver->flags = TTY_DRIVER_REAL_RAW; + pc_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_HARDWARE_BREAK; tty_set_operations(pc_driver, &pc_ops); pc_info->owner = THIS_MODULE; @@ -2177,7 +2178,6 @@ static int pc_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg) { digiflow_t dflow; - int retval; unsigned long flags; unsigned int mflag, mstat; unsigned char startc, stopc; @@ -2190,31 +2190,6 @@ static int pc_ioctl(struct tty_struct *tty, struct file *file, else return -EINVAL; switch (cmd) { - case TCSBRK: /* SVID version: non-zero arg --> no break */ - retval = tty_check_change(tty); - if (retval) - return retval; - /* Setup an event to indicate when the transmit - buffer empties */ - spin_lock_irqsave(&epca_lock, flags); - setup_empty_event(tty, ch); - spin_unlock_irqrestore(&epca_lock, flags); - tty_wait_until_sent(tty, 0); - if (!arg) - digi_send_break(ch, HZ / 4); /* 1/4 second */ - return 0; - case TCSBRKP: /* support for POSIX tcsendbreak() */ - retval = tty_check_change(tty); - if (retval) - return retval; - /* Setup an event to indicate when the transmit buffer - empties */ - spin_lock_irqsave(&epca_lock, flags); - setup_empty_event(tty, ch); - spin_unlock_irqrestore(&epca_lock, flags); - tty_wait_until_sent(tty, 0); - digi_send_break(ch, arg ? arg*(HZ/10) : HZ/4); - return 0; case TIOCMODG: mflag = pc_tiocmget(tty, file); if (put_user(mflag, (unsigned long __user *)argp)) @@ -2500,10 +2475,14 @@ static void pc_unthrottle(struct tty_struct *tty) } } -static void digi_send_break(struct channel *ch, int msec) +static int pc_send_break(struct tty_struct *tty, int msec) { + struct channel *ch = (struct channel *) tty->driver_data; unsigned long flags; + if (msec == -1) + return -EOPNOTSUPP; + spin_lock_irqsave(&epca_lock, flags); globalwinon(ch); /* @@ -2516,6 +2495,7 @@ static void digi_send_break(struct channel *ch, int msec) fepcmd(ch, SENDBREAK, msec, 0, 10, 0); memoff(ch); spin_unlock_irqrestore(&epca_lock, flags); + return 0; } /* Caller MUST hold the lock */ -- 2.39.5