mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Richard Kennedy <richard@rsk.demon.co.uk>
To: linux-usb <linux-usb@vger.kernel.org>
Cc: dbrownell@users.sourceforge.net,
	lkml <linux-kernel@vger.kernel.org>,
	Alan Stern <stern@rowland.harvard.edu>
Subject: [patch] usb ohci : fix 2 timers to fire at jiffies + 1s
Date: Wed, 26 Mar 2008 16:32:23 +0000	[thread overview]
Message-ID: <1206549143.2931.27.camel@castor.localdomain> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0803261136590.6324-100000@iolanthe.rowland.org>

    Code inspection discovered in 2 places timers were being
    incorrectly setup using round_jiffies_relative(HZ).
    The timer would then fire at time (0 <= T < HZ).
    
    Fix them to use round_jiffies(jiffies + HZ);
    
    Signed-off-by: Richard Kennedy <richard@rsk.demon.co.uk>
---

compiled on latest v2.6.25-rc7-11 git head but not otherwise tested.
Richard

diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index dd4798e..33f1c1c 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -467,7 +467,7 @@ static void unlink_watchdog_func(unsigned long _ohci)
 out:
 	kfree(seen);
 	if (ohci->eds_scheduled)
-		mod_timer(&ohci->unlink_watchdog, round_jiffies_relative(HZ));
+		mod_timer(&ohci->unlink_watchdog, round_jiffies(jiffies + HZ));
 done:
 	spin_unlock_irqrestore(&ohci->lock, flags);
 }
diff --git a/drivers/usb/host/ohci-q.c b/drivers/usb/host/ohci-q.c
index 5181732..9c9f3b5 100644
--- a/drivers/usb/host/ohci-q.c
+++ b/drivers/usb/host/ohci-q.c
@@ -169,7 +169,7 @@ static int ed_schedule (struct ohci_hcd *ohci, struct ed *ed)
 	if (quirk_zfmicro(ohci)
 			&& (ed->type == PIPE_INTERRUPT)
 			&& !(ohci->eds_scheduled++))
-		mod_timer(&ohci->unlink_watchdog, round_jiffies_relative(HZ));
+		mod_timer(&ohci->unlink_watchdog, round_jiffies(jiffies + HZ));
 	wmb ();
 
 	/* we care about rm_list when setting CLE/BLE in case the HC was at



  parent reply	other threads:[~2008-03-26 16:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-26 14:38 ohci : strange looking use of round_jiffies_relative. possible bug ? Richard Kennedy
2008-03-26 15:37 ` Alan Stern
2008-03-26 15:46   ` Richard Kennedy
2008-03-26 18:06     ` Mike Nuss
2008-03-27 18:55       ` David Brownell
2008-03-26 16:32   ` Richard Kennedy [this message]
2008-03-27 18:53     ` [patch] usb ohci : fix 2 timers to fire at jiffies + 1s David Brownell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1206549143.2931.27.camel@castor.localdomain \
    --to=richard@rsk.demon.co.uk \
    --cc=dbrownell@users.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®