diff options
author | Alan Cox <alan@linux.intel.com> | 2010-09-16 13:21:52 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-10-22 13:20:05 -0400 |
commit | 0587102cf9f427c185bfdeb2cef41e13ee0264b1 (patch) | |
tree | 94c6dcc7ac230dee166d2f6aa1f9a54bffe5764b /drivers/char/ip2/ip2main.c | |
parent | 0bca1b913affbd7e2fdaffee62a499659a466eb5 (diff) |
tty: icount changeover for other main devices
Again basically cut and paste
Convert the main driver set to use the hooks for GICOUNT
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/char/ip2/ip2main.c')
-rw-r--r-- | drivers/char/ip2/ip2main.c | 72 |
1 files changed, 43 insertions, 29 deletions
diff --git a/drivers/char/ip2/ip2main.c b/drivers/char/ip2/ip2main.c index d4b71e8d0d23..438272ca9e08 100644 --- a/drivers/char/ip2/ip2main.c +++ b/drivers/char/ip2/ip2main.c | |||
@@ -183,6 +183,8 @@ static void ip2_hangup(PTTY); | |||
183 | static int ip2_tiocmget(struct tty_struct *tty, struct file *file); | 183 | static int ip2_tiocmget(struct tty_struct *tty, struct file *file); |
184 | static int ip2_tiocmset(struct tty_struct *tty, struct file *file, | 184 | static int ip2_tiocmset(struct tty_struct *tty, struct file *file, |
185 | unsigned int set, unsigned int clear); | 185 | unsigned int set, unsigned int clear); |
186 | static int ip2_get_icount(struct tty_struct *tty, | ||
187 | struct serial_icounter_struct *icount); | ||
186 | 188 | ||
187 | static void set_irq(int, int); | 189 | static void set_irq(int, int); |
188 | static void ip2_interrupt_bh(struct work_struct *work); | 190 | static void ip2_interrupt_bh(struct work_struct *work); |
@@ -454,6 +456,7 @@ static const struct tty_operations ip2_ops = { | |||
454 | .hangup = ip2_hangup, | 456 | .hangup = ip2_hangup, |
455 | .tiocmget = ip2_tiocmget, | 457 | .tiocmget = ip2_tiocmget, |
456 | .tiocmset = ip2_tiocmset, | 458 | .tiocmset = ip2_tiocmset, |
459 | .get_icount = ip2_get_icount, | ||
457 | .proc_fops = &ip2_proc_fops, | 460 | .proc_fops = &ip2_proc_fops, |
458 | }; | 461 | }; |
459 | 462 | ||
@@ -2128,7 +2131,6 @@ ip2_ioctl ( PTTY tty, struct file *pFile, UINT cmd, ULONG arg ) | |||
2128 | i2ChanStrPtr pCh = DevTable[tty->index]; | 2131 | i2ChanStrPtr pCh = DevTable[tty->index]; |
2129 | i2eBordStrPtr pB; | 2132 | i2eBordStrPtr pB; |
2130 | struct async_icount cprev, cnow; /* kernel counter temps */ | 2133 | struct async_icount cprev, cnow; /* kernel counter temps */ |
2131 | struct serial_icounter_struct __user *p_cuser; | ||
2132 | int rc = 0; | 2134 | int rc = 0; |
2133 | unsigned long flags; | 2135 | unsigned long flags; |
2134 | void __user *argp = (void __user *)arg; | 2136 | void __user *argp = (void __user *)arg; |
@@ -2297,34 +2299,6 @@ ip2_ioctl ( PTTY tty, struct file *pFile, UINT cmd, ULONG arg ) | |||
2297 | break; | 2299 | break; |
2298 | 2300 | ||
2299 | /* | 2301 | /* |
2300 | * Get counter of input serial line interrupts (DCD,RI,DSR,CTS) | ||
2301 | * Return: write counters to the user passed counter struct | ||
2302 | * NB: both 1->0 and 0->1 transitions are counted except for RI where | ||
2303 | * only 0->1 is counted. The controller is quite capable of counting | ||
2304 | * both, but this done to preserve compatibility with the standard | ||
2305 | * serial driver. | ||
2306 | */ | ||
2307 | case TIOCGICOUNT: | ||
2308 | ip2trace (CHANN, ITRC_IOCTL, 11, 1, rc ); | ||
2309 | |||
2310 | write_lock_irqsave(&pB->read_fifo_spinlock, flags); | ||
2311 | cnow = pCh->icount; | ||
2312 | write_unlock_irqrestore(&pB->read_fifo_spinlock, flags); | ||
2313 | p_cuser = argp; | ||
2314 | rc = put_user(cnow.cts, &p_cuser->cts); | ||
2315 | rc = put_user(cnow.dsr, &p_cuser->dsr); | ||
2316 | rc = put_user(cnow.rng, &p_cuser->rng); | ||
2317 | rc = put_user(cnow.dcd, &p_cuser->dcd); | ||
2318 | rc = put_user(cnow.rx, &p_cuser->rx); | ||
2319 | rc = put_user(cnow.tx, &p_cuser->tx); | ||
2320 | rc = put_user(cnow.frame, &p_cuser->frame); | ||
2321 | rc = put_user(cnow.overrun, &p_cuser->overrun); | ||
2322 | rc = put_user(cnow.parity, &p_cuser->parity); | ||
2323 | rc = put_user(cnow.brk, &p_cuser->brk); | ||
2324 | rc = put_user(cnow.buf_overrun, &p_cuser->buf_overrun); | ||
2325 | break; | ||
2326 | |||
2327 | /* | ||
2328 | * The rest are not supported by this driver. By returning -ENOIOCTLCMD they | 2302 | * The rest are not supported by this driver. By returning -ENOIOCTLCMD they |
2329 | * will be passed to the line discipline for it to handle. | 2303 | * will be passed to the line discipline for it to handle. |
2330 | */ | 2304 | */ |
@@ -2348,6 +2322,46 @@ ip2_ioctl ( PTTY tty, struct file *pFile, UINT cmd, ULONG arg ) | |||
2348 | return rc; | 2322 | return rc; |
2349 | } | 2323 | } |
2350 | 2324 | ||
2325 | static int ip2_get_icount(struct tty_struct *tty, | ||
2326 | struct serial_icounter_struct *icount) | ||
2327 | { | ||
2328 | i2ChanStrPtr pCh = DevTable[tty->index]; | ||
2329 | i2eBordStrPtr pB; | ||
2330 | struct async_icount cnow; /* kernel counter temp */ | ||
2331 | unsigned long flags; | ||
2332 | |||
2333 | if ( pCh == NULL ) | ||
2334 | return -ENODEV; | ||
2335 | |||
2336 | pB = pCh->pMyBord; | ||
2337 | |||
2338 | /* | ||
2339 | * Get counter of input serial line interrupts (DCD,RI,DSR,CTS) | ||
2340 | * Return: write counters to the user passed counter struct | ||
2341 | * NB: both 1->0 and 0->1 transitions are counted except for RI where | ||
2342 | * only 0->1 is counted. The controller is quite capable of counting | ||
2343 | * both, but this done to preserve compatibility with the standard | ||
2344 | * serial driver. | ||
2345 | */ | ||
2346 | |||
2347 | write_lock_irqsave(&pB->read_fifo_spinlock, flags); | ||
2348 | cnow = pCh->icount; | ||
2349 | write_unlock_irqrestore(&pB->read_fifo_spinlock, flags); | ||
2350 | |||
2351 | icount->cts = cnow.cts; | ||
2352 | icount->dsr = cnow.dsr; | ||
2353 | icount->rng = cnow.rng; | ||
2354 | icount->dcd = cnow.dcd; | ||
2355 | icount->rx = cnow.rx; | ||
2356 | icount->tx = cnow.tx; | ||
2357 | icount->frame = cnow.frame; | ||
2358 | icount->overrun = cnow.overrun; | ||
2359 | icount->parity = cnow.parity; | ||
2360 | icount->brk = cnow.brk; | ||
2361 | icount->buf_overrun = cnow.buf_overrun; | ||
2362 | return 0; | ||
2363 | } | ||
2364 | |||
2351 | /******************************************************************************/ | 2365 | /******************************************************************************/ |
2352 | /* Function: GetSerialInfo() */ | 2366 | /* Function: GetSerialInfo() */ |
2353 | /* Parameters: Pointer to channel structure */ | 2367 | /* Parameters: Pointer to channel structure */ |