summaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/ehci.h
diff options
context:
space:
mode:
authorYi Yang <yi.y.yang@intel.com>2008-09-25 17:25:44 +0800
committerGreg Kroah-Hartman <gregkh@suse.de>2008-10-17 14:41:02 -0700
commitf0d781d59cb621e1795d510039df973d0f8b23fc (patch)
treebc1a60dac25eef26e22d346ebf08496b7702ac94 /drivers/usb/host/ehci.h
parente58dcebcd83b5902411e747ee7807219dee6bcf2 (diff)
USB: improve ehci_watchdog's side effect in CPU power management
ehci_watchdog will wake up CPU very frequently so that CPU stays at C3 very short, average residence time is about 50 ms on Aspire One, but we expect it should be about 1 second or more, so this kind of periodic timer is very bad for power saving. We can't remove this timer because of some bad USB controller chipset, but at least we should reduce its side effect to as possible as low. This patch can make CPU stay at C3 longer, average residence time is about twice as long as original. Please consider to apply it, thanks Signed-off-by: Yi Yang <yi.y.yang@intel.com> Cc: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/host/ehci.h')
-rw-r--r--drivers/usb/host/ehci.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
index fb1770d6e20..a6fd550b690 100644
--- a/drivers/usb/host/ehci.h
+++ b/drivers/usb/host/ehci.h
@@ -181,14 +181,16 @@ timer_action (struct ehci_hcd *ehci, enum ehci_timer_action action)
* the async ring; just the I/O watchdog. Note that if a
* SHRINK were pending, OFF would never be requested.
*/
- if (timer_pending(&ehci->watchdog)
- && ((BIT(TIMER_ASYNC_SHRINK) | BIT(TIMER_ASYNC_OFF))
- & ehci->actions))
- return;
+ enum ehci_timer_action oldactions = ehci->actions;
if (!test_and_set_bit (action, &ehci->actions)) {
unsigned long t;
+ if (timer_pending(&ehci->watchdog)
+ && ((BIT(TIMER_ASYNC_SHRINK) | BIT(TIMER_ASYNC_OFF))
+ & oldactions))
+ return;
+
switch (action) {
case TIMER_IO_WATCHDOG:
t = EHCI_IO_JIFFIES;
@@ -204,7 +206,7 @@ timer_action (struct ehci_hcd *ehci, enum ehci_timer_action action)
t = DIV_ROUND_UP(EHCI_SHRINK_FRAMES * HZ, 1000) + 1;
break;
}
- mod_timer(&ehci->watchdog, t + jiffies);
+ mod_timer(&ehci->watchdog, round_jiffies(t + jiffies));
}
}