On Sun, 21 Mar 2010, James Maki wrote: > All unsuccessful (non-zero status) URBs were being dropped. After N_IN_URBs are > dropped you will no longer be able to receive data. > > This patch resubmits unsuccessful URBs unless the status indicates that it should > be terminated. The statuses that indicate the URB should be terminated was > gathered from other similar drivers. > > Please CC James Maki <jamescmaki@xxxxxxxxx> You don't need this line in the Changelog, because your name and email address will automatically show up as the author of the patch. > Signed-off-by: James Maki <jamescmaki@xxxxxxxxx> > --- > drivers/usb/serial/option.c | 51 ++++++++++++++++++++++++++---------------- > 1 files changed, 31 insertions(+), 20 deletions(-) > > diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c > index 950cb31..f2f6a60 100644 > --- a/drivers/usb/serial/option.c > +++ b/drivers/usb/serial/option.c > @@ -1008,31 +1008,42 @@ static void option_indat_callback(struct urb *urb) > dbg("%s: %p", __func__, urb); > > endpoint = usb_pipeendpoint(urb->pipe); > - port = urb->context; > - > - if (status) { > + port = urb->context; > + > + switch (status) { > + case 0: > + /* success */ > + break; > + case -ECONNRESET: > + case -ENOENT: > + case -ESHUTDOWN: > + /* this urb is terminated, clean up */ > + dbg("%s: urb shutting down with status: %d on endpoint %02x.", > + __func__, status, endpoint); > + return; > + default: > dbg("%s: nonzero status: %d on endpoint %02x.", > __func__, status, endpoint); > - } else { > + goto exit; You might want to omit this goto. In principle a failed URB can still contain some valid data. > + } > + > + if (urb->actual_length) { > tty = tty_port_tty_get(&port->port); > - if (urb->actual_length) { > - tty_insert_flip_string(tty, data, urb->actual_length); > - tty_flip_buffer_push(tty); > - } else > - dbg("%s: empty read urb received", __func__); > + tty_insert_flip_string(tty, data, urb->actual_length); > + tty_flip_buffer_push(tty); > tty_kref_put(tty); > + } else And then you would want to change this to: } else if (status == 0) > + dbg("%s: empty read urb received", __func__); > > - /* Resubmit urb so we continue receiving */ > - if (status != -ESHUTDOWN) { > - err = usb_submit_urb(urb, GFP_ATOMIC); > - if (err && err != -EPERM) > - printk(KERN_ERR "%s: resubmit read urb failed. " > - "(%d)", __func__, err); > - else > - usb_mark_last_busy(port->serial->dev); > - } > +exit: > + /* Resubmit urb so we continue receiving */ > + err = usb_submit_urb(urb, GFP_ATOMIC); > + if (err && err != -EPERM) > + printk(KERN_ERR "%s: resubmit read urb failed. " > + "(%d)", __func__, err); > + else > + usb_mark_last_busy(port->serial->dev); > > - } > return; > } As long as you're changing the code here, you might as well remove this useless "return" statement. Alan Stenr -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html