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>
This commit is contained in:

committed by
Greg Kroah-Hartman

orang tua
a108bfcb37
melakukan
1f87158e44
@@ -585,9 +585,6 @@ static int oti6858_open(struct tty_struct *tty, struct usb_serial_port *port)
|
||||
usb_clear_halt(serial->dev, port->write_urb->pipe);
|
||||
usb_clear_halt(serial->dev, port->read_urb->pipe);
|
||||
|
||||
if (port->port.count != 1)
|
||||
return 0;
|
||||
|
||||
buf = kmalloc(OTI6858_CTRL_PKT_SIZE, GFP_KERNEL);
|
||||
if (buf == NULL) {
|
||||
dev_err(&port->dev, "%s(): out of memory!\n", __func__);
|
||||
@@ -934,10 +931,6 @@ static void oti6858_read_bulk_callback(struct urb *urb)
|
||||
spin_unlock_irqrestore(&priv->lock, flags);
|
||||
|
||||
if (status != 0) {
|
||||
if (!port->port.count) {
|
||||
dbg("%s(): port is closed, exiting", __func__);
|
||||
return;
|
||||
}
|
||||
/*
|
||||
if (status == -EPROTO) {
|
||||
* PL2303 mysteriously fails with -EPROTO reschedule
|
||||
@@ -961,14 +954,12 @@ static void oti6858_read_bulk_callback(struct urb *urb)
|
||||
}
|
||||
tty_kref_put(tty);
|
||||
|
||||
/* schedule the interrupt urb if we are still open */
|
||||
if (port->port.count != 0) {
|
||||
port->interrupt_in_urb->dev = port->serial->dev;
|
||||
result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC);
|
||||
if (result != 0) {
|
||||
dev_err(&port->dev, "%s(): usb_submit_urb() failed,"
|
||||
" error %d\n", __func__, result);
|
||||
}
|
||||
/* schedule the interrupt urb */
|
||||
port->interrupt_in_urb->dev = port->serial->dev;
|
||||
result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC);
|
||||
if (result != 0 && result != -EPERM) {
|
||||
dev_err(&port->dev, "%s(): usb_submit_urb() failed,"
|
||||
" error %d\n", __func__, result);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user