Skip to content

Commit

Permalink
USB: prevent autosuspend during hub initialization
Browse files Browse the repository at this point in the history
This patch (as1153) fixes a potential problem in hub initialization.
Starting in 2.6.28, initialization was split into several tasks to
help speed up booting.  This opens the possibility that the hub may be
autosuspended before all the initialization tasks can complete.

Normally that wouldn't matter, but with incomplete initialization
there is a risk that the hub would never autoresume -- especially if
devices were plugged into the hub beforehand.  The solution is a
simple one-line change to suppress autosuspend until the
initialization is finished.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Alan Stern authored and Greg Kroah-Hartman committed Oct 29, 2008
1 parent 74511bb commit 61fbeba
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/usb/core/hub.c
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,9 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)
PREPARE_DELAYED_WORK(&hub->init_work, hub_init_func2);
schedule_delayed_work(&hub->init_work,
msecs_to_jiffies(delay));

/* Suppress autosuspend until init is done */
to_usb_interface(hub->intfdev)->pm_usage_cnt = 1;
return; /* Continues at init2: below */
} else {
hub_power_on(hub, true);
Expand Down

0 comments on commit 61fbeba

Please sign in to comment.