aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/pcmcia/synclink_cs.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-10-22 22:59:04 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-10-22 22:59:04 -0400
commit73ecf3a6e3f0206bf56a0fefe3b3eda042fb7034 (patch)
tree866f0ebb2b148479e93b5ac955097b1cc94ceb4e /drivers/char/pcmcia/synclink_cs.c
parentb9da0571050c09863e59f94d0b8594a290d61b88 (diff)
parentcd3ecad19aea8debae9a48b53de2ec7a571f24e9 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6: (49 commits) serial8250: ratelimit "too much work" error serial: bfin_sport_uart: speed up sport RX sample rate to be 3% faster serial: abstraction for 8250 legacy ports serial/imx: check that the buffer is non-empty before sending it out serial: mfd: add more baud rates support jsm: Remove the uart port on errors Alchemy: Add UART PM methods. 8250: allow platforms to override PM hook. altera_uart: Don't use plain integer as NULL pointer altera_uart: Fix missing prototype for registering an early console altera_uart: Fixup type usage of port flags altera_uart: Make it possible to use Altera UART and 8250 ports together altera_uart: Add support for different address strides altera_uart: Add support for getting mapbase and IRQ from resources altera_uart: Add support for polling mode (IRQ-less) serial: Factor out uart_poll_timeout() from 8250 driver serial: mark the 8250 driver as maintained serial: 8250: Don't delay after transmitter is ready. tty: MAINTAINERS: add drivers/serial/jsm/ as maintained driver vcs: invoke the vt update callback when /dev/vcs* is written to ...
Diffstat (limited to 'drivers/char/pcmcia/synclink_cs.c')
-rw-r--r--drivers/char/pcmcia/synclink_cs.c60
1 files changed, 27 insertions, 33 deletions
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c
index be1810057607..bfc10f89d951 100644
--- a/drivers/char/pcmcia/synclink_cs.c
+++ b/drivers/char/pcmcia/synclink_cs.c
@@ -2191,6 +2191,32 @@ static int mgslpc_break(struct tty_struct *tty, int break_state)
2191 return 0; 2191 return 0;
2192} 2192}
2193 2193
2194static int mgslpc_get_icount(struct tty_struct *tty,
2195 struct serial_icounter_struct *icount)
2196{
2197 MGSLPC_INFO * info = (MGSLPC_INFO *)tty->driver_data;
2198 struct mgsl_icount cnow; /* kernel counter temps */
2199 unsigned long flags;
2200
2201 spin_lock_irqsave(&info->lock,flags);
2202 cnow = info->icount;
2203 spin_unlock_irqrestore(&info->lock,flags);
2204
2205 icount->cts = cnow.cts;
2206 icount->dsr = cnow.dsr;
2207 icount->rng = cnow.rng;
2208 icount->dcd = cnow.dcd;
2209 icount->rx = cnow.rx;
2210 icount->tx = cnow.tx;
2211 icount->frame = cnow.frame;
2212 icount->overrun = cnow.overrun;
2213 icount->parity = cnow.parity;
2214 icount->brk = cnow.brk;
2215 icount->buf_overrun = cnow.buf_overrun;
2216
2217 return 0;
2218}
2219
2194/* Service an IOCTL request 2220/* Service an IOCTL request
2195 * 2221 *
2196 * Arguments: 2222 * Arguments:
@@ -2206,11 +2232,7 @@ static int mgslpc_ioctl(struct tty_struct *tty, struct file * file,
2206 unsigned int cmd, unsigned long arg) 2232 unsigned int cmd, unsigned long arg)
2207{ 2233{
2208 MGSLPC_INFO * info = (MGSLPC_INFO *)tty->driver_data; 2234 MGSLPC_INFO * info = (MGSLPC_INFO *)tty->driver_data;
2209 int error;
2210 struct mgsl_icount cnow; /* kernel counter temps */
2211 struct serial_icounter_struct __user *p_cuser; /* user space */
2212 void __user *argp = (void __user *)arg; 2235 void __user *argp = (void __user *)arg;
2213 unsigned long flags;
2214 2236
2215 if (debug_level >= DEBUG_LEVEL_INFO) 2237 if (debug_level >= DEBUG_LEVEL_INFO)
2216 printk("%s(%d):mgslpc_ioctl %s cmd=%08X\n", __FILE__,__LINE__, 2238 printk("%s(%d):mgslpc_ioctl %s cmd=%08X\n", __FILE__,__LINE__,
@@ -2220,7 +2242,7 @@ static int mgslpc_ioctl(struct tty_struct *tty, struct file * file,
2220 return -ENODEV; 2242 return -ENODEV;
2221 2243
2222 if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) && 2244 if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) &&
2223 (cmd != TIOCMIWAIT) && (cmd != TIOCGICOUNT)) { 2245 (cmd != TIOCMIWAIT)) {
2224 if (tty->flags & (1 << TTY_IO_ERROR)) 2246 if (tty->flags & (1 << TTY_IO_ERROR))
2225 return -EIO; 2247 return -EIO;
2226 } 2248 }
@@ -2250,34 +2272,6 @@ static int mgslpc_ioctl(struct tty_struct *tty, struct file * file,
2250 return wait_events(info, argp); 2272 return wait_events(info, argp);
2251 case TIOCMIWAIT: 2273 case TIOCMIWAIT:
2252 return modem_input_wait(info,(int)arg); 2274 return modem_input_wait(info,(int)arg);
2253 case TIOCGICOUNT:
2254 spin_lock_irqsave(&info->lock,flags);
2255 cnow = info->icount;
2256 spin_unlock_irqrestore(&info->lock,flags);
2257 p_cuser = argp;
2258 PUT_USER(error,cnow.cts, &p_cuser->cts);
2259 if (error) return error;
2260 PUT_USER(error,cnow.dsr, &p_cuser->dsr);
2261 if (error) return error;
2262 PUT_USER(error,cnow.rng, &p_cuser->rng);
2263 if (error) return error;
2264 PUT_USER(error,cnow.dcd, &p_cuser->dcd);
2265 if (error) return error;
2266 PUT_USER(error,cnow.rx, &p_cuser->rx);
2267 if (error) return error;
2268 PUT_USER(error,cnow.tx, &p_cuser->tx);
2269 if (error) return error;
2270 PUT_USER(error,cnow.frame, &p_cuser->frame);
2271 if (error) return error;
2272 PUT_USER(error,cnow.overrun, &p_cuser->overrun);
2273 if (error) return error;
2274 PUT_USER(error,cnow.parity, &p_cuser->parity);
2275 if (error) return error;
2276 PUT_USER(error,cnow.brk, &p_cuser->brk);
2277 if (error) return error;
2278 PUT_USER(error,cnow.buf_overrun, &p_cuser->buf_overrun);
2279 if (error) return error;
2280 return 0;
2281 default: 2275 default:
2282 return -ENOIOCTLCMD; 2276 return -ENOIOCTLCMD;
2283 } 2277 }