linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mmc: core: fix the aysync mechanism when card removed
@ 2013-01-22 12:18 Jaehoon Chung
  2013-01-31  7:06 ` Jaehoon Chung
  2013-01-31  8:42 ` Subhash Jadavani
  0 siblings, 2 replies; 6+ messages in thread
From: Jaehoon Chung @ 2013-01-22 12:18 UTC (permalink / raw)
  To: linux-mmc
  Cc: Chris Ball, Konstantin Dorfman, Kyungmin Park, Per FORLIN,
	Maya Erez

When card removed, then didn't complete the previously data.
(It didn't wakeup any interrupt.)
If card is removed, then we can assume to complete the previously data.
And wakeup the interrupt for wait_event of data.

This problem is produced when sd-card is removed.(Sd-card is running some operation)

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Kyungmin Park <Kyungmin.park@samsung.com>
---
 drivers/mmc/core/core.c |   31 ++++++++++++++++++++-----------
 1 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 8b3a122..bc1d627 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -515,17 +515,26 @@ struct mmc_async_req *mmc_start_req(struct mmc_host *host,
 		mmc_pre_req(host, areq->mrq, !host->areq);
 
 	if (host->areq) {
-			err = mmc_wait_for_data_req_done(host, host->areq->mrq,
-					areq);
-			if (err == MMC_BLK_NEW_REQUEST) {
-				if (error)
-					*error = err;
-				/*
-				 * The previous request was not completed,
-				 * nothing to return
-				 */
-				return NULL;
-			}
+		err = mmc_wait_for_data_req_done(host, host->areq->mrq,
+				areq);
+		if (err == MMC_BLK_NEW_REQUEST) {
+			if (error)
+				*error = err;
+			/*
+			 * The previous request was not completed,
+			 * nothing to return
+			 */
+			return NULL;
+		} else if (err == MMC_BLK_NOMEDIUM && areq) {
+			struct mmc_context_info *ctnx = &host->context_info;
+			/*
+			 * If crad is removed,
+			 * then we didn't wait for data completed.
+			 * Assume that data-recieve done.
+			 */
+			ctnx->is_done_rcv = true;
+			wake_up_interruptible(&ctnx->wait);
+		}
 		/*
 		 * Check BKOPS urgency for each R1 response
 		 */
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-01-31 11:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-22 12:18 [PATCH] mmc: core: fix the aysync mechanism when card removed Jaehoon Chung
2013-01-31  7:06 ` Jaehoon Chung
2013-01-31  8:42 ` Subhash Jadavani
2013-01-31  9:46   ` Jaehoon Chung
2013-01-31 10:48     ` Seungwon Jeon
2013-01-31 11:03       ` Jaehoon Chung

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).