mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 4/6] ehci: use is_timeout for timeout instead of udelay counter
Date: Thu, 24 Jun 2010 11:45:49 +0200	[thread overview]
Message-ID: <1277372751-15797-5-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1277372751-15797-1-git-send-email-s.hauer@pengutronix.de>

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/usb/usb_ehci_core.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/usb_ehci_core.c b/drivers/usb/usb_ehci_core.c
index c5d4da3..e70e871 100644
--- a/drivers/usb/usb_ehci_core.c
+++ b/drivers/usb/usb_ehci_core.c
@@ -213,18 +213,20 @@ static inline void ehci_invalidate_dcache(struct QH *qh)
 static int handshake(uint32_t *ptr, uint32_t mask, uint32_t done, int usec)
 {
 	uint32_t result;
+	uint64_t start;
 
-	do {
+	start = get_time_ns();
+
+	while (1) {
 		result = ehci_readl(ptr);
 		if (result == ~(uint32_t)0)
 			return -1;
 		result &= mask;
 		if (result == done)
 			return 0;
-		udelay(1);
-		usec--;
-	} while (usec > 0);
-	return -1;
+		if (is_timeout(start, usec * USECOND))
+			return -ETIMEDOUT;
+	}
 }
 
 static int ehci_reset(struct ehci_priv *ehci)
-- 
1.7.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2010-06-24  9:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-24  9:45 USB related patches Sascha Hauer
2010-06-24  9:45 ` [PATCH 1/6] ehci: Make has_tt configurable via platform data Sascha Hauer
2010-06-24  9:45 ` [PATCH 2/6] ehci: Handle hub port reset properly Sascha Hauer
2010-06-24  9:45 ` [PATCH 3/6] usb: Check return value of host controller init Sascha Hauer
2010-06-24  9:45 ` Sascha Hauer [this message]
2010-06-24  9:45 ` [PATCH 5/6] ehci: Force a ehci_halt before trying to reset Sascha Hauer
2010-06-24  9:45 ` [PATCH 6/6] ehci: remove unused code Sascha Hauer

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=1277372751-15797-5-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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