diff options
Diffstat (limited to 'drivers/mtd/devices/ps3vram.c')
-rw-r--r-- | drivers/mtd/devices/ps3vram.c | 40 |
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 | ||
112 | static int ps3vram_notifier_wait(struct mtd_info *mtd, int timeout_ms) | 112 | static 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 | ||
130 | static void ps3vram_init_ring(struct mtd_info *mtd) | 127 | static 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 | ||
138 | static int ps3vram_wait_ring(struct mtd_info *mtd, int timeout) | 135 | static 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 | ||
159 | static void ps3vram_out_ring(struct ps3vram_priv *priv, u32 data) | 153 | static void ps3vram_out_ring(struct ps3vram_priv *priv, u32 data) |