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/pcmcia | |
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/pcmcia')
-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 9ecd6bef5d3b..8e7c78131e32 100644 --- a/drivers/char/pcmcia/synclink_cs.c +++ b/drivers/char/pcmcia/synclink_cs.c | |||
@@ -2215,6 +2215,32 @@ static int mgslpc_break(struct tty_struct *tty, int break_state) | |||
2215 | return 0; | 2215 | return 0; |
2216 | } | 2216 | } |
2217 | 2217 | ||
2218 | static int mgslpc_get_icount(struct tty_struct *tty, | ||
2219 | struct serial_icounter_struct *icount) | ||
2220 | { | ||
2221 | MGSLPC_INFO * info = (MGSLPC_INFO *)tty->driver_data; | ||
2222 | struct mgsl_icount cnow; /* kernel counter temps */ | ||
2223 | unsigned long flags; | ||
2224 | |||
2225 | spin_lock_irqsave(&info->lock,flags); | ||
2226 | cnow = info->icount; | ||
2227 | spin_unlock_irqrestore(&info->lock,flags); | ||
2228 | |||
2229 | icount->cts = cnow.cts; | ||
2230 | icount->dsr = cnow.dsr; | ||
2231 | icount->rng = cnow.rng; | ||
2232 | icount->dcd = cnow.dcd; | ||
2233 | icount->rx = cnow.rx; | ||
2234 | icount->tx = cnow.tx; | ||
2235 | icount->frame = cnow.frame; | ||
2236 | icount->overrun = cnow.overrun; | ||
2237 | icount->parity = cnow.parity; | ||
2238 | icount->brk = cnow.brk; | ||
2239 | icount->buf_overrun = cnow.buf_overrun; | ||
2240 | |||
2241 | return 0; | ||
2242 | } | ||
2243 | |||
2218 | /* Service an IOCTL request | 2244 | /* Service an IOCTL request |
2219 | * | 2245 | * |
2220 | * Arguments: | 2246 | * Arguments: |
@@ -2230,11 +2256,7 @@ static int mgslpc_ioctl(struct tty_struct *tty, struct file * file, | |||
2230 | unsigned int cmd, unsigned long arg) | 2256 | unsigned int cmd, unsigned long arg) |
2231 | { | 2257 | { |
2232 | MGSLPC_INFO * info = (MGSLPC_INFO *)tty->driver_data; | 2258 | MGSLPC_INFO * info = (MGSLPC_INFO *)tty->driver_data; |
2233 | int error; | ||
2234 | struct mgsl_icount cnow; /* kernel counter temps */ | ||
2235 | struct serial_icounter_struct __user *p_cuser; /* user space */ | ||
2236 | void __user *argp = (void __user *)arg; | 2259 | void __user *argp = (void __user *)arg; |
2237 | unsigned long flags; | ||
2238 | 2260 | ||
2239 | if (debug_level >= DEBUG_LEVEL_INFO) | 2261 | if (debug_level >= DEBUG_LEVEL_INFO) |
2240 | printk("%s(%d):mgslpc_ioctl %s cmd=%08X\n", __FILE__,__LINE__, | 2262 | printk("%s(%d):mgslpc_ioctl %s cmd=%08X\n", __FILE__,__LINE__, |
@@ -2244,7 +2266,7 @@ static int mgslpc_ioctl(struct tty_struct *tty, struct file * file, | |||
2244 | return -ENODEV; | 2266 | return -ENODEV; |
2245 | 2267 | ||
2246 | if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) && | 2268 | if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) && |
2247 | (cmd != TIOCMIWAIT) && (cmd != TIOCGICOUNT)) { | 2269 | (cmd != TIOCMIWAIT)) { |
2248 | if (tty->flags & (1 << TTY_IO_ERROR)) | 2270 | if (tty->flags & (1 << TTY_IO_ERROR)) |
2249 | return -EIO; | 2271 | return -EIO; |
2250 | } | 2272 | } |
@@ -2274,34 +2296,6 @@ static int mgslpc_ioctl(struct tty_struct *tty, struct file * file, | |||
2274 | return wait_events(info, argp); | 2296 | return wait_events(info, argp); |
2275 | case TIOCMIWAIT: | 2297 | case TIOCMIWAIT: |
2276 | return modem_input_wait(info,(int)arg); | 2298 | return modem_input_wait(info,(int)arg); |
2277 | case TIOCGICOUNT: | ||
2278 | spin_lock_irqsave(&info->lock,flags); | ||
2279 | cnow = info->icount; | ||
2280 | spin_unlock_irqrestore(&info->lock,flags); | ||
2281 | p_cuser = argp; | ||
2282 | PUT_USER(error,cnow.cts, &p_cuser->cts); | ||
2283 | if (error) return error; | ||
2284 | PUT_USER(error,cnow.dsr, &p_cuser->dsr); | ||
2285 | if (error) return error; | ||
2286 | PUT_USER(error,cnow.rng, &p_cuser->rng); | ||
2287 | if (error) return error; | ||
2288 | PUT_USER(error,cnow.dcd, &p_cuser->dcd); | ||
2289 | if (error) return error; | ||
2290 | PUT_USER(error,cnow.rx, &p_cuser->rx); | ||
2291 | if (error) return error; | ||
2292 | PUT_USER(error,cnow.tx, &p_cuser->tx); | ||
2293 | if (error) return error; | ||
2294 | PUT_USER(error,cnow.frame, &p_cuser->frame); | ||
2295 | if (error) return error; | ||
2296 | PUT_USER(error,cnow.overrun, &p_cuser->overrun); | ||
2297 | if (error) return error; | ||
2298 | PUT_USER(error,cnow.parity, &p_cuser->parity); | ||
2299 | if (error) return error; | ||
2300 | PUT_USER(error,cnow.brk, &p_cuser->brk); | ||
2301 | if (error) return error; | ||
2302 | PUT_USER(error,cnow.buf_overrun, &p_cuser->buf_overrun); | ||
2303 | if (error) return error; | ||
2304 | return 0; | ||
2305 | default: | 2299 | default: |
2306 | return -ENOIOCTLCMD; | 2300 | return -ENOIOCTLCMD; |
2307 | } | 2301 | } |