diff options
Diffstat (limited to 'drivers/char/pcmcia/synclink_cs.c')
-rw-r--r-- | drivers/char/pcmcia/synclink_cs.c | 60 |
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 | ||
2194 | static 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 | } |