ChangeSet 1.808.2.16, 2002/10/28 11:47:41-08:00, greg@kroah.com USB: fix the usb class drivers due to interrupt urb no automatic resubmission change to the usb core diff -Nru a/drivers/usb/class/bluetty.c b/drivers/usb/class/bluetty.c --- a/drivers/usb/class/bluetty.c Mon Oct 28 13:53:26 2002 +++ b/drivers/usb/class/bluetty.c Mon Oct 28 13:53:26 2002 @@ -767,6 +767,7 @@ unsigned int i; unsigned int count = urb->actual_length; unsigned int packet_size; + int status; dbg("%s", __FUNCTION__); @@ -775,14 +776,24 @@ return; } - if (urb->status) { - dbg("%s - nonzero int status received: %d", __FUNCTION__, urb->status); - return; + switch (urb->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", __FUNCTION__, urb->status); + return; + default: + dbg("%s - nonzero urb status received: %d", __FUNCTION__, urb->status); + goto exit; } if (!count) { dbg("%s - zero length int", __FUNCTION__); - return; + goto exit; } @@ -803,7 +814,7 @@ } if (count == 0) { urb->actual_length = 0; - return; + goto exit; } #endif /* We add a packet type identifier to the beginning of each @@ -820,7 +831,7 @@ if (bluetooth->int_packet_pos + count > EVENT_BUFFER_SIZE) { err("%s - exceeded EVENT_BUFFER_SIZE", __FUNCTION__); bluetooth->int_packet_pos = 0; - return; + goto exit; } memcpy (&bluetooth->int_buffer[bluetooth->int_packet_pos], @@ -831,12 +842,12 @@ if (bluetooth->int_packet_pos >= EVENT_HDR_SIZE) packet_size = bluetooth->int_buffer[2]; else - return; + goto exit; if (packet_size + EVENT_HDR_SIZE < bluetooth->int_packet_pos) { err("%s - packet was too long", __FUNCTION__); bluetooth->int_packet_pos = 0; - return; + goto exit; } if (packet_size + EVENT_HDR_SIZE == bluetooth->int_packet_pos) { @@ -851,6 +862,12 @@ bluetooth->int_packet_pos = 0; } + +exit: + status = usb_submit_urb (urb, GFP_ATOMIC); + if (status) + err ("%s - usb_submit_urb failed with result %d", + __FUNCTION__, status); } diff -Nru a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c --- a/drivers/usb/class/cdc-acm.c Mon Oct 28 13:53:26 2002 +++ b/drivers/usb/class/cdc-acm.c Mon Oct 28 13:53:26 2002 @@ -185,20 +185,32 @@ struct usb_ctrlrequest *dr = urb->transfer_buffer; unsigned char *data = (unsigned char *)(dr + 1); int newctrl; + int status; - if (!ACM_READY(acm)) return; - - if (urb->status < 0) { - dbg("nonzero ctrl irq status received: %d", urb->status); + switch (urb->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", __FUNCTION__, urb->status); return; + default: + dbg("%s - nonzero urb status received: %d", __FUNCTION__, urb->status); + goto exit; } + if (!ACM_READY(acm)) + goto exit; + switch (dr->bRequest) { case ACM_IRQ_NETWORK: dbg("%s network", data[0] ? "connected to" : "disconnected from"); - return; + break; case ACM_IRQ_LINE_STATE: @@ -217,13 +229,18 @@ acm->ctrlin & ACM_CTRL_FRAMING ? '+' : '-', acm->ctrlin & ACM_CTRL_PARITY ? '+' : '-', acm->ctrlin & ACM_CTRL_OVERRUN ? '+' : '-'); - return; + break; default: dbg("unknown control event received: request %d index %d len %d data0 %d data1 %d", dr->bRequest, dr->wIndex, dr->wLength, data[0], data[1]); - return; + break; } +exit: + status = usb_submit_urb (urb, GFP_ATOMIC); + if (status) + err ("%s - usb_submit_urb failed with result %d", + __FUNCTION__, status); } static void acm_read_bulk(struct urb *urb)