From patchwork Tue Mar 10 12:42:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 5977661 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 09AD09F399 for ; Tue, 10 Mar 2015 12:45:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CCB8C2021F for ; Tue, 10 Mar 2015 12:45:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E8A4B201B9 for ; Tue, 10 Mar 2015 12:45:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752382AbbCJMpS (ORCPT ); Tue, 10 Mar 2015 08:45:18 -0400 Received: from mga01.intel.com ([192.55.52.88]:3552 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752012AbbCJMpR (ORCPT ); Tue, 10 Mar 2015 08:45:17 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 10 Mar 2015 05:45:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,374,1422950400"; d="scan'208";a="677835502" Received: from ahunter-desktop.fi.intel.com ([10.237.72.97]) by fmsmga001.fm.intel.com with ESMTP; 10 Mar 2015 05:45:14 -0700 From: Adrian Hunter To: Ulf Hansson , Chris Ball Cc: linux-mmc , Aaron Lu , Philip Rakity , Girish K S , Al Cooper , Arend van Spriel Subject: [PATCH V3 03/15] mmc: core: Add support for re-tuning before each request Date: Tue, 10 Mar 2015 14:42:58 +0200 Message-Id: <1425991390-4983-4-git-send-email-adrian.hunter@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1425991390-4983-1-git-send-email-adrian.hunter@intel.com> References: <1425991390-4983-1-git-send-email-adrian.hunter@intel.com> Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP At the start of each request, re-tune if needed and then hold off re-tuning again until the request is done. Note that though there is one function that starts requests (mmc_start_request) there are two that wait for the request to be done (mmc_wait_for_req_done and mmc_wait_for_data_req_done). Also note that mmc_wait_for_data_req_done can return even when the request is not done (which allows the block driver to prepare a newly arrived request while still waiting for the previous request). This patch ensures re-tuning is held for the duration of a request. Subsequent patches will also hold re-tuning at other times when it might cause a conflict. Signed-off-by: Adrian Hunter --- drivers/mmc/core/core.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index aaca0e1..12bddc9 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -192,6 +192,8 @@ static int mmc_start_request(struct mmc_host *host, struct mmc_request *mrq) unsigned int i, sz; struct scatterlist *sg; #endif + mmc_retune_hold(host); + if (mmc_card_removed(host->card)) return -ENOMEDIUM; @@ -427,12 +429,11 @@ static int mmc_wait_for_data_req_done(struct mmc_host *host, } } else if (context_info->is_new_req) { context_info->is_new_req = false; - if (!next_req) { - err = MMC_BLK_NEW_REQUEST; - break; /* return err */ - } + if (!next_req) + return MMC_BLK_NEW_REQUEST; } } + mmc_retune_release(host); return err; } @@ -473,6 +474,8 @@ static void mmc_wait_for_req_done(struct mmc_host *host, cmd->error = 0; host->ops->request(host, mrq); } + + mmc_retune_release(host); } /**