usb: move hub init and LED blink work to power efficient workqueue
authorShaibal Dutta <[email protected]>
Sun, 2 Feb 2014 03:16:46 +0000 (19:16 -0800)
committerGreg Kroah-Hartman <[email protected]>
Fri, 7 Feb 2014 22:41:05 +0000 (14:41 -0800)
Allow the scheduler to select the best CPU to handle hub initalization
and LED blinking work. This extends idle residency times on idle CPUs
and conserves power.

This functionality is enabled when CONFIG_WQ_POWER_EFFICIENT is selected.

[[email protected]: Rebased to latest kernel. Added commit message.
Changed reference from system to power efficient workqueue for LEDs in
check_highspeed() and hub_port_connect_change().]

Acked-by: Alan Stern <[email protected]>
Cc: Sarah Sharp <[email protected]>
Cc: Xenia Ragiadakou <[email protected]>
Cc: Julius Werner <[email protected]>
Cc: Krzysztof Mazur <[email protected]>
Cc: Matthias Beyer <[email protected]>
Cc: Dan Williams <[email protected]>
Cc: Mathias Nyman <[email protected]>
Cc: Thomas Pugliese <[email protected]>
Signed-off-by: Shaibal Dutta <[email protected]>
Signed-off-by: Zoran Markovic <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
drivers/usb/core/hub.c

index 64ea21971be23f770986b25cf05890553cf8d195..519f2c3594b222a478ea9ff2856deb4c17850ed4 100644 (file)
@@ -499,7 +499,8 @@ static void led_work (struct work_struct *work)
                changed++;
        }
        if (changed)
-               schedule_delayed_work(&hub->leds, LED_CYCLE_PERIOD);
+               queue_delayed_work(system_power_efficient_wq,
+                               &hub->leds, LED_CYCLE_PERIOD);
 }
 
 /* use a short timeout for hub/port status fetches */
@@ -1041,7 +1042,8 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)
                if (type == HUB_INIT) {
                        delay = hub_power_on(hub, false);
                        PREPARE_DELAYED_WORK(&hub->init_work, hub_init_func2);
-                       schedule_delayed_work(&hub->init_work,
+                       queue_delayed_work(system_power_efficient_wq,
+                                       &hub->init_work,
                                        msecs_to_jiffies(delay));
 
                        /* Suppress autosuspend until init is done */
@@ -1195,7 +1197,8 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)
                /* Don't do a long sleep inside a workqueue routine */
                if (type == HUB_INIT2) {
                        PREPARE_DELAYED_WORK(&hub->init_work, hub_init_func3);
-                       schedule_delayed_work(&hub->init_work,
+                       queue_delayed_work(system_power_efficient_wq,
+                                       &hub->init_work,
                                        msecs_to_jiffies(delay));
                        return;         /* Continues at init3: below */
                } else {
@@ -1209,7 +1212,8 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)
        if (status < 0)
                dev_err(hub->intfdev, "activate --> %d\n", status);
        if (hub->has_indicators && blinkenlights)
-               schedule_delayed_work(&hub->leds, LED_CYCLE_PERIOD);
+               queue_delayed_work(system_power_efficient_wq,
+                               &hub->leds, LED_CYCLE_PERIOD);
 
        /* Scan all ports that need attention */
        kick_khubd(hub);
@@ -4311,7 +4315,8 @@ check_highspeed (struct usb_hub *hub, struct usb_device *udev, int port1)
                /* hub LEDs are probably harder to miss than syslog */
                if (hub->has_indicators) {
                        hub->indicator[port1-1] = INDICATOR_GREEN_BLINK;
-                       schedule_delayed_work (&hub->leds, 0);
+                       queue_delayed_work(system_power_efficient_wq,
+                                       &hub->leds, 0);
                }
        }
        kfree(qual);
@@ -4540,7 +4545,9 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1,
                                if (hub->has_indicators) {
                                        hub->indicator[port1-1] =
                                                INDICATOR_AMBER_BLINK;
-                                       schedule_delayed_work (&hub->leds, 0);
+                                       queue_delayed_work(
+                                               system_power_efficient_wq,
+                                               &hub->leds, 0);
                                }
                                status = -ENOTCONN;     /* Don't retry */
                                goto loop_disable;