From patchwork Fri Sep 28 10:12:53 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Seungwon Jeon X-Patchwork-Id: 1518271 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 EB330DF283 for ; Fri, 28 Sep 2012 10:12:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757082Ab2I1KM4 (ORCPT ); Fri, 28 Sep 2012 06:12:56 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:55497 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751138Ab2I1KMz (ORCPT ); Fri, 28 Sep 2012 06:12:55 -0400 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MB2004RA1PI6IZ0@mailout2.samsung.com> for linux-mmc@vger.kernel.org; Fri, 28 Sep 2012 19:12:54 +0900 (KST) X-AuditID: cbfee61b-b7f2b6d000000f14-65-5065782548f6 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 4B.24.03860.52875605; Fri, 28 Sep 2012 19:12:54 +0900 (KST) Received: from DOTGIHJUN01 ([12.23.118.161]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MB200H2M1PHWAB0@mmp2.samsung.com> for linux-mmc@vger.kernel.org; Fri, 28 Sep 2012 19:12:53 +0900 (KST) From: Seungwon Jeon To: linux-mmc@vger.kernel.org Cc: 'Chris Ball' , 'Per Forlin' References: In-reply-to: Subject: mmc: queue: amend buffer swap for non-blocking transfer Date: Fri, 28 Sep 2012 19:12:53 +0900 Message-id: <00fe01cd9d61$d2f6f180$78e4d480$%jun@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-transfer-encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Thread-index: Ac03z3aCvVFr8FaITt2vKVQKst76fw3Ogf7QC4iI1hAADVzV0A== Content-language: ko X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrGLMWRmVeSWpSXmKPExsVy+t9jQV21itQAgyWnWS2O/O9ndGD0+LxJ LoAxissmJTUnsyy1SN8ugSujsXcJW0EPd8Xs/yuYGhhfcHQxcnJICJhIvDu/kxHCFpO4cG89 WxcjF4eQwHRGiftfQBxOIGcWk8TVTa4gNpuAlsTfN2+YQWwRAVmJn38ugNUwC7hL3Nj3mLWL kQOonltidXMQSJhTgEdi3Z9OsHJhAQeJlgnTWUFsFgFViRcPDzODlPMK2Eo8fcAPEuYVEJT4 MfkeC0iYWUBdYsqUXIjh8hKb17wFq5YACj/6q9vFyA6030nivRFEgYjEvhfvGCcwCs1CMmYW wphZSMbMQtKxgJFlFaNoakFyQXFSeq6RXnFibnFpXrpecn7uJkZw6D6T3sG4qsHiEKMAB6MS D++N+SkBQqyJZcWVuYcYJTiYlUR4M4pTA4R4UxIrq1KL8uOLSnNSiw8xSnOwKInzNnsAVQuk J5akZqemFqQWwWSZODilGhhV/t6R+TzN7aCD66uTW2uXalzkW3jSufdJbcmWZ1f7Cqt/dK4x mq00YV57s5tjk2FCT+gupf0SO5ceW3hrUUpKamiowKWn8wpnvnSoO7+88XmEZcHiX6winZO2 Jk3Tma++Z+9c2QldJ2N+nrvBGOpWaub7jKnW9anFxrqkNSkxvp+7rvYE39dRYinOSDTUYi4q TgQAAmVkC1kCAAA= Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org In case both 'req' and 'mq->mqrq_prev->req' are null, there is no request to be processed. That means there is no need to switch buffer. Switching buffer is required only after finishing 'issue_fn'. Signed-off-by: Seungwon Jeon Reviewed-by: Per Forlin Tested-by: Johan Rudholm --- drivers/mmc/card/queue.c | 17 ++++++++++------- 1 files changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c index e360a97..fadf52e 100644 --- a/drivers/mmc/card/queue.c +++ b/drivers/mmc/card/queue.c @@ -68,6 +68,16 @@ static int mmc_queue_thread(void *d) if (req || mq->mqrq_prev->req) { set_current_state(TASK_RUNNING); mq->issue_fn(mq, req); + + /* + * Current request becomes previous request + * and vice versa. + */ + mq->mqrq_prev->brq.mrq.data = NULL; + mq->mqrq_prev->req = NULL; + tmp = mq->mqrq_prev; + mq->mqrq_prev = mq->mqrq_cur; + mq->mqrq_cur = tmp; } else { if (kthread_should_stop()) { set_current_state(TASK_RUNNING); @@ -77,13 +87,6 @@ static int mmc_queue_thread(void *d) schedule(); down(&mq->thread_sem); } - - /* Current request becomes previous request and vice versa. */ - mq->mqrq_prev->brq.mrq.data = NULL; - mq->mqrq_prev->req = NULL; - tmp = mq->mqrq_prev; - mq->mqrq_prev = mq->mqrq_cur; - mq->mqrq_cur = tmp; } while (1); up(&mq->thread_sem);