aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/devices
diff options
context:
space:
mode:
authorGeoff Levand <geoffrey.levand@am.sony.com>2009-01-07 20:22:02 -0500
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2009-01-08 00:25:15 -0500
commit60c0c5987b0996a7c7c4c6d90f63ed413c368a71 (patch)
tree18b559a7585b88588f1a318d70704f2a2ae9373e /drivers/mtd/devices
parent993e62e674ba670341f11f60398446bb37a88e8b (diff)
mtd/ps3vram: Use msleep in waits
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> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'drivers/mtd/devices')
-rw-r--r--drivers/mtd/devices/ps3vram.c40
1 files changed, 17 insertions, 23 deletions
diff --git a/drivers/mtd/devices/ps3vram.c b/drivers/mtd/devices/ps3vram.c
index 91cc2afbe14e..d5924142d909 100644
--- a/drivers/mtd/devices/ps3vram.c
+++ b/drivers/mtd/devices/ps3vram.c
@@ -109,22 +109,19 @@ static void ps3vram_notifier_reset(struct mtd_info *mtd)
109 notify[i] = 0xffffffff; 109 notify[i] = 0xffffffff;
110} 110}
111 111
112static int ps3vram_notifier_wait(struct mtd_info *mtd, int timeout_ms) 112static int ps3vram_notifier_wait(struct mtd_info *mtd, unsigned int timeout_ms)
113{ 113{
114 struct ps3vram_priv *priv = mtd->priv; 114 struct ps3vram_priv *priv = mtd->priv;
115 u32 *notify = ps3vram_get_notifier(priv->reports, NOTIFIER); 115 u32 *notify = ps3vram_get_notifier(priv->reports, NOTIFIER);
116 116 unsigned long timeout = jiffies + msecs_to_jiffies(timeout_ms);
117 timeout_ms *= 1000;
118 117
119 do { 118 do {
120 if (notify[3] == 0) 119 if (!notify[3])
121 return 0; 120 return 0;
121 msleep(1);
122 } while (time_before(jiffies, timeout));
122 123
123 if (timeout_ms) 124 return -ETIMEDOUT;
124 udelay(1);
125 } while (timeout_ms--);
126
127 return -1;
128} 125}
129 126
130static void ps3vram_init_ring(struct mtd_info *mtd) 127static void ps3vram_init_ring(struct mtd_info *mtd)
@@ -135,25 +132,22 @@ static void ps3vram_init_ring(struct mtd_info *mtd)
135 priv->ctrl[CTRL_GET] = FIFO_BASE + FIFO_OFFSET; 132 priv->ctrl[CTRL_GET] = FIFO_BASE + FIFO_OFFSET;
136} 133}
137 134
138static int ps3vram_wait_ring(struct mtd_info *mtd, int timeout) 135static int ps3vram_wait_ring(struct mtd_info *mtd, unsigned int timeout_ms)
139{ 136{
140 struct ps3vram_priv *priv = mtd->priv; 137 struct ps3vram_priv *priv = mtd->priv;
138 unsigned long timeout = jiffies + msecs_to_jiffies(timeout_ms);
141 139
142 /* wait until setup commands are processed */ 140 do {
143 timeout *= 1000;
144 while (--timeout) {
145 if (priv->ctrl[CTRL_PUT] == priv->ctrl[CTRL_GET]) 141 if (priv->ctrl[CTRL_PUT] == priv->ctrl[CTRL_GET])
146 break; 142 return 0;
147 udelay(1); 143 msleep(1);
148 } 144 } while (time_before(jiffies, timeout));
149 if (timeout == 0) {
150 dev_dbg(priv->dev, "%s:%d: FIFO timeout (%08x/%08x/%08x)\n",
151 __func__, __LINE__, priv->ctrl[CTRL_PUT],
152 priv->ctrl[CTRL_GET], priv->ctrl[CTRL_TOP]);
153 return -ETIMEDOUT;
154 }
155 145
156 return 0; 146 dev_dbg(priv->dev, "%s:%d: FIFO timeout (%08x/%08x/%08x)\n", __func__,
147 __LINE__, priv->ctrl[CTRL_PUT], priv->ctrl[CTRL_GET],
148 priv->ctrl[CTRL_TOP]);
149
150 return -ETIMEDOUT;
157} 151}
158 152
159static void ps3vram_out_ring(struct ps3vram_priv *priv, u32 data) 153static void ps3vram_out_ring(struct ps3vram_priv *priv, u32 data)