This patch (as926) replaces urb->status with urb->core_status, in an attempt to help prevent drivers from abusing the API by polling urb->status. The original field remains for use by drivers, but it isn't set until an URB is about to be handed to its completion routine.
Signed-off-by: Alan Stern <[EMAIL PROTECTED]> --- On Fri, 8 Jun 2007, Greg KH wrote: > > Tell you what -- I'll update the host controller drivers to remove > > them as an obstacle. However I don't currently feel up to modifying > > the signatures for all the USB completion routines in the kernel; > > someone else will have to do that. > > Ok, fair enough, I'll handle that mess, I like that kind of thing :) Here it is, little more than a search-and-replace. Of course, the trick lies in knowing where to search and what that "little more" needs to be! Alan Stern Index: usb-2.6/drivers/usb/core/hcd.c =================================================================== --- usb-2.6.orig/drivers/usb/core/hcd.c +++ usb-2.6/drivers/usb/core/hcd.c @@ -520,8 +520,8 @@ error: /* any errors get returned through the urb completion */ local_irq_save (flags); spin_lock (&urb->lock); - if (urb->status == -EINPROGRESS) - urb->status = status; + if (urb->core_status == -EINPROGRESS) + urb->core_status = status; spin_unlock (&urb->lock); usb_hcd_giveback_urb (hcd, urb); local_irq_restore (flags); @@ -559,10 +559,10 @@ void usb_hcd_poll_rh_status(struct usb_h urb = hcd->status_urb; if (urb) { spin_lock(&urb->lock); - if (urb->status == -EINPROGRESS) { + if (urb->core_status == -EINPROGRESS) { hcd->poll_pending = 0; hcd->status_urb = NULL; - urb->status = 0; + urb->core_status = 0; urb->hcpriv = NULL; urb->actual_length = length; memcpy(urb->transfer_buffer, buffer, length); @@ -606,8 +606,8 @@ static int rh_queue_status (struct usb_h int len = 1 + (urb->dev->maxchild / 8); spin_lock_irqsave (&hcd_root_hub_lock, flags); - if (urb->status != -EINPROGRESS) /* already unlinked */ - retval = urb->status; + if (urb->core_status != -EINPROGRESS) /* already unlinked */ + retval = urb->core_status; else if (hcd->status_urb || urb->transfer_buffer_length < len) { dev_dbg (hcd->self.controller, "not queuing rh status urb\n"); retval = -EINVAL; @@ -934,8 +934,8 @@ int usb_hcd_submit_urb (struct urb *urb, /* * Atomically queue the urb, first to our records, then to the HCD. - * Access to urb->status is controlled by urb->lock ... changes on - * i/o completion (normal or fault) or unlinking. + * Access to urb->core_status is controlled by urb->lock ... changes + * on I/O completion (normal or fault) or unlinking. */ // FIXME: verify that quiescing hc works right (RH cleans up) @@ -950,6 +950,7 @@ int usb_hcd_submit_urb (struct urb *urb, else switch (hcd->state) { case HC_STATE_RUNNING: case HC_STATE_RESUMING: + urb->core_status = -EINPROGRESS; list_add_tail (&urb->urb_list, &ep->urb_list); status = 0; break; @@ -1081,7 +1082,7 @@ int usb_hcd_unlink_urb (struct urb *urb, return -ENODEV; /* - * we contend for urb->status with the hcd core, + * we contend for urb->core_status with the hcd core, * which changes it while returning the urb. * * Caller guaranteed that the urb pointer hasn't been freed, and @@ -1114,7 +1115,7 @@ int usb_hcd_unlink_urb (struct urb *urb, /* Any status except -EINPROGRESS means something already started to * unlink this URB from the hardware. So there's no more work to do. */ - if (urb->status != -EINPROGRESS) { + if (urb->core_status != -EINPROGRESS) { retval = -EBUSY; goto done; } @@ -1132,7 +1133,7 @@ int usb_hcd_unlink_urb (struct urb *urb, set_bit(HCD_FLAG_SAW_IRQ, &hcd->flags); } - urb->status = status; + urb->core_status = status; spin_unlock (&hcd_data_lock); spin_unlock_irqrestore (&urb->lock, flags); @@ -1176,15 +1177,15 @@ rescan: int tmp; /* the urb may already have been unlinked */ - if (urb->status != -EINPROGRESS) + if (urb->core_status != -EINPROGRESS) continue; usb_get_urb (urb); spin_unlock (&hcd_data_lock); spin_lock (&urb->lock); - tmp = urb->status; + tmp = urb->core_status; if (tmp == -EINPROGRESS) - urb->status = -ESHUTDOWN; + urb->core_status = -ESHUTDOWN; spin_unlock (&urb->lock); /* kick hcd unless it's already returning this */ @@ -1419,6 +1420,11 @@ void usb_hcd_giveback_urb (struct usb_hc usbmon_urb_complete (&hcd->self, urb); usb_unanchor_urb(urb); + /* FIXME: The next line should be removed and the status passed + * as an argument to urb->complete(). + */ + urb->status = urb->core_status; + /* pass ownership to the completion handler */ urb->complete (urb); atomic_dec (&urb->use_count); Index: usb-2.6/drivers/usb/mon/mon_bin.c =================================================================== --- usb-2.6.orig/drivers/usb/mon/mon_bin.c +++ usb-2.6/drivers/usb/mon/mon_bin.c @@ -448,7 +448,7 @@ static void mon_bin_event(struct mon_rea ep->id = (unsigned long) urb; ep->ts_sec = ts.tv_sec; ep->ts_usec = ts.tv_usec; - ep->status = urb->status; + ep->status = urb->core_status; ep->len_urb = urb_length; ep->len_cap = length; Index: usb-2.6/drivers/usb/mon/mon_text.c =================================================================== --- usb-2.6.orig/drivers/usb/mon/mon_text.c +++ usb-2.6/drivers/usb/mon/mon_text.c @@ -210,7 +210,7 @@ static void mon_text_event(struct mon_re ep->length = (ev_type == 'S') ? urb->transfer_buffer_length : urb->actual_length; /* Collecting status makes debugging sense for submits, too */ - ep->status = urb->status; + ep->status = urb->core_status; if (usb_pipeint(urb->pipe)) { ep->interval = urb->interval; Index: usb-2.6/include/linux/usb.h =================================================================== --- usb-2.6.orig/include/linux/usb.h +++ usb-2.6/include/linux/usb.h @@ -1175,6 +1175,7 @@ struct urb spinlock_t lock; /* lock for the URB */ void *hcpriv; /* private data for host controller */ atomic_t use_count; /* concurrent submissions counter */ + int core_status; /* private status for usbcore */ u8 reject; /* submissions will fail */ /* public: documented fields in the urb that can be used by drivers */ Index: usb-2.6/drivers/usb/host/ehci-q.c =================================================================== --- usb-2.6.orig/drivers/usb/host/ehci-q.c +++ usb-2.6/drivers/usb/host/ehci-q.c @@ -151,51 +151,51 @@ static void qtd_copy_status ( urb->actual_length += length - QTD_LENGTH (token); /* don't modify error codes */ - if (unlikely (urb->status != -EINPROGRESS)) + if (unlikely(urb->core_status != -EINPROGRESS)) return; /* force cleanup after short read; not always an error */ if (unlikely (IS_SHORT_READ (token))) - urb->status = -EREMOTEIO; + urb->core_status = -EREMOTEIO; /* serious "can't proceed" faults reported by the hardware */ if (token & QTD_STS_HALT) { if (token & QTD_STS_BABBLE) { /* FIXME "must" disable babbling device's port too */ - urb->status = -EOVERFLOW; + urb->core_status = -EOVERFLOW; } else if (token & QTD_STS_MMF) { /* fs/ls interrupt xfer missed the complete-split */ - urb->status = -EPROTO; + urb->core_status = -EPROTO; } else if (token & QTD_STS_DBE) { - urb->status = (QTD_PID (token) == 1) /* IN ? */ + urb->core_status = (QTD_PID(token) == 1) /* IN ? */ ? -ENOSR /* hc couldn't read data */ : -ECOMM; /* hc couldn't write data */ } else if (token & QTD_STS_XACT) { /* timeout, bad crc, wrong PID, etc; retried */ if (QTD_CERR (token)) - urb->status = -EPIPE; + urb->core_status = -EPIPE; else { ehci_dbg (ehci, "devpath %s ep%d%s 3strikes\n", urb->dev->devpath, usb_pipeendpoint (urb->pipe), usb_pipein (urb->pipe) ? "in" : "out"); - urb->status = -EPROTO; + urb->core_status = -EPROTO; } /* CERR nonzero + no errors + halt --> stall */ } else if (QTD_CERR (token)) - urb->status = -EPIPE; + urb->core_status = -EPIPE; else /* unknown */ - urb->status = -EPROTO; + urb->core_status = -EPROTO; ehci_vdbg (ehci, "dev%d ep%d%s qtd token %08x --> status %d\n", usb_pipedevice (urb->pipe), usb_pipeendpoint (urb->pipe), usb_pipein (urb->pipe) ? "in" : "out", - token, urb->status); + token, urb->core_status); /* if async CSPLIT failed, try cleaning out the TT buffer */ - if (urb->status != -EPIPE + if (urb->core_status != -EPIPE && urb->dev->tt && !usb_pipeint (urb->pipe) && ((token & QTD_STS_MMF) != 0 || QTD_CERR(token) == 0) @@ -233,15 +233,15 @@ __acquires(ehci->lock) spin_lock (&urb->lock); urb->hcpriv = NULL; - switch (urb->status) { + switch (urb->core_status) { case -EINPROGRESS: /* success */ - urb->status = 0; + urb->core_status = 0; default: /* fault */ COUNT (ehci->stats.complete); break; case -EREMOTEIO: /* fault or normal */ if (!(urb->transfer_flags & URB_SHORT_NOT_OK)) - urb->status = 0; + urb->core_status = 0; COUNT (ehci->stats.complete); break; case -ECONNRESET: /* canceled */ @@ -257,7 +257,7 @@ __acquires(ehci->lock) __FUNCTION__, urb->dev->devpath, urb, usb_pipeendpoint (urb->pipe), usb_pipein (urb->pipe) ? "in" : "out", - urb->status, + urb->core_status, urb->actual_length, urb->transfer_buffer_length); #endif @@ -362,13 +362,13 @@ qh_completions (struct ehci_hcd *ehci, s stopped = 1; if (unlikely (!HC_IS_RUNNING (ehci_to_hcd(ehci)->state))) - urb->status = -ESHUTDOWN; + urb->core_status = -ESHUTDOWN; /* ignore active urbs unless some previous qtd * for the urb faulted (including short read) or * its urb was canceled. we may patch qh or qtds. */ - if (likely (urb->status == -EINPROGRESS)) + if (likely(urb->core_status == -EINPROGRESS)) continue; /* issue status after short control reads */ @@ -398,7 +398,7 @@ halt: /* remove it from the queue */ spin_lock (&urb->lock); qtd_copy_status (ehci, urb, qtd->length, token); - do_status = (urb->status == -EREMOTEIO) + do_status = (urb->core_status == -EREMOTEIO) && usb_pipecontrol (urb->pipe); spin_unlock (&urb->lock); Index: usb-2.6/drivers/usb/host/isp116x-hcd.c =================================================================== --- usb-2.6.orig/drivers/usb/host/isp116x-hcd.c +++ usb-2.6/drivers/usb/host/isp116x-hcd.c @@ -316,20 +316,21 @@ static void postproc_atl_queue(struct is USB_PID_OUT, PTD_GET_TOGGLE(ptd)); urb->actual_length += PTD_GET_COUNT(ptd); - urb->status = cc_to_error[TD_DATAUNDERRUN]; + urb->core_status = + cc_to_error[TD_DATAUNDERRUN]; spin_unlock(&urb->lock); continue; } } /* Keep underrun error through the STATUS stage */ - if (urb->status == cc_to_error[TD_DATAUNDERRUN]) + if (urb->core_status == cc_to_error[TD_DATAUNDERRUN]) cc = TD_DATAUNDERRUN; if (cc != TD_CC_NOERROR && cc != TD_NOTACCESSED && (++ep->error_count >= 3 || cc == TD_CC_STALL || cc == TD_DATAOVERRUN)) { - if (urb->status == -EINPROGRESS) - urb->status = cc_to_error[cc]; + if (urb->core_status == -EINPROGRESS) + urb->core_status = cc_to_error[cc]; if (ep->nextpid == USB_PID_ACK) ep->nextpid = 0; spin_unlock(&urb->lock); @@ -339,8 +340,8 @@ static void postproc_atl_queue(struct is finishing of the urb. Hey, does this apply only for IN endpoints? */ if (usb_pipeint(urb->pipe) && !PTD_GET_LEN(ptd)) { - if (urb->status == -EINPROGRESS) - urb->status = 0; + if (urb->core_status == -EINPROGRESS) + urb->core_status = 0; spin_unlock(&urb->lock); continue; } @@ -381,8 +382,8 @@ static void postproc_atl_queue(struct is /* All data for this URB is transferred, let's finish */ if (usb_pipecontrol(urb->pipe)) ep->nextpid = USB_PID_ACK; - else if (urb->status == -EINPROGRESS) - urb->status = 0; + else if (urb->core_status == -EINPROGRESS) + urb->core_status = 0; break; case USB_PID_SETUP: if (PTD_GET_ACTIVE(ptd) @@ -402,8 +403,8 @@ static void postproc_atl_queue(struct is if (PTD_GET_ACTIVE(ptd) || (cc != TD_CC_NOERROR && cc < 0x0E)) break; - if (urb->status == -EINPROGRESS) - urb->status = 0; + if (urb->core_status == -EINPROGRESS) + urb->core_status = 0; ep->nextpid = 0; break; default: @@ -588,7 +589,7 @@ static void finish_atl_transfers(struct /* USB_PID_ACK check here avoids finishing of control transfers, for which TD_DATAUNDERRUN occured, while URB_SHORT_NOT_OK was set */ - if (urb && urb->status != -EINPROGRESS + if (urb && urb->core_status != -EINPROGRESS && ep->nextpid != USB_PID_ACK) finish_request(isp116x, ep, urb); } @@ -822,7 +823,7 @@ static int isp116x_urb_enqueue(struct us /* in case of unlink-during-submit */ spin_lock(&urb->lock); - if (urb->status != -EINPROGRESS) { + if (urb->core_status != -EINPROGRESS) { spin_unlock(&urb->lock); finish_request(isp116x, ep, urb); ret = 0; Index: usb-2.6/drivers/usb/host/ohci-dbg.c =================================================================== --- usb-2.6.orig/drivers/usb/host/ohci-dbg.c +++ usb-2.6/drivers/usb/host/ohci-dbg.c @@ -34,7 +34,7 @@ urb_print (struct urb * urb, char * str, } #ifndef OHCI_VERBOSE_DEBUG - if (urb->status != 0) + if (urb->core_status != 0) #endif dbg("%s %p dev=%d ep=%d%s-%s flags=%x len=%d/%d stat=%d", str, @@ -46,7 +46,7 @@ urb_print (struct urb * urb, char * str, urb->transfer_flags, urb->actual_length, urb->transfer_buffer_length, - urb->status); + urb->core_status); #ifdef OHCI_VERBOSE_DEBUG if (!small) { @@ -66,7 +66,7 @@ urb_print (struct urb * urb, char * str, urb->transfer_buffer_length: urb->actual_length; for (i = 0; i < 16 && i < len; i++) printk (" %02x", ((__u8 *) urb->transfer_buffer) [i]); - printk ("%s stat:%d\n", i < len? "...": "", urb->status); + printk("%s stat:%d\n", i < len? "...": "", urb->core_status); } } #endif Index: usb-2.6/drivers/usb/host/ohci-hcd.c =================================================================== --- usb-2.6.orig/drivers/usb/host/ohci-hcd.c +++ usb-2.6/drivers/usb/host/ohci-hcd.c @@ -204,7 +204,7 @@ static int ohci_urb_enqueue ( /* in case of unlink-during-submit */ spin_lock (&urb->lock); - if (urb->status != -EINPROGRESS) { + if (urb->core_status != -EINPROGRESS) { spin_unlock (&urb->lock); urb->hcpriv = urb_priv; finish_urb (ohci, urb); @@ -251,7 +251,7 @@ fail: /* * decouple the URB from the HC queues (TDs, urb_priv); it's - * already marked using urb->status. reporting is always done + * already marked using urb->core_status. reporting is always done * asynchronously, and we might be dealing with an urb that's * partially transferred, or an ED with other urbs being unlinked. */ @@ -796,7 +796,7 @@ static int ohci_restart (struct ohci_hcd } spin_lock (&urb->lock); - urb->status = -ESHUTDOWN; + urb->core_status = -ESHUTDOWN; spin_unlock (&urb->lock); } finish_unlinks (ohci, 0); Index: usb-2.6/drivers/usb/host/ohci-q.c =================================================================== --- usb-2.6.orig/drivers/usb/host/ohci-q.c +++ usb-2.6/drivers/usb/host/ohci-q.c @@ -46,8 +46,8 @@ __acquires(ohci->lock) urb->hcpriv = NULL; spin_lock (&urb->lock); - if (likely (urb->status == -EINPROGRESS)) - urb->status = 0; + if (likely(urb->core_status == -EINPROGRESS)) + urb->core_status = 0; /* report short control reads right even though the data TD always * has TD_R set. (much simpler, but creates the 1-td limit.) */ @@ -55,8 +55,8 @@ __acquires(ohci->lock) && unlikely (usb_pipecontrol (urb->pipe)) && urb->actual_length < urb->transfer_buffer_length && usb_pipein (urb->pipe) - && urb->status == 0) { - urb->status = -EREMOTEIO; + && urb->core_status == 0) { + urb->core_status = -EREMOTEIO; } spin_unlock (&urb->lock); @@ -709,7 +709,7 @@ static void td_submit_urb ( *-------------------------------------------------------------------------*/ /* calculate transfer length/status and update the urb - * PRECONDITION: irqsafe (only for urb->status locking) + * PRECONDITION: irqsafe (only for urb->core_status locking) */ static void td_done (struct ohci_hcd *ohci, struct urb *urb, struct td *td) { @@ -764,8 +764,8 @@ static void td_done (struct ohci_hcd *oh cc = TD_CC_NOERROR; if (cc != TD_CC_NOERROR && cc < 0x0E) { spin_lock (&urb->lock); - if (urb->status == -EINPROGRESS) - urb->status = cc_to_error [cc]; + if (urb->core_status == -EINPROGRESS) + urb->core_status = cc_to_error[cc]; spin_unlock (&urb->lock); } @@ -974,7 +974,7 @@ rescan_this: urb = td->urb; urb_priv = td->urb->hcpriv; - if (urb->status == -EINPROGRESS) { + if (urb->core_status == -EINPROGRESS) { prev = &td->hwNextTD; continue; } Index: usb-2.6/drivers/usb/host/r8a66597-hcd.c =================================================================== --- usb-2.6.orig/drivers/usb/host/r8a66597-hcd.c +++ usb-2.6/drivers/usb/host/r8a66597-hcd.c @@ -776,7 +776,7 @@ static void force_dequeue(struct r8a6659 kfree(td); if (urb) { - urb->status = -ENODEV; + urb->core_status = -ENODEV; urb->hcpriv = NULL; spin_unlock(&r8a66597->lock); usb_hcd_giveback_urb(r8a66597_to_hcd(r8a66597), urb); @@ -1110,7 +1110,7 @@ static void done(struct r8a66597 *r8a665 r8a66597->timeout_map &= ~(1 << pipenum); if (likely(td)) { - if (td->set_address && urb->status != 0) + if (td->set_address && urb->core_status != 0) r8a66597->address_map &= ~(1 << urb->setup_packet[2]); pipe_toggle_save(r8a66597, td->pipe, urb); @@ -1165,7 +1165,7 @@ static void packet_read(struct r8a66597 fifo_change_from_pipe(r8a66597, td->pipe); tmp = r8a66597_read(r8a66597, td->pipe->fifoctr); if (unlikely((tmp & FRDY) == 0)) { - urb->status = -EPIPE; + urb->core_status = -EPIPE; pipe_stop(r8a66597, td->pipe); pipe_irq_disable(r8a66597, pipenum); err("in fifo not ready (%d)", pipenum); @@ -1197,7 +1197,7 @@ static void packet_read(struct r8a66597 td->short_packet = 1; if (urb->transfer_buffer_length != urb->actual_length && urb->transfer_flags & URB_SHORT_NOT_OK) - td->urb->status = -EREMOTEIO; + td->urb->core_status = -EREMOTEIO; } if (usb_pipeisoc(urb->pipe)) { urb->iso_frame_desc[td->iso_cnt].actual_length = size; @@ -1222,8 +1222,8 @@ static void packet_read(struct r8a66597 } if (finish && pipenum != 0) { - if (td->urb->status == -EINPROGRESS) - td->urb->status = 0; + if (td->urb->core_status == -EINPROGRESS) + td->urb->core_status = 0; finish_request(r8a66597, td, pipenum, urb); } } @@ -1243,7 +1243,7 @@ static void packet_write(struct r8a66597 fifo_change_from_pipe(r8a66597, td->pipe); tmp = r8a66597_read(r8a66597, td->pipe->fifoctr); if (unlikely((tmp & FRDY) == 0)) { - urb->status = -EPIPE; + urb->core_status = -EPIPE; pipe_stop(r8a66597, td->pipe); pipe_irq_disable(r8a66597, pipenum); err("out write fifo not ready. (%d)", pipenum); @@ -1305,7 +1305,7 @@ static void check_next_phase(struct r8a6 switch (td->type) { case USB_PID_IN: case USB_PID_OUT: - if (urb->status != -EINPROGRESS) { + if (urb->core_status != -EINPROGRESS) { finish = 1; break; } @@ -1313,11 +1313,11 @@ static void check_next_phase(struct r8a6 td->type = USB_PID_ACK; break; case USB_PID_SETUP: - if (urb->status != -EINPROGRESS) + if (urb->core_status != -EINPROGRESS) finish = 1; else if (urb->transfer_buffer_length == urb->actual_length) { td->type = USB_PID_ACK; - urb->status = 0; + urb->core_status = 0; } else if (usb_pipeout(urb->pipe)) td->type = USB_PID_OUT; else @@ -1325,8 +1325,8 @@ static void check_next_phase(struct r8a6 break; case USB_PID_ACK: finish = 1; - if (urb->status == -EINPROGRESS) - urb->status = 0; + if (urb->core_status == -EINPROGRESS) + urb->core_status = 0; break; } @@ -1344,9 +1344,9 @@ static void set_urb_error(struct r8a6659 u16 pid = r8a66597_read(r8a66597, td->pipe->pipectr) & PID; if (pid == PID_NAK) - td->urb->status = -ECONNRESET; + td->urb->core_status = -ECONNRESET; else - td->urb->status = -EPIPE; + td->urb->core_status = -EPIPE; } } @@ -1415,8 +1415,8 @@ static void irq_pipe_empty(struct r8a665 if ((tmp & INBUFM) == 0) { disable_irq_empty(r8a66597, pipenum); pipe_irq_disable(r8a66597, pipenum); - if (td->urb->status == -EINPROGRESS) - td->urb->status = 0; + if (td->urb->core_status == -EINPROGRESS) + td->urb->core_status = 0; finish_request(r8a66597, td, pipenum, td->urb); } } @@ -1762,7 +1762,7 @@ static int r8a66597_urb_enqueue(struct u list_add_tail(&td->queue, &r8a66597->pipe_queue[td->pipenum]); spin_lock(&urb->lock); - if (urb->status != -EINPROGRESS) { + if (urb->core_status != -EINPROGRESS) { spin_unlock(&urb->lock); ret = -EPIPE; goto error; Index: usb-2.6/drivers/usb/host/sl811-hcd.c =================================================================== --- usb-2.6.orig/drivers/usb/host/sl811-hcd.c +++ usb-2.6/drivers/usb/host/sl811-hcd.c @@ -436,8 +436,8 @@ static void finish_request( ep->nextpid = USB_PID_SETUP; spin_lock(&urb->lock); - if (urb->status == -EINPROGRESS) - urb->status = status; + if (urb->core_status == -EINPROGRESS) + urb->core_status = status; urb->hcpriv = NULL; spin_unlock(&urb->lock); @@ -538,7 +538,7 @@ done(struct sl811 *sl811, struct sl811h_ bank + SL11H_XFERCNTREG); if (len > ep->length) { len = ep->length; - urb->status = -EOVERFLOW; + urb->core_status = -EOVERFLOW; } urb->actual_length += len; sl811_read_buf(sl811, SL811HS_PACKET_BUF(bank == 0), @@ -560,8 +560,8 @@ done(struct sl811 *sl811, struct sl811h_ * this reports the wrong urb status. */ spin_lock(&urb->lock); - if (urb->status == -EINPROGRESS) - urb->status = urbstat; + if (urb->core_status == -EINPROGRESS) + urb->core_status = urbstat; spin_unlock(&urb->lock); urb = NULL; @@ -605,7 +605,8 @@ done(struct sl811 *sl811, struct sl811h_ bank, status, ep, urbstat); } - if (urb && (urbstat != -EINPROGRESS || urb->status != -EINPROGRESS)) + if (urb && (urbstat != -EINPROGRESS || + urb->core_status != -EINPROGRESS)) finish_request(sl811, ep, urb, urbstat); } @@ -953,7 +954,7 @@ static int sl811h_urb_enqueue( /* in case of unlink-during-submit */ spin_lock(&urb->lock); - if (urb->status != -EINPROGRESS) { + if (urb->core_status != -EINPROGRESS) { spin_unlock(&urb->lock); finish_request(sl811, ep, urb, 0); retval = 0; Index: usb-2.6/drivers/usb/host/u132-hcd.c =================================================================== --- usb-2.6.orig/drivers/usb/host/u132-hcd.c +++ usb-2.6/drivers/usb/host/u132-hcd.c @@ -518,7 +518,7 @@ static void u132_hcd_giveback_urb(struct unsigned long irqs; struct usb_hcd *hcd = u132_to_hcd(u132); urb->error_count = 0; - urb->status = status; + urb->core_status = status; urb->hcpriv = NULL; spin_lock_irqsave(&endp->queue_lock.slock, irqs); endp->queue_next += 1; @@ -558,7 +558,7 @@ static void u132_hcd_abandon_urb(struct unsigned long irqs; struct usb_hcd *hcd = u132_to_hcd(u132); urb->error_count = 0; - urb->status = status; + urb->core_status = status; urb->hcpriv = NULL; spin_lock_irqsave(&endp->queue_lock.slock, irqs); endp->queue_next += 1; @@ -646,11 +646,11 @@ static void u132_hcd_interrupt_recv(void return; } else if (u132->going > 0) { dev_err(&u132->platform_dev->dev, "device is being removed urb=" - "%p status=%d\n", urb, urb->status); + "%p status=%d\n", urb, urb->core_status); up(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); return; - } else if (urb->status == -EINPROGRESS) { + } else if (urb->core_status == -EINPROGRESS) { struct u132_ring *ring = endp->ring; u8 *u = urb->transfer_buffer + urb->actual_length; u8 *b = buf; @@ -717,9 +717,9 @@ static void u132_hcd_interrupt_recv(void } } else { dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p statu" - "s=%d\n", urb, urb->status); + "s=%d\n", urb, urb->core_status); up(&u132->scheduler_lock); - u132_hcd_giveback_urb(u132, endp, urb, urb->status); + u132_hcd_giveback_urb(u132, endp, urb, urb->core_status); return; } } @@ -745,11 +745,11 @@ static void u132_hcd_bulk_output_sent(vo return; } else if (u132->going > 0) { dev_err(&u132->platform_dev->dev, "device is being removed urb=" - "%p status=%d\n", urb, urb->status); + "%p status=%d\n", urb, urb->core_status); up(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); return; - } else if (urb->status == -EINPROGRESS) { + } else if (urb->core_status == -EINPROGRESS) { struct u132_ring *ring = endp->ring; urb->actual_length += len; endp->toggle_bits = toggle_bits; @@ -769,9 +769,9 @@ static void u132_hcd_bulk_output_sent(vo } } else { dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p statu" - "s=%d\n", urb, urb->status); + "s=%d\n", urb, urb->core_status); up(&u132->scheduler_lock); - u132_hcd_giveback_urb(u132, endp, urb, urb->status); + u132_hcd_giveback_urb(u132, endp, urb, urb->core_status); return; } } @@ -798,11 +798,11 @@ static void u132_hcd_bulk_input_recv(voi return; } else if (u132->going > 0) { dev_err(&u132->platform_dev->dev, "device is being removed urb=" - "%p status=%d\n", urb, urb->status); + "%p status=%d\n", urb, urb->core_status); up(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); return; - } else if (urb->status == -EINPROGRESS) { + } else if (urb->core_status == -EINPROGRESS) { struct u132_ring *ring = endp->ring; u8 *u = urb->transfer_buffer + urb->actual_length; u8 *b = buf; @@ -872,9 +872,9 @@ static void u132_hcd_bulk_input_recv(voi } } else { dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p statu" - "s=%d\n", urb, urb->status); + "s=%d\n", urb, urb->core_status); up(&u132->scheduler_lock); - u132_hcd_giveback_urb(u132, endp, urb, urb->status); + u132_hcd_giveback_urb(u132, endp, urb, urb->core_status); return; } } @@ -899,19 +899,19 @@ static void u132_hcd_configure_empty_sen return; } else if (u132->going > 0) { dev_err(&u132->platform_dev->dev, "device is being removed urb=" - "%p status=%d\n", urb, urb->status); + "%p status=%d\n", urb, urb->core_status); up(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); return; - } else if (urb->status == -EINPROGRESS) { + } else if (urb->core_status == -EINPROGRESS) { up(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, 0); return; } else { dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p statu" - "s=%d\n", urb, urb->status); + "s=%d\n", urb, urb->core_status); up(&u132->scheduler_lock); - u132_hcd_giveback_urb(u132, endp, urb, urb->status); + u132_hcd_giveback_urb(u132, endp, urb, urb->core_status); return; } } @@ -937,11 +937,11 @@ static void u132_hcd_configure_input_rec return; } else if (u132->going > 0) { dev_err(&u132->platform_dev->dev, "device is being removed urb=" - "%p status=%d\n", urb, urb->status); + "%p status=%d\n", urb, urb->core_status); up(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); return; - } else if (urb->status == -EINPROGRESS) { + } else if (urb->core_status == -EINPROGRESS) { struct u132_ring *ring = endp->ring; u8 *u = urb->transfer_buffer; u8 *b = buf; @@ -981,9 +981,9 @@ static void u132_hcd_configure_input_rec } } else { dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p statu" - "s=%d\n", urb, urb->status); + "s=%d\n", urb, urb->core_status); up(&u132->scheduler_lock); - u132_hcd_giveback_urb(u132, endp, urb, urb->status); + u132_hcd_giveback_urb(u132, endp, urb, urb->core_status); return; } } @@ -1008,19 +1008,19 @@ static void u132_hcd_configure_empty_rec return; } else if (u132->going > 0) { dev_err(&u132->platform_dev->dev, "device is being removed urb=" - "%p status=%d\n", urb, urb->status); + "%p status=%d\n", urb, urb->core_status); up(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); return; - } else if (urb->status == -EINPROGRESS) { + } else if (urb->core_status == -EINPROGRESS) { up(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, 0); return; } else { dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p statu" - "s=%d\n", urb, urb->status); + "s=%d\n", urb, urb->core_status); up(&u132->scheduler_lock); - u132_hcd_giveback_urb(u132, endp, urb, urb->status); + u132_hcd_giveback_urb(u132, endp, urb, urb->core_status); return; } } @@ -1046,11 +1046,11 @@ static void u132_hcd_configure_setup_sen return; } else if (u132->going > 0) { dev_err(&u132->platform_dev->dev, "device is being removed urb=" - "%p status=%d\n", urb, urb->status); + "%p status=%d\n", urb, urb->core_status); up(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); return; - } else if (urb->status == -EINPROGRESS) { + } else if (urb->core_status == -EINPROGRESS) { if (usb_pipein(urb->pipe)) { int retval; struct u132_ring *ring = endp->ring; @@ -1078,9 +1078,9 @@ static void u132_hcd_configure_setup_sen } } else { dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p statu" - "s=%d\n", urb, urb->status); + "s=%d\n", urb, urb->core_status); up(&u132->scheduler_lock); - u132_hcd_giveback_urb(u132, endp, urb, urb->status); + u132_hcd_giveback_urb(u132, endp, urb, urb->core_status); return; } } @@ -1107,11 +1107,11 @@ static void u132_hcd_enumeration_empty_r return; } else if (u132->going > 0) { dev_err(&u132->platform_dev->dev, "device is being removed urb=" - "%p status=%d\n", urb, urb->status); + "%p status=%d\n", urb, urb->core_status); up(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); return; - } else if (urb->status == -EINPROGRESS) { + } else if (urb->core_status == -EINPROGRESS) { u132->addr[0].address = 0; endp->usb_addr = udev->usb_addr; up(&u132->scheduler_lock); @@ -1119,9 +1119,9 @@ static void u132_hcd_enumeration_empty_r return; } else { dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p statu" - "s=%d\n", urb, urb->status); + "s=%d\n", urb, urb->core_status); up(&u132->scheduler_lock); - u132_hcd_giveback_urb(u132, endp, urb, urb->status); + u132_hcd_giveback_urb(u132, endp, urb, urb->core_status); return; } } @@ -1146,11 +1146,11 @@ static void u132_hcd_enumeration_address return; } else if (u132->going > 0) { dev_err(&u132->platform_dev->dev, "device is being removed urb=" - "%p status=%d\n", urb, urb->status); + "%p status=%d\n", urb, urb->core_status); up(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); return; - } else if (urb->status == -EINPROGRESS) { + } else if (urb->core_status == -EINPROGRESS) { int retval; struct u132_ring *ring = endp->ring; up(&u132->scheduler_lock); @@ -1163,9 +1163,9 @@ static void u132_hcd_enumeration_address return; } else { dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p statu" - "s=%d\n", urb, urb->status); + "s=%d\n", urb, urb->core_status); up(&u132->scheduler_lock); - u132_hcd_giveback_urb(u132, endp, urb, urb->status); + u132_hcd_giveback_urb(u132, endp, urb, urb->core_status); return; } } @@ -1190,19 +1190,19 @@ static void u132_hcd_initial_empty_sent( return; } else if (u132->going > 0) { dev_err(&u132->platform_dev->dev, "device is being removed urb=" - "%p status=%d\n", urb, urb->status); + "%p status=%d\n", urb, urb->core_status); up(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); return; - } else if (urb->status == -EINPROGRESS) { + } else if (urb->core_status == -EINPROGRESS) { up(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, 0); return; } else { dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p statu" - "s=%d\n", urb, urb->status); + "s=%d\n", urb, urb->core_status); up(&u132->scheduler_lock); - u132_hcd_giveback_urb(u132, endp, urb, urb->status); + u132_hcd_giveback_urb(u132, endp, urb, urb->core_status); return; } } @@ -1228,11 +1228,11 @@ static void u132_hcd_initial_input_recv( return; } else if (u132->going > 0) { dev_err(&u132->platform_dev->dev, "device is being removed urb=" - "%p status=%d\n", urb, urb->status); + "%p status=%d\n", urb, urb->core_status); up(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); return; - } else if (urb->status == -EINPROGRESS) { + } else if (urb->core_status == -EINPROGRESS) { int retval; struct u132_ring *ring = endp->ring; u8 *u = urb->transfer_buffer; @@ -1252,9 +1252,9 @@ static void u132_hcd_initial_input_recv( return; } else { dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p statu" - "s=%d\n", urb, urb->status); + "s=%d\n", urb, urb->core_status); up(&u132->scheduler_lock); - u132_hcd_giveback_urb(u132, endp, urb, urb->status); + u132_hcd_giveback_urb(u132, endp, urb, urb->core_status); return; } } @@ -1280,11 +1280,11 @@ static void u132_hcd_initial_setup_sent( return; } else if (u132->going > 0) { dev_err(&u132->platform_dev->dev, "device is being removed urb=" - "%p status=%d\n", urb, urb->status); + "%p status=%d\n", urb, urb->core_status); up(&u132->scheduler_lock); u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); return; - } else if (urb->status == -EINPROGRESS) { + } else if (urb->core_status == -EINPROGRESS) { int retval; struct u132_ring *ring = endp->ring; up(&u132->scheduler_lock); @@ -1297,9 +1297,9 @@ static void u132_hcd_initial_setup_sent( return; } else { dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p statu" - "s=%d\n", urb, urb->status); + "s=%d\n", urb, urb->core_status); up(&u132->scheduler_lock); - u132_hcd_giveback_urb(u132, endp, urb, urb->status); + u132_hcd_giveback_urb(u132, endp, urb, urb->core_status); return; } } @@ -2246,7 +2246,7 @@ static int u132_urb_enqueue(struct usb_h return -ENODEV; } else if (u132->going > 0) { dev_err(&u132->platform_dev->dev, "device is being removed urb=" - "%p status=%d\n", urb, urb->status); + "%p status=%d\n", urb, urb->core_status); return -ESHUTDOWN; } else { u8 usb_addr = usb_pipedevice(urb->pipe); @@ -2410,7 +2410,7 @@ static int u132_endp_urb_dequeue(struct return 0; } else { spin_unlock_irqrestore(&endp->queue_lock.slock, irqs); - u132_hcd_abandon_urb(u132, endp, urb, urb->status); + u132_hcd_abandon_urb(u132, endp, urb, urb->core_status); return 0; } } else { Index: usb-2.6/drivers/usb/host/uhci-debug.c =================================================================== --- usb-2.6.orig/drivers/usb/host/uhci-debug.c +++ usb-2.6/drivers/usb/host/uhci-debug.c @@ -120,8 +120,8 @@ static int uhci_show_urbp(struct urb_pri out += sprintf(out, "%s%s", ptype, (urbp->fsbr ? " FSBR" : "")); out += sprintf(out, " Actlen=%d", urbp->urb->actual_length); - if (urbp->urb->status != -EINPROGRESS) - out += sprintf(out, " Status=%d", urbp->urb->status); + if (urbp->urb->core_status != -EINPROGRESS) + out += sprintf(out, " Status=%d", urbp->urb->core_status); out += sprintf(out, "\n"); i = nactive = ninactive = 0; Index: usb-2.6/drivers/usb/host/uhci-hcd.h =================================================================== --- usb-2.6.orig/drivers/usb/host/uhci-hcd.h +++ usb-2.6/drivers/usb/host/uhci-hcd.h @@ -461,7 +461,7 @@ struct urb_priv { * Locking in uhci.c * * Almost everything relating to the hardware schedule and processing - * of URBs is protected by uhci->lock. urb->status is protected by + * of URBs is protected by uhci->lock. urb->core_status is protected by * urb->lock; that's the one exception. * * To prevent deadlocks, never lock uhci->lock while holding urb->lock. Index: usb-2.6/drivers/usb/host/uhci-q.c =================================================================== --- usb-2.6.orig/drivers/usb/host/uhci-q.c +++ usb-2.6/drivers/usb/host/uhci-q.c @@ -1386,7 +1386,7 @@ static int uhci_urb_enqueue(struct usb_h spin_lock_irqsave(&uhci->lock, flags); - ret = urb->status; + ret = urb->core_status; if (ret != -EINPROGRESS) /* URB already unlinked! */ goto done; @@ -1551,8 +1551,8 @@ static void uhci_scan_qh(struct uhci_hcd break; spin_lock(&urb->lock); - if (urb->status == -EINPROGRESS) /* Not dequeued */ - urb->status = status; + if (urb->core_status == -EINPROGRESS) /* Not dequeued */ + urb->core_status = status; else status = ECONNRESET; /* Not -ECONNRESET */ spin_unlock(&urb->lock); @@ -1582,7 +1582,7 @@ static void uhci_scan_qh(struct uhci_hcd restart: list_for_each_entry(urbp, &qh->queue, node) { urb = urbp->urb; - if (urb->status != -EINPROGRESS) { + if (urb->core_status != -EINPROGRESS) { /* Fix up the TD links and save the toggles for * non-Isochronous queues. For Isochronous queues, Index: usb-2.6/drivers/usb/gadget/dummy_hcd.c =================================================================== --- usb-2.6.orig/drivers/usb/gadget/dummy_hcd.c +++ usb-2.6/drivers/usb/gadget/dummy_hcd.c @@ -1056,8 +1056,8 @@ static int dummy_urb_dequeue (struct usb static void maybe_set_status (struct urb *urb, int status) { spin_lock (&urb->lock); - if (urb->status == -EINPROGRESS) - urb->status = status; + if (urb->core_status == -EINPROGRESS) + urb->core_status = status; spin_unlock (&urb->lock); } @@ -1175,7 +1175,7 @@ top: } /* host side completion --> terminate */ - if (urb->status != -EINPROGRESS) + if (urb->core_status != -EINPROGRESS) break; /* rescan to continue with any other queued i/o */ @@ -1288,7 +1288,7 @@ restart: int type; urb = urbp->urb; - if (urb->status != -EINPROGRESS) { + if (urb->core_status != -EINPROGRESS) { /* likely it was just unlinked */ goto return_urb; } else if (dum->rh_state != DUMMY_RH_RUNNING) @@ -1539,7 +1539,7 @@ restart: } /* incomplete transfer? */ - if (urb->status == -EINPROGRESS) + if (urb->core_status == -EINPROGRESS) continue; return_urb: ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel