Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 297341
b: refs/heads/master
c: 956d9fd
h: refs/heads/master
i:
  297339: 488982b
v: v3
  • Loading branch information
Ulf Hansson authored and Chris Ball committed Mar 27, 2012
1 parent 15009c0 commit 01c209f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 21 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: 907d2e7cc7ebba4ab398422a7f0435e1802be65b
refs/heads/master: 956d9fd5eb3cbb322440844ed341145707bd71f8
35 changes: 15 additions & 20 deletions trunk/drivers/mmc/core/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,16 +249,17 @@ static void mmc_wait_done(struct mmc_request *mrq)
complete(&mrq->completion);
}

static void __mmc_start_req(struct mmc_host *host, struct mmc_request *mrq)
static int __mmc_start_req(struct mmc_host *host, struct mmc_request *mrq)
{
init_completion(&mrq->completion);
mrq->done = mmc_wait_done;
if (mmc_card_removed(host->card)) {
mrq->cmd->error = -ENOMEDIUM;
complete(&mrq->completion);
return;
return -ENOMEDIUM;
}
mmc_start_request(host, mrq);
return 0;
}

static void mmc_wait_for_req_done(struct mmc_host *host,
Expand Down Expand Up @@ -342,6 +343,7 @@ struct mmc_async_req *mmc_start_req(struct mmc_host *host,
struct mmc_async_req *areq, int *error)
{
int err = 0;
int start_err = 0;
struct mmc_async_req *data = host->areq;

/* Prepare a new request */
Expand All @@ -351,30 +353,23 @@ struct mmc_async_req *mmc_start_req(struct mmc_host *host,
if (host->areq) {
mmc_wait_for_req_done(host, host->areq->mrq);
err = host->areq->err_check(host->card, host->areq);
if (err) {
/* post process the completed failed request */
mmc_post_req(host, host->areq->mrq, 0);
if (areq)
/*
* Cancel the new prepared request, because
* it can't run until the failed
* request has been properly handled.
*/
mmc_post_req(host, areq->mrq, -EINVAL);

host->areq = NULL;
goto out;
}
}

if (areq)
__mmc_start_req(host, areq->mrq);
if (!err && areq)
start_err = __mmc_start_req(host, areq->mrq);

if (host->areq)
mmc_post_req(host, host->areq->mrq, 0);

host->areq = areq;
out:
/* Cancel a prepared request if it was not started. */
if ((err || start_err) && areq)
mmc_post_req(host, areq->mrq, -EINVAL);

if (err)
host->areq = NULL;
else
host->areq = areq;

if (error)
*error = err;
return data;
Expand Down

0 comments on commit 01c209f

Please sign in to comment.