Commit 52a23685 authored by Linus Torvalds's avatar Linus Torvalds

Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6

* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6: (44 commits)
  USB: drivers/usb/storage/dpcm.c whitespace cleanup
  USB: r8a66597-hcd: fixes some problem
  USB: change name of spinlock in hcd.c
  USB: move routines in hcd.c
  USB: misc: uss720: clean up urb->status usage
  USB: misc: usbtest: clean up urb->status usage
  USB: misc: usblcd: clean up urb->status usage
  USB: misc: phidgetmotorcontrol: clean up urb->status usage
  USB: misc: phidgetkit: clean up urb->status usage
  USB: misc: legousbtower: clean up urb->status usage
  USB: misc: ldusb: clean up urb->status usage
  USB: misc: iowarrior: clean up urb->status usage
  USB: misc: ftdi-elan: clean up urb->status usage
  USB: misc: auerswald: clean up urb->status usage
  USB: misc: appledisplay: clean up urb->status usage
  USB: misc: adtux: clean up urb->status usage
  USB: core: message: clean up urb->status usage
  USB: image: microtek: clean up urb->status usage
  USB: image: mdc800: clean up urb->status usage
  USB: storage: onetouch: clean up urb->status usage
  ...
parents d046943c d20da3c3
...@@ -329,6 +329,12 @@ P: Ivan Kokshaysky ...@@ -329,6 +329,12 @@ P: Ivan Kokshaysky
M: ink@jurassic.park.msu.ru M: ink@jurassic.park.msu.ru
S: Maintained for 2.4; PCI support for 2.6. S: Maintained for 2.4; PCI support for 2.6.
AMD GEODE CS5536 USB DEVICE CONTROLLER DRIVER
P: Thomas Dahlmann
M: thomas.dahlmann@amd.com
L: info-linux@geode.amd.com
S: Supported
AMD GEODE PROCESSOR/CHIPSET SUPPORT AMD GEODE PROCESSOR/CHIPSET SUPPORT
P: Jordan Crouse P: Jordan Crouse
M: info-linux@geode.amd.com M: info-linux@geode.amd.com
......
...@@ -456,7 +456,7 @@ static int cxacru_start_wait_urb(struct urb *urb, struct completion *done, ...@@ -456,7 +456,7 @@ static int cxacru_start_wait_urb(struct urb *urb, struct completion *done,
int* actual_length) int* actual_length)
{ {
struct timer_list timer; struct timer_list timer;
int status; int status = urb->status;
init_timer(&timer); init_timer(&timer);
timer.expires = jiffies + msecs_to_jiffies(CMD_TIMEOUT); timer.expires = jiffies + msecs_to_jiffies(CMD_TIMEOUT);
...@@ -464,7 +464,6 @@ static int cxacru_start_wait_urb(struct urb *urb, struct completion *done, ...@@ -464,7 +464,6 @@ static int cxacru_start_wait_urb(struct urb *urb, struct completion *done,
timer.function = cxacru_timeout_kill; timer.function = cxacru_timeout_kill;
add_timer(&timer); add_timer(&timer);
wait_for_completion(done); wait_for_completion(done);
status = urb->status;
del_timer_sync(&timer); del_timer_sync(&timer);
if (actual_length) if (actual_length)
......
...@@ -612,7 +612,8 @@ static void speedtch_handle_int(struct urb *int_urb) ...@@ -612,7 +612,8 @@ static void speedtch_handle_int(struct urb *int_urb)
struct speedtch_instance_data *instance = int_urb->context; struct speedtch_instance_data *instance = int_urb->context;
struct usbatm_data *usbatm = instance->usbatm; struct usbatm_data *usbatm = instance->usbatm;
unsigned int count = int_urb->actual_length; unsigned int count = int_urb->actual_length;
int ret = int_urb->status; int status = int_urb->status;
int ret;
/* The magic interrupt for "up state" */ /* The magic interrupt for "up state" */
static const unsigned char up_int[6] = { 0xa1, 0x00, 0x01, 0x00, 0x00, 0x00 }; static const unsigned char up_int[6] = { 0xa1, 0x00, 0x01, 0x00, 0x00, 0x00 };
...@@ -621,8 +622,8 @@ static void speedtch_handle_int(struct urb *int_urb) ...@@ -621,8 +622,8 @@ static void speedtch_handle_int(struct urb *int_urb)
atm_dbg(usbatm, "%s entered\n", __func__); atm_dbg(usbatm, "%s entered\n", __func__);
if (ret < 0) { if (status < 0) {
atm_dbg(usbatm, "%s: nonzero urb status %d!\n", __func__, ret); atm_dbg(usbatm, "%s: nonzero urb status %d!\n", __func__, status);
goto fail; goto fail;
} }
......
...@@ -1308,11 +1308,13 @@ static void uea_intr(struct urb *urb) ...@@ -1308,11 +1308,13 @@ static void uea_intr(struct urb *urb)
{ {
struct uea_softc *sc = urb->context; struct uea_softc *sc = urb->context;
struct intr_pkt *intr = urb->transfer_buffer; struct intr_pkt *intr = urb->transfer_buffer;
int status = urb->status;
uea_enters(INS_TO_USBDEV(sc)); uea_enters(INS_TO_USBDEV(sc));
if (unlikely(urb->status < 0)) { if (unlikely(status < 0)) {
uea_err(INS_TO_USBDEV(sc), "uea_intr() failed with %d\n", uea_err(INS_TO_USBDEV(sc), "uea_intr() failed with %d\n",
urb->status); status);
return; return;
} }
......
...@@ -257,9 +257,10 @@ static void usbatm_complete(struct urb *urb) ...@@ -257,9 +257,10 @@ static void usbatm_complete(struct urb *urb)
{ {
struct usbatm_channel *channel = urb->context; struct usbatm_channel *channel = urb->context;
unsigned long flags; unsigned long flags;
int status = urb->status;
vdbg("%s: urb 0x%p, status %d, actual_length %d", vdbg("%s: urb 0x%p, status %d, actual_length %d",
__func__, urb, urb->status, urb->actual_length); __func__, urb, status, urb->actual_length);
/* usually in_interrupt(), but not always */ /* usually in_interrupt(), but not always */
spin_lock_irqsave(&channel->lock, flags); spin_lock_irqsave(&channel->lock, flags);
...@@ -269,16 +270,16 @@ static void usbatm_complete(struct urb *urb) ...@@ -269,16 +270,16 @@ static void usbatm_complete(struct urb *urb)
spin_unlock_irqrestore(&channel->lock, flags); spin_unlock_irqrestore(&channel->lock, flags);
if (unlikely(urb->status) && if (unlikely(status) &&
(!(channel->usbatm->flags & UDSL_IGNORE_EILSEQ) || (!(channel->usbatm->flags & UDSL_IGNORE_EILSEQ) ||
urb->status != -EILSEQ )) status != -EILSEQ ))
{ {
if (urb->status == -ESHUTDOWN) if (status == -ESHUTDOWN)
return; return;
if (printk_ratelimit()) if (printk_ratelimit())
atm_warn(channel->usbatm, "%s: urb 0x%p failed (%d)!\n", atm_warn(channel->usbatm, "%s: urb 0x%p failed (%d)!\n",
__func__, urb, urb->status); __func__, urb, status);
/* throttle processing in case of an error */ /* throttle processing in case of an error */
mod_timer(&channel->delay, jiffies + msecs_to_jiffies(THROTTLE_MSECS)); mod_timer(&channel->delay, jiffies + msecs_to_jiffies(THROTTLE_MSECS));
} else } else
......
...@@ -257,9 +257,10 @@ static void acm_ctrl_irq(struct urb *urb) ...@@ -257,9 +257,10 @@ static void acm_ctrl_irq(struct urb *urb)
struct usb_cdc_notification *dr = urb->transfer_buffer; struct usb_cdc_notification *dr = urb->transfer_buffer;
unsigned char *data; unsigned char *data;
int newctrl; int newctrl;
int status; int retval;
int status = urb->status;
switch (urb->status) { switch (status) {
case 0: case 0:
/* success */ /* success */
break; break;
...@@ -267,10 +268,10 @@ static void acm_ctrl_irq(struct urb *urb) ...@@ -267,10 +268,10 @@ static void acm_ctrl_irq(struct urb *urb)
case -ENOENT: case -ENOENT:
case -ESHUTDOWN: case -ESHUTDOWN:
/* this urb is terminated, clean up */ /* this urb is terminated, clean up */
dbg("%s - urb shutting down with status: %d", __FUNCTION__, urb->status); dbg("%s - urb shutting down with status: %d", __FUNCTION__, status);
return; return;
default: default:
dbg("%s - nonzero urb status received: %d", __FUNCTION__, urb->status); dbg("%s - nonzero urb status received: %d", __FUNCTION__, status);
goto exit; goto exit;
} }
...@@ -311,10 +312,10 @@ static void acm_ctrl_irq(struct urb *urb) ...@@ -311,10 +312,10 @@ static void acm_ctrl_irq(struct urb *urb)
break; break;
} }
exit: exit:
status = usb_submit_urb (urb, GFP_ATOMIC); retval = usb_submit_urb (urb, GFP_ATOMIC);
if (status) if (retval)
err ("%s - usb_submit_urb failed with result %d", err ("%s - usb_submit_urb failed with result %d",
__FUNCTION__, status); __FUNCTION__, retval);
} }
/* data interface returns incoming bytes, or we got unthrottled */ /* data interface returns incoming bytes, or we got unthrottled */
...@@ -324,7 +325,8 @@ static void acm_read_bulk(struct urb *urb) ...@@ -324,7 +325,8 @@ static void acm_read_bulk(struct urb *urb)
struct acm_ru *rcv = urb->context; struct acm_ru *rcv = urb->context;
struct acm *acm = rcv->instance; struct acm *acm = rcv->instance;
int status = urb->status; int status = urb->status;
dbg("Entering acm_read_bulk with status %d", urb->status);
dbg("Entering acm_read_bulk with status %d", status);
if (!ACM_READY(acm)) if (!ACM_READY(acm))
return; return;
......
...@@ -289,16 +289,17 @@ static int proto_bias = -1; ...@@ -289,16 +289,17 @@ static int proto_bias = -1;
static void usblp_bulk_read(struct urb *urb) static void usblp_bulk_read(struct urb *urb)
{ {
struct usblp *usblp = urb->context; struct usblp *usblp = urb->context;
int status = urb->status;
if (usblp->present && usblp->used) { if (usblp->present && usblp->used) {
if (urb->status) if (status)
printk(KERN_WARNING "usblp%d: " printk(KERN_WARNING "usblp%d: "
"nonzero read bulk status received: %d\n", "nonzero read bulk status received: %d\n",
usblp->minor, urb->status); usblp->minor, status);
} }
spin_lock(&usblp->lock); spin_lock(&usblp->lock);
if (urb->status < 0) if (status < 0)
usblp->rstatus = urb->status; usblp->rstatus = status;
else else
usblp->rstatus = urb->actual_length; usblp->rstatus = urb->actual_length;
usblp->rcomplete = 1; usblp->rcomplete = 1;
...@@ -311,16 +312,17 @@ static void usblp_bulk_read(struct urb *urb) ...@@ -311,16 +312,17 @@ static void usblp_bulk_read(struct urb *urb)
static void usblp_bulk_write(struct urb *urb) static void usblp_bulk_write(struct urb *urb)
{ {
struct usblp *usblp = urb->context; struct usblp *usblp = urb->context;
int status = urb->status;
if (usblp->present && usblp->used) { if (usblp->present && usblp->used) {
if (urb->status) if (status)
printk(KERN_WARNING "usblp%d: " printk(KERN_WARNING "usblp%d: "
"nonzero write bulk status received: %d\n", "nonzero write bulk status received: %d\n",
usblp->minor, urb->status); usblp->minor, status);
} }
spin_lock(&usblp->lock); spin_lock(&usblp->lock);
if (urb->status < 0) if (status < 0)
usblp->wstatus = urb->status; usblp->wstatus = status;
else else
usblp->wstatus = urb->actual_length; usblp->wstatus = urb->actual_length;
usblp->wcomplete = 1; usblp->wcomplete = 1;
...@@ -741,10 +743,11 @@ static ssize_t usblp_write(struct file *file, const char __user *buffer, size_t ...@@ -741,10 +743,11 @@ static ssize_t usblp_write(struct file *file, const char __user *buffer, size_t
*/ */
rv = usblp_wwait(usblp, !!(file->f_flags&O_NONBLOCK)); rv = usblp_wwait(usblp, !!(file->f_flags&O_NONBLOCK));
if (rv < 0) { if (rv < 0) {
/* if (rv == -EAGAIN) {
* If interrupted, we simply leave the URB to dangle, /* Presume that it's going to complete well. */
* so the ->release will call usb_kill_urb(). writecount += transfer_length;
*/ }
/* Leave URB dangling, to be cleaned on close. */
goto collect_error; goto collect_error;
} }
......
...@@ -99,12 +99,17 @@ EXPORT_SYMBOL_GPL (usb_bus_list_lock); ...@@ -99,12 +99,17 @@ EXPORT_SYMBOL_GPL (usb_bus_list_lock);
/* used for controlling access to virtual root hubs */ /* used for controlling access to virtual root hubs */
static DEFINE_SPINLOCK(hcd_root_hub_lock); static DEFINE_SPINLOCK(hcd_root_hub_lock);
/* used when updating hcd data */ /* used when updating an endpoint's URB list */
static DEFINE_SPINLOCK(hcd_data_lock); static DEFINE_SPINLOCK(hcd_urb_list_lock);
/* wait queue for synchronous unlinks */ /* wait queue for synchronous unlinks */
DECLARE_WAIT_QUEUE_HEAD(usb_kill_urb_queue); DECLARE_WAIT_QUEUE_HEAD(usb_kill_urb_queue);
static inline int is_root_hub(struct usb_device *udev)
{
return (udev->parent == NULL);
}
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
/* /*
...@@ -906,14 +911,13 @@ EXPORT_SYMBOL (usb_calc_bus_time); ...@@ -906,14 +911,13 @@ EXPORT_SYMBOL (usb_calc_bus_time);
static void urb_unlink(struct usb_hcd *hcd, struct urb *urb) static void urb_unlink(struct usb_hcd *hcd, struct urb *urb)
{ {
unsigned long flags; unsigned long flags;
int at_root_hub = (urb->dev == hcd->self.root_hub);
/* clear all state linking urb to this dev (and hcd) */ /* clear all state linking urb to this dev (and hcd) */
spin_lock_irqsave (&hcd_data_lock, flags); spin_lock_irqsave(&hcd_urb_list_lock, flags);
list_del_init (&urb->urb_list); list_del_init (&urb->urb_list);
spin_unlock_irqrestore (&hcd_data_lock, flags); spin_unlock_irqrestore(&hcd_urb_list_lock, flags);
if (hcd->self.uses_dma && !at_root_hub) { if (hcd->self.uses_dma && !is_root_hub(urb->dev)) {
if (usb_pipecontrol (urb->pipe) if (usb_pipecontrol (urb->pipe)
&& !(urb->transfer_flags & URB_NO_SETUP_DMA_MAP)) && !(urb->transfer_flags & URB_NO_SETUP_DMA_MAP))
dma_unmap_single (hcd->self.controller, urb->setup_dma, dma_unmap_single (hcd->self.controller, urb->setup_dma,
...@@ -955,7 +959,7 @@ int usb_hcd_submit_urb (struct urb *urb, gfp_t mem_flags) ...@@ -955,7 +959,7 @@ int usb_hcd_submit_urb (struct urb *urb, gfp_t mem_flags)
// FIXME: verify that quiescing hc works right (RH cleans up) // FIXME: verify that quiescing hc works right (RH cleans up)
spin_lock_irqsave (&hcd_data_lock, flags); spin_lock_irqsave(&hcd_urb_list_lock, flags);
ep = (usb_pipein(urb->pipe) ? urb->dev->ep_in : urb->dev->ep_out) ep = (usb_pipein(urb->pipe) ? urb->dev->ep_in : urb->dev->ep_out)
[usb_pipeendpoint(urb->pipe)]; [usb_pipeendpoint(urb->pipe)];
if (unlikely (!ep)) if (unlikely (!ep))
...@@ -972,7 +976,7 @@ int usb_hcd_submit_urb (struct urb *urb, gfp_t mem_flags) ...@@ -972,7 +976,7 @@ int usb_hcd_submit_urb (struct urb *urb, gfp_t mem_flags)
status = -ESHUTDOWN; status = -ESHUTDOWN;
break; break;
} }
spin_unlock_irqrestore (&hcd_data_lock, flags); spin_unlock_irqrestore(&hcd_urb_list_lock, flags);
if (status) { if (status) {
INIT_LIST_HEAD (&urb->urb_list); INIT_LIST_HEAD (&urb->urb_list);
usbmon_urb_submit_error(&hcd->self, urb, status); usbmon_urb_submit_error(&hcd->self, urb, status);
...@@ -986,7 +990,7 @@ int usb_hcd_submit_urb (struct urb *urb, gfp_t mem_flags) ...@@ -986,7 +990,7 @@ int usb_hcd_submit_urb (struct urb *urb, gfp_t mem_flags)
urb = usb_get_urb (urb); urb = usb_get_urb (urb);
atomic_inc (&urb->use_count); atomic_inc (&urb->use_count);
if (urb->dev == hcd->self.root_hub) { if (is_root_hub(urb->dev)) {
/* NOTE: requirement on hub callers (usbfs and the hub /* NOTE: requirement on hub callers (usbfs and the hub
* driver, for now) that URBs' urb->transfer_buffer be * driver, for now) that URBs' urb->transfer_buffer be
* valid and usb_buffer_{sync,unmap}() not be needed, since * valid and usb_buffer_{sync,unmap}() not be needed, since
...@@ -1033,18 +1037,6 @@ int usb_hcd_submit_urb (struct urb *urb, gfp_t mem_flags) ...@@ -1033,18 +1037,6 @@ int usb_hcd_submit_urb (struct urb *urb, gfp_t mem_flags)
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
/* called in any context */
int usb_hcd_get_frame_number (struct usb_device *udev)
{
struct usb_hcd *hcd = bus_to_hcd(udev->bus);
if (!HC_IS_RUNNING (hcd->state))
return -ESHUTDOWN;
return hcd->driver->get_frame_number (hcd);
}
/*-------------------------------------------------------------------------*/
/* this makes the hcd giveback() the urb more quickly, by kicking it /* this makes the hcd giveback() the urb more quickly, by kicking it
* off hardware queues (which may take a while) and returning it as * off hardware queues (which may take a while) and returning it as
* soon as practical. we've already set up the urb's return status, * soon as practical. we've already set up the urb's return status,
...@@ -1055,7 +1047,7 @@ unlink1 (struct usb_hcd *hcd, struct urb *urb) ...@@ -1055,7 +1047,7 @@ unlink1 (struct usb_hcd *hcd, struct urb *urb)
{ {
int value; int value;
if (urb->dev == hcd->self.root_hub) if (is_root_hub(urb->dev))
value = usb_rh_urb_dequeue (hcd, urb); value = usb_rh_urb_dequeue (hcd, urb);
else { else {
...@@ -1103,11 +1095,11 @@ int usb_hcd_unlink_urb (struct urb *urb, int status) ...@@ -1103,11 +1095,11 @@ int usb_hcd_unlink_urb (struct urb *urb, int status)
* that it was submitted. But as a rule it can't know whether or * that it was submitted. But as a rule it can't know whether or
* not it's already been unlinked ... so we respect the reversed * not it's already been unlinked ... so we respect the reversed
* lock sequence needed for the usb_hcd_giveback_urb() code paths * lock sequence needed for the usb_hcd_giveback_urb() code paths
* (urb lock, then hcd_data_lock) in case some other CPU is now * (urb lock, then hcd_urb_list_lock) in case some other CPU is now
* unlinking it. * unlinking it.
*/ */
spin_lock_irqsave (&urb->lock, flags); spin_lock_irqsave (&urb->lock, flags);
spin_lock (&hcd_data_lock); spin_lock(&hcd_urb_list_lock);
sys = &urb->dev->dev; sys = &urb->dev->dev;
hcd = bus_to_hcd(urb->dev->bus); hcd = bus_to_hcd(urb->dev->bus);
...@@ -1139,17 +1131,16 @@ int usb_hcd_unlink_urb (struct urb *urb, int status) ...@@ -1139,17 +1131,16 @@ int usb_hcd_unlink_urb (struct urb *urb, int status)
* finish unlinking the initial failed usb_set_address() * finish unlinking the initial failed usb_set_address()
* or device descriptor fetch. * or device descriptor fetch.
*/ */
if (!test_bit(HCD_FLAG_SAW_IRQ, &hcd->flags) if (!test_bit(HCD_FLAG_SAW_IRQ, &hcd->flags) &&
&& hcd->self.root_hub != urb->dev) { !is_root_hub(urb->dev)) {
dev_warn (hcd->self.controller, "Unlink after no-IRQ? " dev_warn (hcd->self.controller, "Unlink after no-IRQ? "
"Controller is probably using the wrong IRQ." "Controller is probably using the wrong IRQ.\n");
"\n");
set_bit(HCD_FLAG_SAW_IRQ, &hcd->flags); set_bit(HCD_FLAG_SAW_IRQ, &hcd->flags);
} }
urb->status = status; urb->status = status;
spin_unlock (&hcd_data_lock); spin_unlock(&hcd_urb_list_lock);
spin_unlock_irqrestore (&urb->lock, flags); spin_unlock_irqrestore (&urb->lock, flags);
retval = unlink1 (hcd, urb); retval = unlink1 (hcd, urb);
...@@ -1158,7 +1149,7 @@ int usb_hcd_unlink_urb (struct urb *urb, int status) ...@@ -1158,7 +1149,7 @@ int usb_hcd_unlink_urb (struct urb *urb, int status)
return retval; return retval;
done: done:
spin_unlock (&hcd_data_lock); spin_unlock(&hcd_urb_list_lock);
spin_unlock_irqrestore (&urb->lock, flags); spin_unlock_irqrestore (&urb->lock, flags);
if (retval != -EIDRM && sys && sys->driver) if (retval != -EIDRM && sys && sys->driver)
dev_dbg (sys, "hcd_unlink_urb %p fail %d\n", urb, retval); dev_dbg (sys, "hcd_unlink_urb %p fail %d\n", urb, retval);
...@@ -1167,6 +1158,35 @@ int usb_hcd_unlink_urb (struct urb *urb, int status) ...@@ -1167,6 +1158,35 @@ int usb_hcd_unlink_urb (struct urb *urb, int status)
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
/**
* usb_hcd_giveback_urb - return URB from HCD to device driver
* @hcd: host controller returning the URB
* @urb: urb being returned to the USB device driver.
* Context: in_interrupt()
*
* This hands the URB from HCD to its USB device driver, using its
* completion function. The HCD has freed all per-urb resources
* (and is done using urb->hcpriv). It also released all HCD locks;
* the device driver won't cause problems if it frees, modifies,
* or resubmits this URB.
*/
void usb_hcd_giveback_urb (struct usb_hcd *hcd, struct urb *urb)
{
urb_unlink(hcd, urb);
usbmon_urb_complete (&hcd->self, urb);
usb_unanchor_urb(urb);
/* pass ownership to the completion handler */
urb->complete (urb);
atomic_dec (&urb->use_count);
if (unlikely (urb->reject))
wake_up (&usb_kill_urb_queue);
usb_put_urb (urb);
}
EXPORT_SYMBOL (usb_hcd_giveback_urb);
/*-------------------------------------------------------------------------*/
/* disables the endpoint: cancels any pending urbs, then synchronizes with /* disables the endpoint: cancels any pending urbs, then synchronizes with
* the hcd to make sure all endpoint state is gone from hardware, and then * the hcd to make sure all endpoint state is gone from hardware, and then
* waits until the endpoint's queue is completely drained. use for * waits until the endpoint's queue is completely drained. use for
...@@ -1186,7 +1206,7 @@ void usb_hcd_endpoint_disable (struct usb_device *udev, ...@@ -1186,7 +1206,7 @@ void usb_hcd_endpoint_disable (struct usb_device *udev,
/* ep is already gone from udev->ep_{in,out}[]; no more submits */ /* ep is already gone from udev->ep_{in,out}[]; no more submits */
rescan: rescan:
spin_lock (&hcd_data_lock); spin_lock(&hcd_urb_list_lock);
list_for_each_entry (urb, &ep->urb_list, urb_list) { list_for_each_entry (urb, &ep->urb_list, urb_list) {
int tmp; int tmp;
...@@ -1194,7 +1214,7 @@ void usb_hcd_endpoint_disable (struct usb_device *udev, ...@@ -1194,7 +1214,7 @@ void usb_hcd_endpoint_disable (struct usb_device *udev,
if (urb->status != -EINPROGRESS) if (urb->status != -EINPROGRESS)
continue; continue;
usb_get_urb (urb); usb_get_urb (urb);
spin_unlock (&hcd_data_lock); spin_unlock(&hcd_urb_list_lock);
spin_lock (&urb->lock); spin_lock (&urb->lock);
tmp = urb->status; tmp = urb->status;
...@@ -1223,7 +1243,7 @@ void usb_hcd_endpoint_disable (struct usb_device *udev, ...@@ -1223,7 +1243,7 @@ void usb_hcd_endpoint_disable (struct usb_device *udev,
/* list contents may have changed */ /* list contents may have changed */
goto rescan; goto rescan;
} }
spin_unlock (&hcd_data_lock); spin_unlock(&hcd_urb_list_lock);
local_irq_enable (); local_irq_enable ();
/* synchronize with the hardware, so old configuration state /* synchronize with the hardware, so old configuration state
...@@ -1240,7 +1260,7 @@ void usb_hcd_endpoint_disable (struct usb_device *udev, ...@@ -1240,7 +1260,7 @@ void usb_hcd_endpoint_disable (struct usb_device *udev,
* endpoint_disable methods. * endpoint_disable methods.
*/ */
while (!list_empty (&ep->urb_list)) { while (!list_empty (&ep->urb_list)) {
spin_lock_irq (&hcd_data_lock); spin_lock_irq(&hcd_urb_list_lock);
/* The list may have changed while we acquired the spinlock */ /* The list may have changed while we acquired the spinlock */
urb = NULL; urb = NULL;
...@@ -1249,7 +1269,7 @@ void usb_hcd_endpoint_disable (struct usb_device *udev, ...@@ -1249,7 +1269,7 @@ void usb_hcd_endpoint_disable (struct usb_device *udev,
urb_list); urb_list);
usb_get_urb (urb); usb_get_urb (urb);
} }
spin_unlock_irq (&hcd_data_lock); spin_unlock_irq(&hcd_urb_list_lock);
if (urb) { if (urb) {
usb_kill_urb (urb); usb_kill_urb (urb);
...@@ -1260,6 +1280,18 @@ void usb_hcd_endpoint_disable (struct usb_device *udev, ...@@ -1260,6 +1280,18 @@ void usb_hcd_endpoint_disable (struct usb_device *udev,
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
/* called in any context */
int usb_hcd_get_frame_number (struct usb_device *udev)
{
struct usb_hcd *hcd = bus_to_hcd(udev->bus);
if (!HC_IS_RUNNING (hcd->state))
return -ESHUTDOWN;
return hcd->driver->get_frame_number (hcd);
}
/*-------------------------------------------------------------------------*/
#ifdef CONFIG_PM #ifdef CONFIG_PM
int hcd_bus_suspend(struct usb_device *rhdev) int hcd_bus_suspend(struct usb_device *rhdev)
...@@ -1394,35 +1426,6 @@ EXPORT_SYMBOL (usb_bus_start_enum); ...@@ -1394,35 +1426,6 @@ EXPORT_SYMBOL (usb_bus_start_enum);
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
/**
* usb_hcd_giveback_urb - return URB from HCD to device driver
* @hcd: host controller returning the URB
* @urb: urb being returned to the USB device driver.
* Context: in_interrupt()
*
* This hands the URB from HCD to its USB device driver, using its
* completion function. The HCD has freed all per-urb resources
* (and is done using urb->hcpriv). It also released all HCD locks;
* the device driver won't cause problems if it frees, modifies,
* or resubmits this URB.
*/
void usb_hcd_giveback_urb (struct usb_hcd *hcd, struct urb *urb)
{
urb_unlink(hcd, urb);
usbmon_urb_complete (&hcd->self, urb);
usb_unanchor_urb(urb);
/* pass ownership to the completion handler */
urb->complete (urb);
atomic_dec (&urb->use_count);
if (unlikely (urb->reject))
wake_up (&usb_kill_urb_queue);
usb_put_urb (urb);
}
EXPORT_SYMBOL (usb_hcd_giveback_urb);
/*-------------------------------------------------------------------------*/
/** /**
* usb_hcd_irq - hook IRQs to HCD framework (bus glue) * usb_hcd_irq - hook IRQs to HCD framework (bus glue)
* @irq: the IRQ being raised * @irq: the IRQ being raised
......
...@@ -1335,6 +1335,10 @@ int usb_new_device(struct usb_device *udev) ...@@ -1335,6 +1335,10 @@ int usb_new_device(struct usb_device *udev)
udev->dev.devt = MKDEV(USB_DEVICE_MAJOR, udev->dev.devt = MKDEV(USB_DEVICE_MAJOR,
(((udev->bus->busnum-1) * 128) + (udev->devnum-1))); (((udev->bus->busnum-1) * 128) + (udev->devnum-1)));
/* Increment the parent's count of unsuspended children */
if (udev->parent)
usb_autoresume_device(udev->parent);
/* Register the device. The device driver is responsible /* Register the device. The device driver is responsible
* for adding the device files to sysfs and for configuring * for adding the device files to sysfs and for configuring
* the device. * the device.
...@@ -1342,13 +1346,11 @@ int usb_new_device(struct usb_device *udev) ...@@ -1342,13 +1346,11 @@ int usb_new_device(struct usb_device *udev)
err = device_add(&udev->dev); err = device_add(&udev->dev);
if (err) { if (err) {
dev_err(&udev->dev, "can't device_add, error %d\n", err); dev_err(&udev->dev, "can't device_add, error %d\n", err);
if (udev->parent)
usb_autosuspend_device(udev->parent);
goto fail; goto fail;
} }
/* Increment the parent's count of unsuspended children */
if (udev->parent)
usb_autoresume_device(udev->parent);
exit: exit:
return err; return err;
......
...@@ -34,13 +34,14 @@ static int usb_start_wait_urb(struct urb *urb, int timeout, int *actual_length) ...@@ -34,13 +34,14 @@ static int usb_start_wait_urb(struct urb *urb, int timeout, int *actual_length)
{ {
struct completion done; struct completion done;
unsigned long expire; unsigned long expire;
int status; int retval;
int status = urb->status;
init_completion(&done); init_completion(&done);
urb->context = &done; urb->context = &done;
urb->actual_length = 0; urb->actual_length = 0;
status = usb_submit_urb(urb, GFP_NOIO); retval = usb_submit_urb(urb, GFP_NOIO);
if (unlikely(status)) if (unlikely(retval))
goto out; goto out;
expire = timeout ? msecs_to_jiffies(timeout) : MAX_SCHEDULE_TIMEOUT; expire = timeout ? msecs_to_jiffies(timeout) : MAX_SCHEDULE_TIMEOUT;
...@@ -55,15 +56,15 @@ static int usb_start_wait_urb(struct urb *urb, int timeout, int *actual_length) ...@@ -55,15 +56,15 @@ static int usb_start_wait_urb(struct urb *urb, int timeout, int *actual_length)
urb->transfer_buffer_length); urb->transfer_buffer_length);
usb_kill_urb(urb); usb_kill_urb(urb);
status = urb->status == -ENOENT ? -ETIMEDOUT : urb->status; retval = status == -ENOENT ? -ETIMEDOUT : status;
} else } else
status = urb->status; retval = status;
out: out:
if (actual_length) if (actual_length)
*actual_length = urb->actual_length; *actual_length = urb->actual_length;
usb_free_urb(urb); usb_free_urb(urb);
return status; return retval;
} }
/*-------------------------------------------------------------------*/ /*-------------------------------------------------------------------*/
...@@ -250,6 +251,7 @@ static void sg_clean (struct usb_sg_request *io) ...@@ -250,6 +251,7 @@ static void sg_clean (struct usb_sg_request *io)
static void sg_complete (struct urb *urb) static void sg_complete (struct urb *urb)
{ {
struct usb_sg_request *io = urb->context; struct usb_sg_request *io = urb->context;
int status = urb->status;
spin_lock (&io->lock); spin_lock (&io->lock);
...@@ -265,21 +267,21 @@ static void sg_complete (struct urb *urb) ...@@ -265,21 +267,21 @@ static void sg_complete (struct urb *urb)
*/ */
if (io->status if (io->status
&& (io->status != -ECONNRESET && (io->status != -ECONNRESET
|| urb->status != -ECONNRESET) || status != -ECONNRESET)
&& urb->actual_length) { && urb->actual_length) {
dev_err (io->dev->bus->controller, dev_err (io->dev->bus->controller,
"dev %s ep%d%s scatterlist error %d/%d\n", "dev %s ep%d%s scatterlist error %d/%d\n",
io->dev->devpath, io->dev->devpath,
usb_pipeendpoint (urb->pipe), usb_pipeendpoint (urb->pipe),
usb_pipein (urb->pipe) ? "in" : "out", usb_pipein (urb->pipe) ? "in" : "out",
urb->status, io->status); status, io->status);
// BUG (); // BUG ();
} }
if (io->status == 0 && urb->status && urb->status != -ECONNRESET) { if (io->status == 0 && status && status != -ECONNRESET) {
int i, found, status; int i, found, retval;
io->status = urb->status; io->status = status;
/* the previous urbs, and this one, completed already. /* the previous urbs, and this one, completed already.
* unlink pending urbs so they won't rx/tx bad data. * unlink pending urbs so they won't rx/tx bad data.
...@@ -290,13 +292,13 @@ static void sg_complete (struct urb *urb) ...@@ -290,13 +292,13 @@ static void sg_complete (struct urb *urb)
if (!io->urbs [i] || !io->urbs [i]->dev) if (!io->urbs [i] || !io->urbs [i]->dev)
continue; continue;
if (found) { if (found) {
status = usb_unlink_urb (io->urbs [i]); retval = usb_unlink_urb (io->urbs [i]);
if (status != -EINPROGRESS if (retval != -EINPROGRESS &&
&& status != -ENODEV retval != -ENODEV &&
&& status != -EBUSY) retval != -EBUSY)
dev_err (&io->dev->dev, dev_err (&io->dev->dev,
"%s, unlink --> %d\n", "%s, unlink --> %d\n",
__FUNCTION__, status); __FUNCTION__, retval);
} else if (urb == io->urbs [i]) } else if (urb == io->urbs [i])
found = 1; found = 1;
} }
......
...@@ -441,6 +441,54 @@ static struct attribute_group dev_attr_grp = { ...@@ -441,6 +441,54 @@ static struct attribute_group dev_attr_grp = {
.attrs = dev_attrs, .attrs = dev_attrs,
}; };
/* Binary descriptors */
static ssize_t
read_descriptors(struct kobject *kobj, struct bin_attribute *attr,
char *buf, loff_t off, size_t count)
{
struct usb_device *udev = to_usb_device(
container_of(kobj, struct device, kobj));
size_t nleft = count;
size_t srclen, n;
usb_lock_device(udev);
/* The binary attribute begins with the device descriptor */
srclen = sizeof(struct usb_device_descriptor);
if (off < srclen) {
n = min_t(size_t, nleft, srclen - off);
memcpy(buf, off + (char *) &udev->descriptor, n);
nleft -= n;
buf += n;
off = 0;
} else {
off -= srclen;
}
/* Then follows the raw descriptor entry for the current
* configuration (config plus subsidiary descriptors).
*/
if (udev->actconfig) {
int cfgno = udev->actconfig - udev->config;
srclen = __le16_to_cpu(udev->actconfig->desc.wTotalLength);
if (off < srclen) {
n = min_t(size_t, nleft, srclen - off);
memcpy(buf, off + udev->rawdescriptors[cfgno], n);
nleft -= n;
}
}
usb_unlock_device(udev);
return count - nleft;
}
static struct bin_attribute dev_bin_attr_descriptors = {
.attr = {.name = "descriptors", .mode = 0444},
.read = read_descriptors,
.size = 18 + 65535, /* dev descr + max-size raw descriptor */
};
int usb_create_sysfs_dev_files(struct usb_device *udev) int usb_create_sysfs_dev_files(struct usb_device *udev)
{ {
struct device *dev = &udev->dev; struct device *dev = &udev->dev;
...@@ -450,6 +498,10 @@ int usb_create_sysfs_dev_files(struct usb_device *udev) ...@@ -450,6 +498,10 @@ int usb_create_sysfs_dev_files(struct usb_device *udev)
if (retval) if (retval)
return retval; return retval;
retval = device_create_bin_file(dev, &dev_bin_attr_descriptors);
if (retval)
goto error;
retval = add_persist_attributes(dev); retval = add_persist_attributes(dev);
if (retval) if (retval)
goto error; goto error;
...@@ -492,6 +544,7 @@ void usb_remove_sysfs_dev_files(struct usb_device *udev) ...@@ -492,6 +544,7 @@ void usb_remove_sysfs_dev_files(struct usb_device *udev)
device_remove_file(dev, &dev_attr_serial); device_remove_file(dev, &dev_attr_serial);
remove_power_attributes(dev); remove_power_attributes(dev);
remove_persist_attributes(dev); remove_persist_attributes(dev);
device_remove_bin_file(dev, &dev_bin_attr_descriptors);
sysfs_remove_group(&dev->kobj, &dev_attr_grp); sysfs_remove_group(&dev->kobj, &dev_attr_grp);
} }
......
...@@ -440,55 +440,57 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags) ...@@ -440,55 +440,57 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
* @urb: pointer to urb describing a previously submitted request, * @urb: pointer to urb describing a previously submitted request,
* may be NULL * may be NULL
* *
* This routine cancels an in-progress request. URBs complete only * This routine cancels an in-progress request. URBs complete only once
* once per submission, and may be canceled only once per submission. * per submission, and may be canceled only once per submission.
* Successful cancellation means the requests's completion handler will * Successful cancellation means termination of @urb will be expedited
* be called with a status code indicating that the request has been * and the completion handler will be called with a status code
* canceled (rather than any other code) and will quickly be removed * indicating that the request has been canceled (rather than any other
* from host controller data structures. * code).
* *
* This request is always asynchronous. * This request is always asynchronous. Success is indicated by
* Success is indicated by returning -EINPROGRESS, * returning -EINPROGRESS, at which time the URB will probably not yet
* at which time the URB will normally have been unlinked but not yet * have been given back to the device driver. When it is eventually
* given back to the device driver. When it is called, the completion * called, the completion function will see @urb->status == -ECONNRESET.
* function will see urb->status == -ECONNRESET. Failure is indicated * Failure is indicated by usb_unlink_urb() returning any other value.
* by any other return value. Unlinking will fail when the URB is not * Unlinking will fail when @urb is not currently "linked" (i.e., it was
* currently "linked" (i.e., it was never submitted, or it was unlinked * never submitted, or it was unlinked before, or the hardware is already
* before, or the hardware is already finished with it), even if the * finished with it), even if the completion handler has not yet run.
* completion handler has not yet run.
* *
* Unlinking and Endpoint Queues: * Unlinking and Endpoint Queues:
* *
* [The behaviors and guarantees described below do not apply to virtual
* root hubs but only to endpoint queues for physical USB devices.]
*
* Host Controller Drivers (HCDs) place all the URBs for a particular * Host Controller Drivers (HCDs) place all the URBs for a particular
* endpoint in a queue. Normally the queue advances as the controller * endpoint in a queue. Normally the queue advances as the controller
* hardware processes each request. But when an URB terminates with an * hardware processes each request. But when an URB terminates with an
* error its queue stops, at least until that URB's completion routine * error its queue generally stops (see below), at least until that URB's
* returns. It is guaranteed that the queue will not restart until all * completion routine returns. It is guaranteed that a stopped queue
* its unlinked URBs have been fully retired, with their completion * will not restart until all its unlinked URBs have been fully retired,
* routines run, even if that's not until some time after the original * with their completion routines run, even if that's not until some time
* completion handler returns. Normally the same behavior and guarantees * after the original completion handler returns. The same behavior and
* apply when an URB terminates because it was unlinked; however if an * guarantee apply when an URB terminates because it was unlinked.
* URB is unlinked before the hardware has started to execute it, then *
* its queue is not guaranteed to stop until all the preceding URBs have * Bulk and interrupt endpoint queues are guaranteed to stop whenever an
* completed. * URB terminates with any sort of error, including -ECONNRESET, -ENOENT,
* * and -EREMOTEIO. Control endpoint queues behave the same way except
* This means that USB device drivers can safely build deep queues for * that they are not guaranteed to stop for -EREMOTEIO errors. Queues
* large or complex transfers, and clean them up reliably after any sort * for isochronous endpoints are treated differently, because they must
* of aborted transfer by unlinking all pending URBs at the first fault. * advance at fixed rates. Such queues do not stop when an URB
* * encounters an error or is unlinked. An unlinked isochronous URB may
* Note that an URB terminating early because a short packet was received * leave a gap in the stream of packets; it is undefined whether such
* will count as an error if and only if the URB_SHORT_NOT_OK flag is set. * gaps can be filled in.
* Also, that all unlinks performed in any URB completion handler must *
* be asynchronous. * Note that early termination of an URB because a short packet was
* * received will generate a -EREMOTEIO error if and only if the
* Queues for isochronous endpoints are treated differently, because they * URB_SHORT_NOT_OK flag is set. By setting this flag, USB device
* advance at fixed rates. Such queues do not stop when an URB is unlinked. * drivers can build deep queues for large or complex bulk transfers
* An unlinked URB may leave a gap in the stream of packets. It is undefined * and clean them up reliably after any sort of aborted transfer by
* whether such gaps can be filled in. * unlinking all pending URBs at the first fault.
* *
* When a control URB terminates with an error, it is likely that the * When a control URB terminates with an error other than -EREMOTEIO, it
* status stage of the transfer will not take place, even if it is merely * is quite likely that the status stage of the transfer will not take
* a soft error resulting from a short-packet with URB_SHORT_NOT_OK set. * place.
*/ */
int usb_unlink_urb(struct urb *urb) int usb_unlink_urb(struct urb *urb)
{ {
......
...@@ -82,6 +82,27 @@ choice ...@@ -82,6 +82,27 @@ choice
Many controller drivers are platform-specific; these Many controller drivers are platform-specific; these
often need board-specific hooks. often need board-specific hooks.
config USB_GADGET_AMD5536UDC
boolean "AMD5536 UDC"
depends on PCI
select USB_GADGET_DUALSPEED
help
The AMD5536 UDC is part of the AMD Geode CS5536, an x86 southbridge.
It is a USB Highspeed DMA capable USB device controller. Beside ep0
it provides 4 IN and 4 OUT endpoints (bulk or interrupt type).
The UDC port supports OTG operation, and may be used as a host port
if it's not being used to implement peripheral or OTG roles.
Say "y" to link the driver statically, or "m" to build a
dynamically linked module called "amd5536udc" and force all
gadget drivers to also be dynamically linked.
config USB_AMD5536UDC
tristate
depends on USB_GADGET_AMD5536UDC
default USB_GADGET
select USB_GADGET_SELECTED
config USB_GADGET_FSL_USB2 config USB_GADGET_FSL_USB2
boolean "Freescale Highspeed USB DR Peripheral Controller" boolean "Freescale Highspeed USB DR Peripheral Controller"
depends on MPC834x || PPC_MPC831x depends on MPC834x || PPC_MPC831x
...@@ -156,6 +177,24 @@ config USB_PXA2XX_SMALL ...@@ -156,6 +177,24 @@ config USB_PXA2XX_SMALL
default y if USB_ETH default y if USB_ETH
default y if USB_G_SERIAL default y if USB_G_SERIAL
config USB_GADGET_M66592
boolean "Renesas M66592 USB Peripheral Controller"
select USB_GADGET_DUALSPEED
help
M66592 is a discrete USB peripheral controller chip that
supports both full and high speed USB 2.0 data transfers.
It has seven configurable endpoints, and endpoint zero.
Say "y" to link the driver statically, or "m" to build a
dynamically linked module called "m66592_udc" and force all
gadget drivers to also be dynamically linked.
config USB_M66592
tristate
depends on USB_GADGET_M66592
default USB_GADGET
select USB_GADGET_SELECTED
config USB_GADGET_GOKU config USB_GADGET_GOKU
boolean "Toshiba TC86C001 'Goku-S'" boolean "Toshiba TC86C001 'Goku-S'"
depends on PCI depends on PCI
...@@ -261,24 +300,6 @@ config USB_AT91 ...@@ -261,24 +300,6 @@ config USB_AT91
depends on USB_GADGET_AT91 depends on USB_GADGET_AT91
default USB_GADGET default USB_GADGET
config USB_GADGET_M66592
boolean "M66592 driver"
select USB_GADGET_DUALSPEED
help
M66592 is a USB 2.0 peripheral controller.
It has seven configurable endpoints, and endpoint zero.
Say "y" to link the driver statically, or "m" to build a
dynamically linked module called "m66592_udc" and force all
gadget drivers to also be dynamically linked.
config USB_M66592
tristate
depends on USB_GADGET_M66592
default USB_GADGET
select USB_GADGET_SELECTED
config USB_GADGET_DUMMY_HCD config USB_GADGET_DUMMY_HCD
boolean "Dummy HCD (DEVELOPMENT)" boolean "Dummy HCD (DEVELOPMENT)"
depends on (USB=y || (USB=m && USB_GADGET=m)) && EXPERIMENTAL depends on (USB=y || (USB=m && USB_GADGET=m)) && EXPERIMENTAL
......
...@@ -7,6 +7,7 @@ endif ...@@ -7,6 +7,7 @@ endif
obj-$(CONFIG_USB_DUMMY_HCD) += dummy_hcd.o obj-$(CONFIG_USB_DUMMY_HCD) += dummy_hcd.o
obj-$(CONFIG_USB_NET2280) += net2280.o obj-$(CONFIG_USB_NET2280) += net2280.o
obj-$(CONFIG_USB_AMD5536UDC) += amd5536udc.o
obj-$(CONFIG_USB_PXA2XX) += pxa2xx_udc.o obj-$(CONFIG_USB_PXA2XX) += pxa2xx_udc.o
obj-$(CONFIG_USB_GOKU) += goku_udc.o obj-$(CONFIG_USB_GOKU) += goku_udc.o
obj-$(CONFIG_USB_OMAP) += omap_udc.o obj-$(CONFIG_USB_OMAP) += omap_udc.o
......
This diff is collapsed.
This diff is collapsed.
...@@ -305,6 +305,10 @@ MODULE_PARM_DESC(host_addr, "Host Ethernet Address"); ...@@ -305,6 +305,10 @@ MODULE_PARM_DESC(host_addr, "Host Ethernet Address");
#define DEV_CONFIG_CDC #define DEV_CONFIG_CDC
#endif #endif
#ifdef CONFIG_USB_GADGET_AMD5536UDC
#define DEV_CONFIG_CDC
#endif
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
......
...@@ -17,6 +17,12 @@ ...@@ -17,6 +17,12 @@
#define gadget_is_net2280(g) 0 #define gadget_is_net2280(g) 0
#endif #endif
#ifdef CONFIG_USB_GADGET_AMD5536UDC
#define gadget_is_amd5536udc(g) !strcmp("amd5536udc", (g)->name)
#else
#define gadget_is_amd5536udc(g) 0
#endif
#ifdef CONFIG_USB_GADGET_DUMMY_HCD #ifdef CONFIG_USB_GADGET_DUMMY_HCD
#define gadget_is_dummy(g) !strcmp("dummy_udc", (g)->name) #define gadget_is_dummy(g) !strcmp("dummy_udc", (g)->name)
#else #else
...@@ -202,7 +208,9 @@ static inline int usb_gadget_controller_number(struct usb_gadget *gadget) ...@@ -202,7 +208,9 @@ static inline int usb_gadget_controller_number(struct usb_gadget *gadget)
return 0x18; return 0x18;
else if (gadget_is_fsl_usb2(gadget)) else if (gadget_is_fsl_usb2(gadget))
return 0x19; return 0x19;
else if (gadget_is_m66592(gadget)) else if (gadget_is_amd5536udc(gadget))
return 0x20; return 0x20;
else if (gadget_is_m66592(gadget))
return 0x21;
return -ENOENT; return -ENOENT;
} }
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/pci_ids.h> #include <linux/pci_ids.h>
#include <linux/mutex.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/irq.h> #include <asm/irq.h>
#include <asm/system.h> #include <asm/system.h>
...@@ -83,7 +84,7 @@ static DECLARE_WAIT_QUEUE_HEAD(u132_hcd_wait); ...@@ -83,7 +84,7 @@ static DECLARE_WAIT_QUEUE_HEAD(u132_hcd_wait);
* u132_module_lock exists to protect access to global variables * u132_module_lock exists to protect access to global variables
* *
*/ */
static struct semaphore u132_module_lock; static struct mutex u132_module_lock;
static int u132_exiting = 0; static int u132_exiting = 0;
static int u132_instances = 0; static int u132_instances = 0;
static struct list_head u132_static_list; static struct list_head u132_static_list;
...@@ -258,10 +259,10 @@ static void u132_hcd_delete(struct kref *kref) ...@@ -258,10 +259,10 @@ static void u132_hcd_delete(struct kref *kref)
struct platform_device *pdev = u132->platform_dev; struct platform_device *pdev = u132->platform_dev;
struct usb_hcd *hcd = u132_to_hcd(u132); struct usb_hcd *hcd = u132_to_hcd(u132);
u132->going += 1; u132->going += 1;
down(&u132_module_lock); mutex_lock(&u132_module_lock);
list_del_init(&u132->u132_list); list_del_init(&u132->u132_list);
u132_instances -= 1; u132_instances -= 1;
up(&u132_module_lock); mutex_unlock(&u132_module_lock);
dev_warn(&u132->platform_dev->dev, "FREEING the hcd=%p and thus the u13" dev_warn(&u132->platform_dev->dev, "FREEING the hcd=%p and thus the u13"
"2=%p going=%d pdev=%p\n", hcd, u132, u132->going, pdev); "2=%p going=%d pdev=%p\n", hcd, u132, u132->going, pdev);
usb_put_hcd(hcd); usb_put_hcd(hcd);
...@@ -3111,10 +3112,10 @@ static int __devinit u132_probe(struct platform_device *pdev) ...@@ -3111,10 +3112,10 @@ static int __devinit u132_probe(struct platform_device *pdev)
int retval = 0; int retval = 0;
struct u132 *u132 = hcd_to_u132(hcd); struct u132 *u132 = hcd_to_u132(hcd);
hcd->rsrc_start = 0; hcd->rsrc_start = 0;
down(&u132_module_lock); mutex_lock(&u132_module_lock);
list_add_tail(&u132->u132_list, &u132_static_list); list_add_tail(&u132->u132_list, &u132_static_list);
u132->sequence_num = ++u132_instances; u132->sequence_num = ++u132_instances;
up(&u132_module_lock); mutex_unlock(&u132_module_lock);
u132_u132_init_kref(u132); u132_u132_init_kref(u132);
u132_initialise(u132, pdev); u132_initialise(u132, pdev);
hcd->product_desc = "ELAN U132 Host Controller"; hcd->product_desc = "ELAN U132 Host Controller";
...@@ -3216,7 +3217,7 @@ static int __init u132_hcd_init(void) ...@@ -3216,7 +3217,7 @@ static int __init u132_hcd_init(void)
INIT_LIST_HEAD(&u132_static_list); INIT_LIST_HEAD(&u132_static_list);
u132_instances = 0; u132_instances = 0;
u132_exiting = 0; u132_exiting = 0;
init_MUTEX(&u132_module_lock); mutex_init(&u132_module_lock);
if (usb_disabled()) if (usb_disabled())
return -ENODEV; return -ENODEV;
printk(KERN_INFO "driver %s built at %s on %s\n", hcd_name, __TIME__, printk(KERN_INFO "driver %s built at %s on %s\n", hcd_name, __TIME__,
...@@ -3232,9 +3233,9 @@ static void __exit u132_hcd_exit(void) ...@@ -3232,9 +3233,9 @@ static void __exit u132_hcd_exit(void)
{ {
struct u132 *u132; struct u132 *u132;
struct u132 *temp; struct u132 *temp;
down(&u132_module_lock); mutex_lock(&u132_module_lock);
u132_exiting += 1; u132_exiting += 1;
up(&u132_module_lock); mutex_unlock(&u132_module_lock);
list_for_each_entry_safe(u132, temp, &u132_static_list, u132_list) { list_for_each_entry_safe(u132, temp, &u132_static_list, u132_list) {
platform_device_unregister(u132->platform_dev); platform_device_unregister(u132->platform_dev);
} platform_driver_unregister(&u132_platform_driver); } platform_driver_unregister(&u132_platform_driver);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -768,8 +768,8 @@ static void ctrl_complete (struct urb *urb) ...@@ -768,8 +768,8 @@ static void ctrl_complete (struct urb *urb)
/* some faults are allowed, not required */ /* some faults are allowed, not required */
if (subcase->expected > 0 && ( if (subcase->expected > 0 && (
((urb->status == -subcase->expected /* happened */ ((status == -subcase->expected /* happened */
|| urb->status == 0)))) /* didn't */ || status == 0)))) /* didn't */
status = 0; status = 0;
/* sometimes more than one fault is allowed */ /* sometimes more than one fault is allowed */
else if (subcase->number == 12 && status == -EPIPE) else if (subcase->number == 12 && status == -EPIPE)
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment