diff options
Diffstat (limited to 'drivers/usb/serial/mos7840.c')
-rw-r--r-- | drivers/usb/serial/mos7840.c | 66 |
1 files changed, 32 insertions, 34 deletions
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c index 1a42bc213799..7b50aa122752 100644 --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c | |||
@@ -1367,8 +1367,6 @@ static void mos7840_break(struct tty_struct *tty, int break_state) | |||
1367 | mos7840_port->shadowLCR); | 1367 | mos7840_port->shadowLCR); |
1368 | mos7840_set_uart_reg(port, LINE_CONTROL_REGISTER, | 1368 | mos7840_set_uart_reg(port, LINE_CONTROL_REGISTER, |
1369 | mos7840_port->shadowLCR); | 1369 | mos7840_port->shadowLCR); |
1370 | |||
1371 | return; | ||
1372 | } | 1370 | } |
1373 | 1371 | ||
1374 | /***************************************************************************** | 1372 | /***************************************************************************** |
@@ -1599,8 +1597,6 @@ static void mos7840_throttle(struct tty_struct *tty) | |||
1599 | if (status < 0) | 1597 | if (status < 0) |
1600 | return; | 1598 | return; |
1601 | } | 1599 | } |
1602 | |||
1603 | return; | ||
1604 | } | 1600 | } |
1605 | 1601 | ||
1606 | /***************************************************************************** | 1602 | /***************************************************************************** |
@@ -1648,7 +1644,7 @@ static void mos7840_unthrottle(struct tty_struct *tty) | |||
1648 | } | 1644 | } |
1649 | } | 1645 | } |
1650 | 1646 | ||
1651 | static int mos7840_tiocmget(struct tty_struct *tty, struct file *file) | 1647 | static int mos7840_tiocmget(struct tty_struct *tty) |
1652 | { | 1648 | { |
1653 | struct usb_serial_port *port = tty->driver_data; | 1649 | struct usb_serial_port *port = tty->driver_data; |
1654 | struct moschip_port *mos7840_port; | 1650 | struct moschip_port *mos7840_port; |
@@ -1678,7 +1674,7 @@ static int mos7840_tiocmget(struct tty_struct *tty, struct file *file) | |||
1678 | return result; | 1674 | return result; |
1679 | } | 1675 | } |
1680 | 1676 | ||
1681 | static int mos7840_tiocmset(struct tty_struct *tty, struct file *file, | 1677 | static int mos7840_tiocmset(struct tty_struct *tty, |
1682 | unsigned int set, unsigned int clear) | 1678 | unsigned int set, unsigned int clear) |
1683 | { | 1679 | { |
1684 | struct usb_serial_port *port = tty->driver_data; | 1680 | struct usb_serial_port *port = tty->driver_data; |
@@ -2075,8 +2071,6 @@ static void mos7840_change_port_settings(struct tty_struct *tty, | |||
2075 | mos7840_port->delta_msr_cond = 1; | 2071 | mos7840_port->delta_msr_cond = 1; |
2076 | dbg("mos7840_change_port_settings mos7840_port->shadowLCR is End %x", | 2072 | dbg("mos7840_change_port_settings mos7840_port->shadowLCR is End %x", |
2077 | mos7840_port->shadowLCR); | 2073 | mos7840_port->shadowLCR); |
2078 | |||
2079 | return; | ||
2080 | } | 2074 | } |
2081 | 2075 | ||
2082 | /***************************************************************************** | 2076 | /***************************************************************************** |
@@ -2145,7 +2139,6 @@ static void mos7840_set_termios(struct tty_struct *tty, | |||
2145 | mos7840_port->read_urb_busy = false; | 2139 | mos7840_port->read_urb_busy = false; |
2146 | } | 2140 | } |
2147 | } | 2141 | } |
2148 | return; | ||
2149 | } | 2142 | } |
2150 | 2143 | ||
2151 | /***************************************************************************** | 2144 | /***************************************************************************** |
@@ -2209,12 +2202,40 @@ static int mos7840_get_serial_info(struct moschip_port *mos7840_port, | |||
2209 | return 0; | 2202 | return 0; |
2210 | } | 2203 | } |
2211 | 2204 | ||
2205 | static int mos7840_get_icount(struct tty_struct *tty, | ||
2206 | struct serial_icounter_struct *icount) | ||
2207 | { | ||
2208 | struct usb_serial_port *port = tty->driver_data; | ||
2209 | struct moschip_port *mos7840_port; | ||
2210 | struct async_icount cnow; | ||
2211 | |||
2212 | mos7840_port = mos7840_get_port_private(port); | ||
2213 | cnow = mos7840_port->icount; | ||
2214 | |||
2215 | smp_rmb(); | ||
2216 | icount->cts = cnow.cts; | ||
2217 | icount->dsr = cnow.dsr; | ||
2218 | icount->rng = cnow.rng; | ||
2219 | icount->dcd = cnow.dcd; | ||
2220 | icount->rx = cnow.rx; | ||
2221 | icount->tx = cnow.tx; | ||
2222 | icount->frame = cnow.frame; | ||
2223 | icount->overrun = cnow.overrun; | ||
2224 | icount->parity = cnow.parity; | ||
2225 | icount->brk = cnow.brk; | ||
2226 | icount->buf_overrun = cnow.buf_overrun; | ||
2227 | |||
2228 | dbg("%s (%d) TIOCGICOUNT RX=%d, TX=%d", __func__, | ||
2229 | port->number, icount->rx, icount->tx); | ||
2230 | return 0; | ||
2231 | } | ||
2232 | |||
2212 | /***************************************************************************** | 2233 | /***************************************************************************** |
2213 | * SerialIoctl | 2234 | * SerialIoctl |
2214 | * this function handles any ioctl calls to the driver | 2235 | * this function handles any ioctl calls to the driver |
2215 | *****************************************************************************/ | 2236 | *****************************************************************************/ |
2216 | 2237 | ||
2217 | static int mos7840_ioctl(struct tty_struct *tty, struct file *file, | 2238 | static int mos7840_ioctl(struct tty_struct *tty, |
2218 | unsigned int cmd, unsigned long arg) | 2239 | unsigned int cmd, unsigned long arg) |
2219 | { | 2240 | { |
2220 | struct usb_serial_port *port = tty->driver_data; | 2241 | struct usb_serial_port *port = tty->driver_data; |
@@ -2223,7 +2244,6 @@ static int mos7840_ioctl(struct tty_struct *tty, struct file *file, | |||
2223 | 2244 | ||
2224 | struct async_icount cnow; | 2245 | struct async_icount cnow; |
2225 | struct async_icount cprev; | 2246 | struct async_icount cprev; |
2226 | struct serial_icounter_struct icount; | ||
2227 | 2247 | ||
2228 | if (mos7840_port_paranoia_check(port, __func__)) { | 2248 | if (mos7840_port_paranoia_check(port, __func__)) { |
2229 | dbg("%s", "Invalid port"); | 2249 | dbg("%s", "Invalid port"); |
@@ -2282,29 +2302,6 @@ static int mos7840_ioctl(struct tty_struct *tty, struct file *file, | |||
2282 | /* NOTREACHED */ | 2302 | /* NOTREACHED */ |
2283 | break; | 2303 | break; |
2284 | 2304 | ||
2285 | case TIOCGICOUNT: | ||
2286 | cnow = mos7840_port->icount; | ||
2287 | smp_rmb(); | ||
2288 | |||
2289 | memset(&icount, 0, sizeof(struct serial_icounter_struct)); | ||
2290 | |||
2291 | icount.cts = cnow.cts; | ||
2292 | icount.dsr = cnow.dsr; | ||
2293 | icount.rng = cnow.rng; | ||
2294 | icount.dcd = cnow.dcd; | ||
2295 | icount.rx = cnow.rx; | ||
2296 | icount.tx = cnow.tx; | ||
2297 | icount.frame = cnow.frame; | ||
2298 | icount.overrun = cnow.overrun; | ||
2299 | icount.parity = cnow.parity; | ||
2300 | icount.brk = cnow.brk; | ||
2301 | icount.buf_overrun = cnow.buf_overrun; | ||
2302 | |||
2303 | dbg("%s (%d) TIOCGICOUNT RX=%d, TX=%d", __func__, | ||
2304 | port->number, icount.rx, icount.tx); | ||
2305 | if (copy_to_user(argp, &icount, sizeof(icount))) | ||
2306 | return -EFAULT; | ||
2307 | return 0; | ||
2308 | default: | 2305 | default: |
2309 | break; | 2306 | break; |
2310 | } | 2307 | } |
@@ -2674,6 +2671,7 @@ static struct usb_serial_driver moschip7840_4port_device = { | |||
2674 | .break_ctl = mos7840_break, | 2671 | .break_ctl = mos7840_break, |
2675 | .tiocmget = mos7840_tiocmget, | 2672 | .tiocmget = mos7840_tiocmget, |
2676 | .tiocmset = mos7840_tiocmset, | 2673 | .tiocmset = mos7840_tiocmset, |
2674 | .get_icount = mos7840_get_icount, | ||
2677 | .attach = mos7840_startup, | 2675 | .attach = mos7840_startup, |
2678 | .disconnect = mos7840_disconnect, | 2676 | .disconnect = mos7840_disconnect, |
2679 | .release = mos7840_release, | 2677 | .release = mos7840_release, |