From patchwork Tue Jan 22 12:18:20 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaehoon Chung X-Patchwork-Id: 2018361 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 9C781DF2EB for ; Tue, 22 Jan 2013 12:18:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752918Ab3AVMSb (ORCPT ); Tue, 22 Jan 2013 07:18:31 -0500 Received: from mailout4.samsung.com ([203.254.224.34]:19393 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752894Ab3AVMSb (ORCPT ); Tue, 22 Jan 2013 07:18:31 -0500 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MH100BHS0UTHVV0@mailout4.samsung.com> for linux-mmc@vger.kernel.org; Tue, 22 Jan 2013 21:18:29 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [203.254.230.42]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id AA.1B.03918.5938EF05; Tue, 22 Jan 2013 21:18:29 +0900 (KST) X-AuditID: cbfee61a-b7f7d6d000000f4e-5c-50fe83951c06 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 3A.1B.03918.5938EF05; Tue, 22 Jan 2013 21:18:29 +0900 (KST) Received: from [10.90.51.55] by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MH100B6B0UT2Q80@mmp1.samsung.com> for linux-mmc@vger.kernel.org; Tue, 22 Jan 2013 21:18:29 +0900 (KST) Message-id: <50FE838C.5010709@samsung.com> Date: Tue, 22 Jan 2013 21:18:20 +0900 From: Jaehoon Chung User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130106 Thunderbird/17.0.2 MIME-version: 1.0 To: linux-mmc Cc: Chris Ball , Konstantin Dorfman , Kyungmin Park , Per FORLIN , Maya Erez Subject: [PATCH] mmc: core: fix the aysync mechanism when card removed Content-type: text/plain; charset=ISO-8859-1 Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrMIsWRmVeSWpSXmKPExsVy+t8zLd2pzf8CDM7e1LA48r+f0YHR4/Mm uQDGKC6blNSczLLUIn27BK6MxjOXWAu+8VZ86P3N1sD4nKuLkZNDQsBEYvXXDjYIW0ziwr31 YLaQwDJGiecrc2BqZs6Zy9rFyAUUX8QoceteMxOE084kcXHKDrAOXgEtiU3/ehhBbBYBVYll 21aB2WwCOhLbvx1nArFFBcIkVk6/wgJRLyjxY/I9MFtEQFOic/tKNpChzALHGCUuLzkD1iAs 4CZx8eYuMJsZaND+1mlsELa8xOY1b5lBGiQEXrNJ3DlwhQ1is4DEt8mHgKZyACVkJTYdYIZ4 QVLi4IobLBMYRWYh2T0LydhZSMYuYGRexSiaWpBcUJyUnmuoV5yYW1yal66XnJ+7iRES5FI7 GFc2WBxiFOBgVOLhtXj0N0CINbGsuDL3EKMEB7OSCK9u/b8AId6UxMqq1KL8+KLSnNTiQ4zJ QAdOZJYSTc4HRmBeSbyhsYGxoaGloZmppakBacJK4ryMp54ECAmkJ5akZqemFqQWwWxh4uCU amBkE3iV03JA+6lMg57LWnGNrJzlVlnXEudlxG16LRHOv3PNhxjffzfKJp+/df3LxlM5ry45 Pm3Uf56zIjR4RubT/5cnF+zYsSlgzkK/o7wLdZ7uabqm1VUkLO1/vOpydFvOz+71V2Lto23v zNwikqHE+UZRoGPPtdiCOfdu6Ku2LhCsmt7x4dc0JZbijERDLeai4kQACZlULbYCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrMIsWRmVeSWpSXmKPExsVy+t9jAd2pzf8CDDra5C2O/O9ndGD0+LxJ LoAxqoHRJiM1MSW1SCE1Lzk/JTMv3VbJOzjeOd7UzMBQ19DSwlxJIS8xN9VWycUnQNctMwdo qpJCWWJOKVAoILG4WEnfDtOE0BA3XQuYxghd35AguB4jAzSQsI4xo/HMJdaCb7wVH3p/szUw PufqYuTkkBAwkZg5Zy4rhC0mceHeerYuRi4OIYFFjBK37jUzQTjtTBIXp+xgA6niFdCS2PSv hxHEZhFQlVi2bRWYzSagI7H923EmEFtUIExi5fQrLBD1ghI/Jt8Ds0UENCU6t68E28AscIxR 4vKSM2ANwgJuEhdv7gKzmYEG7W+dxgZhy0tsXvOWeQIj3ywks2YhKZuFpGwBI/MqRtHUguSC 4qT0XEO94sTc4tK8dL3k/NxNjOAoeia1g3Flg8UhRgEORiUeXotHfwOEWBPLiitzDzFKcDAr ifDq1v8LEOJNSaysSi3Kjy8qzUktPsSYDPTqRGYp0eR8YITnlcQbGpuYGVkamRmbmBsbkyas JM7LeOpJgJBAemJJanZqakFqEcwWJg5OqQbGsMkXL7XfLVO1UFE6pXN87dNry078mVBV4bLv zrrgmDWfZ5yLCbH92d778McLWfcP75I59EMvarFrOtX56WgJ1/q8/PyfSWfLkZqZtbFpX3/p G7I7RrH6V15clzbnHTffOf+7as8q19ibT+pOydi53OSxkpXCE8ZiY1+Pjkn3SyMnZH74IbZQ iaU4I9FQi7moOBEAQxXpauYCAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org 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 Signed-off-by: Kyungmin Park --- 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 */