diff options
-rw-r--r-- | drivers/mmc/core/core.c | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 9698d8a2e166..ec7694903008 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c | |||
@@ -141,12 +141,12 @@ void mmc_request_done(struct mmc_host *host, struct mmc_request *mrq) | |||
141 | } | 141 | } |
142 | 142 | ||
143 | if (err && cmd->retries) { | 143 | if (err && cmd->retries) { |
144 | pr_debug("%s: req failed (CMD%u): %d, retrying...\n", | 144 | /* |
145 | mmc_hostname(host), cmd->opcode, err); | 145 | * Request starter must handle retries - see |
146 | 146 | * mmc_wait_for_req_done(). | |
147 | cmd->retries--; | 147 | */ |
148 | cmd->error = 0; | 148 | if (mrq->done) |
149 | host->ops->request(host, mrq); | 149 | mrq->done(mrq); |
150 | } else { | 150 | } else { |
151 | mmc_should_fail_request(host, mrq); | 151 | mmc_should_fail_request(host, mrq); |
152 | 152 | ||
@@ -253,7 +253,21 @@ static void __mmc_start_req(struct mmc_host *host, struct mmc_request *mrq) | |||
253 | static void mmc_wait_for_req_done(struct mmc_host *host, | 253 | static void mmc_wait_for_req_done(struct mmc_host *host, |
254 | struct mmc_request *mrq) | 254 | struct mmc_request *mrq) |
255 | { | 255 | { |
256 | wait_for_completion(&mrq->completion); | 256 | struct mmc_command *cmd; |
257 | |||
258 | while (1) { | ||
259 | wait_for_completion(&mrq->completion); | ||
260 | |||
261 | cmd = mrq->cmd; | ||
262 | if (!cmd->error || !cmd->retries) | ||
263 | break; | ||
264 | |||
265 | pr_debug("%s: req failed (CMD%u): %d, retrying...\n", | ||
266 | mmc_hostname(host), cmd->opcode, cmd->error); | ||
267 | cmd->retries--; | ||
268 | cmd->error = 0; | ||
269 | host->ops->request(host, mrq); | ||
270 | } | ||
257 | } | 271 | } |
258 | 272 | ||
259 | /** | 273 | /** |