]> git.hungrycats.org Git - linux/commitdiff
[PATCH] cleanup after dead hc needs task context
authorDavid Brownell <david-b@pacbell.net>
Mon, 30 Dec 2002 09:16:25 +0000 (01:16 -0800)
committerGreg Kroah-Hartman <greg@kroah.com>
Mon, 30 Dec 2002 09:16:25 +0000 (01:16 -0800)
Simple patch to invoke hcd->stop() in task context, as
required.  When Cardbus works again (broken in 2.5.53
unless it's just me), this will get rid of some oopsing
when folk physically eject the device, with no shutdown.
As well as making other "hc died" faults behave better.

drivers/usb/core/hcd.c
drivers/usb/core/hcd.h

index 624beac700b4f9624099ca8af0d72c2b47a7887b..ab3ac53d7b6a4ddcde3a2ef998f31766f3fed05a 100644 (file)
@@ -1339,6 +1339,12 @@ EXPORT_SYMBOL (usb_hcd_irq);
 
 /*-------------------------------------------------------------------------*/
 
+static void hcd_panic (void *_hcd)
+{
+       struct usb_hcd *hcd = _hcd;
+       hcd->driver->stop (hcd);
+}
+
 /**
  * usb_hc_died - report abnormal shutdown of a host controller (bus glue)
  * @hcd: pointer to the HCD representing the controller
@@ -1371,9 +1377,9 @@ void usb_hc_died (struct usb_hcd *hcd)
                urb->status = -ESHUTDOWN;
        spin_unlock_irqrestore (&hcd_data_lock, flags);
 
-       if (urb)
-               usb_rh_status_dequeue (hcd, urb);
-       hcd->driver->stop (hcd);
+       /* hcd->stop() needs a task context */
+       INIT_WORK (&hcd->work, hcd_panic, hcd);
+       (void) schedule_work (&hcd->work);
 }
 EXPORT_SYMBOL (usb_hc_died);
 
index 99cb0f4b2c8450779d5610055e89130f14d35ac2..a3d924e2e34c5c84d4d9e592935ffe803e1d7bde 100644 (file)
@@ -67,6 +67,7 @@ struct usb_hcd {      /* usb_bus.hcpriv points to this */
 
        struct timer_list       rh_timer;       /* drives root hub */
        struct list_head        dev_list;       /* devices on this bus */
+       struct work_struct      work;
 
        /*
         * hardware info/state