From patchwork Tue Jan 6 21:32:36 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geoff Levand X-Patchwork-Id: 16872 X-Patchwork-Delegate: benh@kernel.crashing.org Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 9CFE047845 for ; Wed, 7 Jan 2009 08:36:31 +1100 (EST) X-Original-To: linuxppc-dev@ozlabs.org Delivered-To: linuxppc-dev@ozlabs.org Received: from WA4EHSOBE004.bigfish.com (outbound-wa4.frontbridge.com [216.32.181.16]) by ozlabs.org (Postfix) with ESMTP id 16F1F47509; Wed, 7 Jan 2009 08:33:18 +1100 (EST) Received: from mail168-wa4-R.bigfish.com (10.8.14.254) by WA4EHSOBE004.bigfish.com (10.8.40.24) with Microsoft SMTP Server id 8.1.291.1; Tue, 6 Jan 2009 21:33:15 +0000 Received: from mail168-wa4 (localhost.localdomain [127.0.0.1]) by mail168-wa4-R.bigfish.com (Postfix) with ESMTP id 1D05FAC0084; Tue, 6 Jan 2009 21:33:15 +0000 (UTC) X-BigFish: VPS3(zcb8kzzzzzz2fh6bh61h) X-Spam-TCS-SCL: 0:0 X-FB-SS: 5, Received: by mail168-wa4 (MessageSwitch) id 1231277593700971_2035; Tue, 6 Jan 2009 21:33:13 +0000 (UCT) Received: from mail8.fw-sd.sony.com (mail8.fw-sd.sony.com [160.33.66.75]) by mail168-wa4.bigfish.com (Postfix) with ESMTP id 8F7FC1438051; Tue, 6 Jan 2009 21:33:13 +0000 (UTC) Received: from mail3.sjc.in.sel.sony.com (mail3.sjc.in.sel.sony.com [43.134.1.211]) by mail8.fw-sd.sony.com (8.14.2/8.14.2) with ESMTP id n06LXDVI007714; Tue, 6 Jan 2009 21:33:13 GMT Received: from ussdixhub21.spe.sony.com (ussdixhub21.spe.sony.com [43.130.141.76]) by mail3.sjc.in.sel.sony.com (8.12.11/8.12.11) with ESMTP id n06LX9T3019376; Tue, 6 Jan 2009 21:33:12 GMT Received: from USSDIXRG02.am.sony.com (43.130.140.32) by ussdixhub21.spe.sony.com (43.130.141.76) with Microsoft SMTP Server id 8.1.291.1; Tue, 6 Jan 2009 13:32:52 -0800 Received: from ussdixms03.am.sony.com ([43.130.140.23]) by USSDIXRG02.am.sony.com with Microsoft SMTPSVC(5.0.2195.6713); Tue, 6 Jan 2009 13:32:52 -0800 Received: from [192.168.1.10] ([43.135.148.226]) by ussdixms03.am.sony.com with Microsoft SMTPSVC(5.0.2195.6713); Tue, 6 Jan 2009 13:32:52 -0800 Message-ID: <4963CDF4.1070403@am.sony.com> Date: Tue, 6 Jan 2009 13:32:36 -0800 From: Geoff Levand User-Agent: Thunderbird 2.0.0.18 (X11/20081119) MIME-Version: 1.0 To: Benjamin Herrenschmidt Subject: [patch 6/6] mtd/ps3vram: Use msleep in waits References: <4963CA52.9030902@am.sony.com> In-Reply-To: <4963CA52.9030902@am.sony.com> X-Enigmail-Version: 0.95.7 X-OriginalArrivalTime: 06 Jan 2009 21:32:52.0257 (UTC) FILETIME=[54631110:01C97046] X-SEL-encryption-scan: scanned Cc: David Woodhouse , Arnd Bergmann , Jim Paris , linuxppc-dev@ozlabs.org, Vivien Chappelier , cbe-oss-dev@ozlabs.org X-BeenThere: linuxppc-dev@ozlabs.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org Replace the use of udelay() with msleep() in the looping wait routines ps3vram_notifier_wait() and ps3vram_wait_ring(). Signed-off-by: Geoff Levand --- 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)