mmc: core: Further fix thread wake-up
authorAdrian Hunter <adrian.hunter@intel.com>
Mon, 19 Dec 2016 13:57:34 +0000 (15:57 +0200)
committerUlf Hansson <ulf.hansson@linaro.org>
Tue, 20 Dec 2016 10:55:04 +0000 (11:55 +0100)
Commit e0097cf5f2f1 ("mmc: queue: Fix queue thread wake-up") did not go far
enough. mmc_wait_for_data_req_done() still contains some problems and can
be further simplified.  First it should not touch
context_info->is_waiting_last_req because that is a wake-up control used by
the owner of the context. Secondly, it should always return when one of its
wake-up conditions is met because, again, that is contolled by the owner of
the context.

While the current block driver does not have an issue, these problems were
exposed during testing of the Software Command Queue patches.

Fixes: e0097cf5f2f1 ("mmc: queue: Fix queue thread wake-up")
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Tested-by: Harjani Ritesh <riteshh@codeaurora.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/core/core.c

index 543eadd230e55c8918c45c3ef3b6428cbb73ed97..1076b9d89df38e26bfb088fae3586a6c577fd70e 100644 (file)
@@ -496,8 +496,7 @@ static int __mmc_start_req(struct mmc_host *host, struct mmc_request *mrq)
  * Returns enum mmc_blk_status after checking errors.
  */
 static enum mmc_blk_status mmc_wait_for_data_req_done(struct mmc_host *host,
-                                     struct mmc_request *mrq,
-                                     struct mmc_async_req *next_req)
+                                                     struct mmc_request *mrq)
 {
        struct mmc_command *cmd;
        struct mmc_context_info *context_info = &host->context_info;
@@ -507,7 +506,7 @@ static enum mmc_blk_status mmc_wait_for_data_req_done(struct mmc_host *host,
                wait_event_interruptible(context_info->wait,
                                (context_info->is_done_rcv ||
                                 context_info->is_new_req));
-               context_info->is_waiting_last_req = false;
+
                if (context_info->is_done_rcv) {
                        context_info->is_done_rcv = false;
                        cmd = mrq->cmd;
@@ -527,10 +526,9 @@ static enum mmc_blk_status mmc_wait_for_data_req_done(struct mmc_host *host,
                                __mmc_start_request(host, mrq);
                                continue; /* wait for done/new event again */
                        }
-               } else if (context_info->is_new_req) {
-                       if (!next_req)
-                               return MMC_BLK_NEW_REQUEST;
                }
+
+               return MMC_BLK_NEW_REQUEST;
        }
        mmc_retune_release(host);
        return status;
@@ -660,7 +658,7 @@ struct mmc_async_req *mmc_start_req(struct mmc_host *host,
                mmc_pre_req(host, areq->mrq);
 
        if (host->areq) {
-               status = mmc_wait_for_data_req_done(host, host->areq->mrq, areq);
+               status = mmc_wait_for_data_req_done(host, host->areq->mrq);
                if (status == MMC_BLK_NEW_REQUEST) {
                        if (ret_stat)
                                *ret_stat = status;