Skip to content

Commit

Permalink
epca: Restore driver
Browse files Browse the repository at this point in the history
Convert the driver to use the added hardware break support

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 9e98966 commit dcbf128
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 30 deletions.
2 changes: 1 addition & 1 deletion drivers/char/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
38 changes: 9 additions & 29 deletions drivers/char/epca.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 *);

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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))
Expand Down Expand Up @@ -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);
/*
Expand All @@ -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 */
Expand Down

0 comments on commit dcbf128

Please sign in to comment.