ChangeSet 1.969, 2002/12/30 17:16:25-08:00, [EMAIL PROTECTED]

[PATCH] cleanup after dead hc needs task context

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.


diff -Nru a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
--- a/drivers/usb/core/hcd.c    Mon Dec 30 22:52:08 2002
+++ b/drivers/usb/core/hcd.c    Mon Dec 30 22:52:08 2002
@@ -1339,6 +1339,12 @@
 
 /*-------------------------------------------------------------------------*/
 
+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 @@
                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);
 
diff -Nru a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h
--- a/drivers/usb/core/hcd.h    Mon Dec 30 22:52:08 2002
+++ b/drivers/usb/core/hcd.h    Mon Dec 30 22:52:08 2002
@@ -67,6 +67,7 @@
 
        struct timer_list       rh_timer;       /* drives root hub */
        struct list_head        dev_list;       /* devices on this bus */
+       struct work_struct      work;
 
        /*
         * hardware info/state


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to