linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Geoff Levand <geoffrey.levand@am.sony.com>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: David Woodhouse <David.Woodhouse@intel.com>,
	Arnd Bergmann <arnd@arndb.de>, Jim Paris <jim@jtan.com>,
	linuxppc-dev@ozlabs.org,
	Vivien Chappelier <vivien.chappelier@free.fr>,
	cbe-oss-dev@ozlabs.org
Subject: [patch 6/6] mtd/ps3vram: Use msleep in waits
Date: Tue, 6 Jan 2009 13:32:36 -0800	[thread overview]
Message-ID: <4963CDF4.1070403@am.sony.com> (raw)
In-Reply-To: <4963CA52.9030902@am.sony.com>

Replace the use of udelay() with msleep() in the looping wait routines
ps3vram_notifier_wait() and ps3vram_wait_ring().

Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
---
 drivers/mtd/devices/ps3vram.c |   36 ++++++++++++++----------------------
 1 file changed, 14 insertions(+), 22 deletions(-)

--- a/drivers/mtd/devices/ps3vram.c
+++ b/drivers/mtd/devices/ps3vram.c
@@ -109,22 +109,18 @@ static void ps3vram_notifier_reset(struc
 		notify[i] = 0xffffffff;
 }
 
-static int ps3vram_notifier_wait(struct mtd_info *mtd, int timeout_ms)
+static int ps3vram_notifier_wait(struct mtd_info *mtd, unsigned int timeout_ms)
 {
 	struct ps3vram_priv *priv = mtd->priv;
 	u32 *notify = ps3vram_get_notifier(priv->reports, NOTIFIER);
 
-	timeout_ms *= 1000;
-
 	do {
-		if (notify[3] == 0)
+		if (!notify[3])
 			return 0;
-
-		if (timeout_ms)
-			udelay(1);
+		msleep(1);
 	} while (timeout_ms--);
 
-	return -1;
+	return -ETIMEDOUT;
 }
 
 static void ps3vram_init_ring(struct mtd_info *mtd)
@@ -135,25 +131,21 @@ static void ps3vram_init_ring(struct mtd
 	priv->ctrl[CTRL_GET] = FIFO_BASE + FIFO_OFFSET;
 }
 
-static int ps3vram_wait_ring(struct mtd_info *mtd, int timeout)
+static int ps3vram_wait_ring(struct mtd_info *mtd, unsigned int timeout_ms)
 {
 	struct ps3vram_priv *priv = mtd->priv;
 
-	/* wait until setup commands are processed */
-	timeout *= 1000;
-	while (--timeout) {
+	do {
 		if (priv->ctrl[CTRL_PUT] == priv->ctrl[CTRL_GET])
-			break;
-		udelay(1);
-	}
-	if (timeout == 0) {
-		dev_dbg(priv->dev, "%s:%d: FIFO timeout (%08x/%08x/%08x)\n",
-			__func__, __LINE__, priv->ctrl[CTRL_PUT],
-			priv->ctrl[CTRL_GET], priv->ctrl[CTRL_TOP]);
-		return -ETIMEDOUT;
-	}
+			return 0;
+		msleep(1);
+	} while (timeout_ms--);
 
-	return 0;
+	dev_dbg(priv->dev, "%s:%d: FIFO timeout (%08x/%08x/%08x)\n", __func__,
+		__LINE__, priv->ctrl[CTRL_PUT], priv->ctrl[CTRL_GET],
+		priv->ctrl[CTRL_TOP]);
+
+	return -ETIMEDOUT;
 }
 
 static void ps3vram_out_ring(struct ps3vram_priv *priv, u32 data)

-- 

  parent reply	other threads:[~2009-01-06 21:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4963CA52.9030902@am.sony.com>
2009-01-06 21:32 ` [patch 2/6] powerpc/ps3: Add modalias support to the ps3vram driver Geoff Levand
2009-01-06 21:32 ` [patch 1/6] powerpc/ps3: ps3vram driver for accessing video RAM as MTD Geoff Levand
2009-01-06 21:32 ` [patch 3/6] mtd/ps3vram: Remove ps3vram debug routines Geoff Levand
2009-01-06 21:32 ` [patch 4/6] mtd/ps3vram: Cleanup ps3vram driver messages Geoff Levand
2009-01-06 21:32 ` [patch 5/6] mtd/ps3vram: Use kernel types Geoff Levand
2009-01-06 21:32 ` Geoff Levand [this message]
2009-01-07 19:25   ` [patch 6/6] mtd/ps3vram: Use msleep in waits Arnd Bergmann
2009-01-08  1:22   ` [patch 6/6 v2] " Geoff Levand

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=4963CDF4.1070403@am.sony.com \
    --to=geoffrey.levand@am.sony.com \
    --cc=David.Woodhouse@intel.com \
    --cc=arnd@arndb.de \
    --cc=benh@kernel.crashing.org \
    --cc=cbe-oss-dev@ozlabs.org \
    --cc=jim@jtan.com \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=vivien.chappelier@free.fr \
    /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;
as well as URLs for NNTP newsgroup(s).