aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/epca.c
diff options
context:
space:
mode:
authorAlan Cox <alan@redhat.com>2008-07-22 06:18:12 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-22 16:03:28 -0400
commitdcbf1280796be7c0b74c4231f0ac9dd8aa1e2591 (patch)
tree121b9d20d139012a0e467d6f4d9f31597c594795 /drivers/char/epca.c
parent9e98966c7bb94355689478bc84cc3e0c190f977e (diff)
epca: Restore driver
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>
Diffstat (limited to 'drivers/char/epca.c')
-rw-r--r--drivers/char/epca.c38
1 files changed, 9 insertions, 29 deletions
diff --git a/drivers/char/epca.c b/drivers/char/epca.c
index 94dca7b082b2..9d9ae1ca2925 100644
--- a/drivers/char/epca.c
+++ b/drivers/char/epca.c
@@ -184,7 +184,7 @@ static void pc_stop(struct tty_struct *);
184static void pc_start(struct tty_struct *); 184static void pc_start(struct tty_struct *);
185static void pc_throttle(struct tty_struct *tty); 185static void pc_throttle(struct tty_struct *tty);
186static void pc_unthrottle(struct tty_struct *tty); 186static void pc_unthrottle(struct tty_struct *tty);
187static void digi_send_break(struct channel *ch, int msec); 187static int pc_send_break(struct tty_struct *tty, int msec);
188static void setup_empty_event(struct tty_struct *tty, struct channel *ch); 188static void setup_empty_event(struct tty_struct *tty, struct channel *ch);
189static void epca_setup(char *, int *); 189static void epca_setup(char *, int *);
190 190
@@ -1040,6 +1040,7 @@ static const struct tty_operations pc_ops = {
1040 .throttle = pc_throttle, 1040 .throttle = pc_throttle,
1041 .unthrottle = pc_unthrottle, 1041 .unthrottle = pc_unthrottle,
1042 .hangup = pc_hangup, 1042 .hangup = pc_hangup,
1043 .break_ctl = pc_send_break
1043}; 1044};
1044 1045
1045static int info_open(struct tty_struct *tty, struct file *filp) 1046static int info_open(struct tty_struct *tty, struct file *filp)
@@ -1132,7 +1133,7 @@ static int __init pc_init(void)
1132 pc_driver->init_termios.c_lflag = 0; 1133 pc_driver->init_termios.c_lflag = 0;
1133 pc_driver->init_termios.c_ispeed = 9600; 1134 pc_driver->init_termios.c_ispeed = 9600;
1134 pc_driver->init_termios.c_ospeed = 9600; 1135 pc_driver->init_termios.c_ospeed = 9600;
1135 pc_driver->flags = TTY_DRIVER_REAL_RAW; 1136 pc_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_HARDWARE_BREAK;
1136 tty_set_operations(pc_driver, &pc_ops); 1137 tty_set_operations(pc_driver, &pc_ops);
1137 1138
1138 pc_info->owner = THIS_MODULE; 1139 pc_info->owner = THIS_MODULE;
@@ -2177,7 +2178,6 @@ static int pc_ioctl(struct tty_struct *tty, struct file *file,
2177 unsigned int cmd, unsigned long arg) 2178 unsigned int cmd, unsigned long arg)
2178{ 2179{
2179 digiflow_t dflow; 2180 digiflow_t dflow;
2180 int retval;
2181 unsigned long flags; 2181 unsigned long flags;
2182 unsigned int mflag, mstat; 2182 unsigned int mflag, mstat;
2183 unsigned char startc, stopc; 2183 unsigned char startc, stopc;
@@ -2190,31 +2190,6 @@ static int pc_ioctl(struct tty_struct *tty, struct file *file,
2190 else 2190 else
2191 return -EINVAL; 2191 return -EINVAL;
2192 switch (cmd) { 2192 switch (cmd) {
2193 case TCSBRK: /* SVID version: non-zero arg --> no break */
2194 retval = tty_check_change(tty);
2195 if (retval)
2196 return retval;
2197 /* Setup an event to indicate when the transmit
2198 buffer empties */
2199 spin_lock_irqsave(&epca_lock, flags);
2200 setup_empty_event(tty, ch);
2201 spin_unlock_irqrestore(&epca_lock, flags);
2202 tty_wait_until_sent(tty, 0);
2203 if (!arg)
2204 digi_send_break(ch, HZ / 4); /* 1/4 second */
2205 return 0;
2206 case TCSBRKP: /* support for POSIX tcsendbreak() */
2207 retval = tty_check_change(tty);
2208 if (retval)
2209 return retval;
2210 /* Setup an event to indicate when the transmit buffer
2211 empties */
2212 spin_lock_irqsave(&epca_lock, flags);
2213 setup_empty_event(tty, ch);
2214 spin_unlock_irqrestore(&epca_lock, flags);
2215 tty_wait_until_sent(tty, 0);
2216 digi_send_break(ch, arg ? arg*(HZ/10) : HZ/4);
2217 return 0;
2218 case TIOCMODG: 2193 case TIOCMODG:
2219 mflag = pc_tiocmget(tty, file); 2194 mflag = pc_tiocmget(tty, file);
2220 if (put_user(mflag, (unsigned long __user *)argp)) 2195 if (put_user(mflag, (unsigned long __user *)argp))
@@ -2500,10 +2475,14 @@ static void pc_unthrottle(struct tty_struct *tty)
2500 } 2475 }
2501} 2476}
2502 2477
2503static void digi_send_break(struct channel *ch, int msec) 2478static int pc_send_break(struct tty_struct *tty, int msec)
2504{ 2479{
2480 struct channel *ch = (struct channel *) tty->driver_data;
2505 unsigned long flags; 2481 unsigned long flags;
2506 2482
2483 if (msec == -1)
2484 return -EOPNOTSUPP;
2485
2507 spin_lock_irqsave(&epca_lock, flags); 2486 spin_lock_irqsave(&epca_lock, flags);
2508 globalwinon(ch); 2487 globalwinon(ch);
2509 /* 2488 /*
@@ -2516,6 +2495,7 @@ static void digi_send_break(struct channel *ch, int msec)
2516 fepcmd(ch, SENDBREAK, msec, 0, 10, 0); 2495 fepcmd(ch, SENDBREAK, msec, 0, 10, 0);
2517 memoff(ch); 2496 memoff(ch);
2518 spin_unlock_irqrestore(&epca_lock, flags); 2497 spin_unlock_irqrestore(&epca_lock, flags);
2498 return 0;
2519} 2499}
2520 2500
2521/* Caller MUST hold the lock */ 2501/* Caller MUST hold the lock */