Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=01cd08192040eab30f837f061ca07f43cf15f4a1
Commit:     01cd08192040eab30f837f061ca07f43cf15f4a1
Parent:     fc4cbd755b75c7687b923da5b75ba4a64652582e
Author:     Arjan van de Ven <[EMAIL PROTECTED]>
AuthorDate: Tue May 22 12:42:56 2007 -0700
Committer:  Greg Kroah-Hartman <[EMAIL PROTECTED]>
CommitDate: Thu Jul 12 16:29:48 2007 -0700

    USB: Patch to align the various USB timers to fire at the same time
    
    This patch modifies the USB regular 250ms timer to be "perfectly aligned" to
    the second and quarters thereof. This change is there to make sure that if
    you have multiple USB ports, the timers for all these ports will fire at the
    same time rather than all spread out. All spread out wakes the CPU up from
    power saving idle a lot more than needed...
    
    
    Signed-off-by: Arjan van de Ven <[EMAIL PROTECTED]>
    Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
---
 drivers/usb/core/hcd.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 8969e42..c5a2f83 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -582,10 +582,12 @@ void usb_hcd_poll_rh_status(struct usb_hcd *hcd)
        }
 
        /* The USB 2.0 spec says 256 ms.  This is close enough and won't
-        * exceed that limit if HZ is 100. */
+        * exceed that limit if HZ is 100. The math is more clunky than
+        * maybe expected, this is to make sure that all timers for USB devices
+        * fire at the same time to give the CPU a break inbetween */
        if (hcd->uses_new_polling ? hcd->poll_rh :
                        (length == 0 && hcd->status_urb != NULL))
-               mod_timer (&hcd->rh_timer, jiffies + msecs_to_jiffies(250));
+               mod_timer (&hcd->rh_timer, (jiffies/(HZ/4) + 1) * (HZ/4));
 }
 EXPORT_SYMBOL_GPL(usb_hcd_poll_rh_status);
 
@@ -614,8 +616,8 @@ static int rh_queue_status (struct usb_hcd *hcd, struct urb 
*urb)
                urb->hcpriv = hcd;      /* indicate it's queued */
 
                if (!hcd->uses_new_polling)
-                       mod_timer (&hcd->rh_timer, jiffies +
-                                       msecs_to_jiffies(250));
+                       mod_timer (&hcd->rh_timer,
+                               (jiffies/(HZ/4) + 1) * (HZ/4));
 
                /* If a status change has already occurred, report it ASAP */
                else if (hcd->poll_pending)
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to