diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2010-02-17 16:05:47 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-03-02 23:55:12 +0100 |
commit | 1f87158e44e79e62c8250f278c225ce4ab695f4b (patch) | |
tree | eff328f63a75993a3e1ffbba9c9f0ba1fecf0edb /drivers/usb/serial/digi_acceleport.c | |
parent | USB: tty: Prune uses of tty_request_room in the USB layer (diff) | |
download | linux-1f87158e44e79e62c8250f278c225ce4ab695f4b.tar.xz linux-1f87158e44e79e62c8250f278c225ce4ab695f4b.zip |
USB: remove references to port->port.count from the serial drivers
This patch (as1344) removes references to port->port.count from the
USB serial drivers. Now that serial ports are properly reference
counted, port.count checking is unnecessary and incorrect. Drivers
should assume that the port is in use from the time the open method
runs until the close method is called.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/serial/digi_acceleport.c')
-rw-r--r-- | drivers/usb/serial/digi_acceleport.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c index 381722858424..68b0aa5e516c 100644 --- a/drivers/usb/serial/digi_acceleport.c +++ b/drivers/usb/serial/digi_acceleport.c @@ -1262,10 +1262,10 @@ static void digi_write_bulk_callback(struct urb *urb) return; } - /* try to send any buffered data on this port, if it is open */ + /* try to send any buffered data on this port */ spin_lock(&priv->dp_port_lock); priv->dp_write_urb_in_use = 0; - if (port->port.count && priv->dp_out_buf_len > 0) { + if (priv->dp_out_buf_len > 0) { *((unsigned char *)(port->write_urb->transfer_buffer)) = (unsigned char)DIGI_CMD_SEND_DATA; *((unsigned char *)(port->write_urb->transfer_buffer) + 1) @@ -1288,7 +1288,7 @@ static void digi_write_bulk_callback(struct urb *urb) schedule_work(&priv->dp_wakeup_work); spin_unlock(&priv->dp_port_lock); - if (ret) + if (ret && ret != -EPERM) dev_err(&port->dev, "%s: usb_submit_urb failed, ret=%d, port=%d\n", __func__, ret, priv->dp_port_num); @@ -1353,8 +1353,7 @@ static int digi_open(struct tty_struct *tty, struct usb_serial_port *port) struct digi_port *priv = usb_get_serial_port_data(port); struct ktermios not_termios; - dbg("digi_open: TOP: port=%d, open_count=%d", - priv->dp_port_num, port->port.count); + dbg("digi_open: TOP: port=%d", priv->dp_port_num); /* be sure the device is started up */ if (digi_startup_device(port->serial) != 0) @@ -1393,8 +1392,7 @@ static void digi_close(struct usb_serial_port *port) unsigned char buf[32]; struct digi_port *priv = usb_get_serial_port_data(port); - dbg("digi_close: TOP: port=%d, open_count=%d", - priv->dp_port_num, port->port.count); + dbg("digi_close: TOP: port=%d", priv->dp_port_num); mutex_lock(&port->serial->disc_mutex); /* if disconnected, just clear flags */ @@ -1629,7 +1627,7 @@ static void digi_read_bulk_callback(struct urb *urb) /* continue read */ urb->dev = port->serial->dev; ret = usb_submit_urb(urb, GFP_ATOMIC); - if (ret != 0) { + if (ret != 0 && ret != -EPERM) { dev_err(&port->dev, "%s: failed resubmitting urb, ret=%d, port=%d\n", __func__, ret, priv->dp_port_num); @@ -1662,7 +1660,7 @@ static int digi_read_inb_callback(struct urb *urb) /* do not process callbacks on closed ports */ /* but do continue the read chain */ - if (port->port.count == 0) + if (urb->status == -ENOENT) return 0; /* short/multiple packet check */ @@ -1767,8 +1765,7 @@ static int digi_read_oob_callback(struct urb *urb) tty = tty_port_tty_get(&port->port); rts = 0; - if (port->port.count) - rts = tty->termios->c_cflag & CRTSCTS; + rts = tty->termios->c_cflag & CRTSCTS; if (opcode == DIGI_CMD_READ_INPUT_SIGNALS) { spin_lock(&priv->dp_port_lock); |