Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 127686
b: refs/heads/master
c: 60c0c59
h: refs/heads/master
v: v3
  • Loading branch information
Geoff Levand authored and Benjamin Herrenschmidt committed Jan 8, 2009
1 parent b487d02 commit 120c598
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 24 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 993e62e674ba670341f11f60398446bb37a88e8b
refs/heads/master: 60c0c5987b0996a7c7c4c6d90f63ed413c368a71
40 changes: 17 additions & 23 deletions trunk/drivers/mtd/devices/ps3vram.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,22 +109,19 @@ static void ps3vram_notifier_reset(struct mtd_info *mtd)
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;
unsigned long timeout = jiffies + msecs_to_jiffies(timeout_ms);

do {
if (notify[3] == 0)
if (!notify[3])
return 0;
msleep(1);
} while (time_before(jiffies, timeout));

if (timeout_ms)
udelay(1);
} while (timeout_ms--);

return -1;
return -ETIMEDOUT;
}

static void ps3vram_init_ring(struct mtd_info *mtd)
Expand All @@ -135,25 +132,22 @@ static void ps3vram_init_ring(struct mtd_info *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;
unsigned long timeout = jiffies + msecs_to_jiffies(timeout_ms);

/* 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 (time_before(jiffies, timeout));

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)
Expand Down

0 comments on commit 120c598

Please sign in to comment.