| @@ -2435,6 +2435,19 @@ EXPORT_SYMBOL_GPL(usb_hcd_irq); · 2434 unmodified lines |
| 2435 | | 2435 | |
| 2436 | /*-------------------------------------------------------------------------*/ | 2436 | /*-------------------------------------------------------------------------*/ |
| 2437 | | 2437 | |
| | 2438 | /* Workqueue routine for when the root-hub has died. */ |
| | 2439 | static void hcd_died_work(struct work_struct *work) |
| | 2440 | { |
| | 2441 | struct usb_hcd *hcd = container_of(work, struct usb_hcd, died_work); |
| | 2442 | static char *env[] = { |
| | 2443 | "ERROR=DEAD", |
| | 2444 | NULL |
| | 2445 | }; |
| | 2446 | |
| | 2447 | /* Notify user space that the host controller has died */ |
| | 2448 | kobject_uevent_env(&hcd->self.root_hub->dev.kobj, KOBJ_OFFLINE, env); |
| | 2449 | } |
| | 2450 | |
| 2438 | /** | 2451 | /** |
| 2439 | * usb_hc_died - report abnormal shutdown of a host controller (bus glue) | 2452 | * usb_hc_died - report abnormal shutdown of a host controller (bus glue) |
| 2440 | * @hcd: pointer to the HCD representing the controller | 2453 | * @hcd: pointer to the HCD representing the controller |
| @@ -2475,6 +2488,13 @@ void usb_hc_died (struct usb_hcd *hcd) · 34 unmodified lines |
| 2475 | usb_kick_hub_wq(hcd->self.root_hub); | 2488 | usb_kick_hub_wq(hcd->self.root_hub); |
| 2476 | } | 2489 | } |
| 2477 | } | 2490 | } |
| | 2491 | |
| | 2492 | /* Handle the case where this function gets called with a shared HCD */ |
| | 2493 | if (usb_hcd_is_primary_hcd(hcd)) |
| | 2494 | schedule_work(&hcd->died_work); |
| | 2495 | else |
| | 2496 | schedule_work(&hcd->primary_hcd->died_work); |
| | 2497 | |
| 2478 | spin_unlock_irqrestore (&hcd_root_hub_lock, flags); | 2498 | spin_unlock_irqrestore (&hcd_root_hub_lock, flags); |
| 2479 | /* Make sure that the other roothub is also deallocated. */ | 2499 | /* Make sure that the other roothub is also deallocated. */ |
| 2480 | } | 2500 | } |
| @@ -2542,6 +2562,8 @@ struct usb_hcd *__usb_create_hcd(const struct hc_driver *driver, · 61 unmodified lines |
| 2542 | INIT_WORK(&hcd->wakeup_work, hcd_resume_work); | 2562 | INIT_WORK(&hcd->wakeup_work, hcd_resume_work); |
| 2543 | #endif | 2563 | #endif |
| 2544 | | 2564 | |
| | 2565 | INIT_WORK(&hcd->died_work, hcd_died_work); |
| | 2566 | |
| 2545 | hcd->driver = driver; | 2567 | hcd->driver = driver; |
| 2546 | hcd->speed = driver->flags & HCD_MASK; | 2568 | hcd->speed = driver->flags & HCD_MASK; |
| 2547 | hcd->product_desc = (driver->product_desc) ? driver->product_desc : | 2569 | hcd->product_desc = (driver->product_desc) ? driver->product_desc : |
| @@ -2895,6 +2917,7 @@ error_create_attr_group: · 347 unmodified lines |
| 2895 | #ifdef CONFIG_PM | 2917 | #ifdef CONFIG_PM |
| 2896 | cancel_work_sync(&hcd->wakeup_work); | 2918 | cancel_work_sync(&hcd->wakeup_work); |
| 2897 | #endif | 2919 | #endif |
| | 2920 | cancel_work_sync(&hcd->died_work); |
| 2898 | mutex_lock(&usb_bus_idr_lock); | 2921 | mutex_lock(&usb_bus_idr_lock); |
| 2899 | usb_disconnect(&rhdev); /* Sets rhdev to NULL */ | 2922 | usb_disconnect(&rhdev); /* Sets rhdev to NULL */ |
| 2900 | mutex_unlock(&usb_bus_idr_lock); | 2923 | mutex_unlock(&usb_bus_idr_lock); |
| @@ -2955,6 +2978,7 @@ void usb_remove_hcd(struct usb_hcd *hcd) · 54 unmodified lines |
| 2955 | #ifdef CONFIG_PM | 2978 | #ifdef CONFIG_PM |
| 2956 | cancel_work_sync(&hcd->wakeup_work); | 2979 | cancel_work_sync(&hcd->wakeup_work); |
| 2957 | #endif | 2980 | #endif |
| | 2981 | cancel_work_sync(&hcd->died_work); |
| 2958 | | 2982 | |
| 2959 | mutex_lock(&usb_bus_idr_lock); | 2983 | mutex_lock(&usb_bus_idr_lock); |
| 2960 | usb_disconnect(&rhdev); /* Sets rhdev to NULL */ | 2984 | usb_disconnect(&rhdev); /* Sets rhdev to NULL */ |