ChangeSet 1.808.2.19, 2002/10/28 11:50:05-08:00, greg@kroah.com USB: fix the usb misc drivers due to interrupt urb no automatic resubmission change to the usb core. diff -Nru a/drivers/usb/misc/auerswald.c b/drivers/usb/misc/auerswald.c --- a/drivers/usb/misc/auerswald.c Mon Oct 28 13:52:48 2002 +++ b/drivers/usb/misc/auerswald.c Mon Oct 28 13:52:48 2002 @@ -1014,30 +1014,39 @@ pauerbuf_t bp = NULL; pauerswald_t cp = (pauerswald_t) urb->context; - dbg ("auerswald_int_complete called"); + dbg ("%s called", __FUNCTION__); - /* do not respond to an error condition */ - if (urb->status != 0) { - dbg ("nonzero URB status = %d", 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; + } /* check if all needed data was received */ if (urb->actual_length < AU_IRQMINSIZE) { dbg ("invalid data length received: %d bytes", urb->actual_length); - return; + goto exit; } /* check the command code */ if (cp->intbufp[0] != AU_IRQCMDID) { dbg ("invalid command received: %d", cp->intbufp[0]); - return; + goto exit; } /* check the command type */ if (cp->intbufp[1] != AU_BLOCKRDY) { dbg ("invalid command type received: %d", cp->intbufp[1]); - return; + goto exit; } /* now extract the information */ @@ -1047,13 +1056,13 @@ /* check the channel id */ if (channelid >= AUH_TYPESIZE) { dbg ("invalid channel id received: %d", channelid); - return; + goto exit; } /* check the byte count */ if (bytecount > (cp->maxControlLength+AUH_SIZE)) { dbg ("invalid byte count received: %d", bytecount); - return; + goto exit; } dbg ("Service Channel = %d", channelid); dbg ("Byte Count = %d", bytecount); @@ -1077,7 +1086,7 @@ The only real solution is: having enought buffers! Or perhaps temporary disabling the int endpoint? */ - return; + goto exit; } /* fill the control message */ @@ -1098,6 +1107,11 @@ auerswald_ctrlread_complete( bp->urbp); /* here applies the same problem as above: device locking! */ } +exit: + ret = usb_submit_urb (urb, GFP_ATOMIC); + if (ret) + err ("%s - usb_submit_urb failed with result %d", + __FUNCTION__, ret); } /* int memory deallocation diff -Nru a/drivers/usb/misc/brlvger.c b/drivers/usb/misc/brlvger.c --- a/drivers/usb/misc/brlvger.c Mon Oct 28 13:52:48 2002 +++ b/drivers/usb/misc/brlvger.c Mon Oct 28 13:52:48 2002 @@ -846,14 +846,21 @@ { struct brlvger_priv *priv = urb->context; int intr_idx, read_idx; + int status; - if( urb->status ) { - if(urb->status == -ETIMEDOUT) - dbg2("Status -ETIMEDOUT, " - "probably disconnected"); - else if(urb->status != -ENOENT) - err("Status: %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; } read_idx = atomic_read(&priv->read_idx); @@ -862,7 +869,7 @@ if(read_idx == intr_idx) { dbg2("Queue full, dropping braille display input"); spin_unlock(&priv->intr_idx_lock); - return; /* queue full */ + goto exit; /* queue full */ } memcpy(priv->event_queue[intr_idx], urb->transfer_buffer, @@ -873,6 +880,12 @@ spin_unlock(&priv->intr_idx_lock); wake_up_interruptible(&priv->read_wait); + +exit: + status = usb_submit_urb (urb, GFP_ATOMIC); + if (status) + err ("%s - usb_submit_urb failed with result %d", + __FUNCTION__, status); } /* ----------------------------------------------------------------------- */