From patchwork Thu Oct 26 12:57:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 117225 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp733404qgn; Thu, 26 Oct 2017 05:58:34 -0700 (PDT) X-Google-Smtp-Source: ABhQp+TCZXcPmGhflO8B/+SzncHcRjRGrVzRhu+tlE0cyNRRpAEuMrN+7E6GxDztMAuYIlFLpVIk X-Received: by 10.99.97.67 with SMTP id v64mr4899208pgb.89.1509022714685; Thu, 26 Oct 2017 05:58:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509022714; cv=none; d=google.com; s=arc-20160816; b=deDKvLudgYhkD7QkG9BycBMdjFjhYQbmNimfY0VV80m+BGdEtqCF2J1PDQgshLFNWM xvbwDGyL0Ow0ilszH+WDKmwXHusCQqgEunQe//x4PnDE2A00p9a64NqW7FLjhiSp0Uk9 h/1kEBYYoG2KjPbAU4oT9hIjXoZgzXbes10b+7SsilJ9lcFMPgdkf5CwtzI0SOPsff1+ uyewg8rEzfTBN/lfe4pANsbnglM4/Mj7TRAPahEBoUGPW+xOzcyIGjhoTvaI9/0k2xO0 HCG47aDpNul2F9tv3i06Au6iMZFnljx8HhWauE9ftDw0RgllRjqtDnxDMGr+LN5+MLYa bjfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=TK6g0PkE//fg13ylO9usmhvEYh+hDChFdJzrxKLpoac=; b=nBEP/FTG8P/ItO5uhTmwNn0z0Q8CGKvtXxkxiLf4wDJDkW0FLAQhRqW/ZCfQRGdLI3 vLQPgEBrI6gWRWaYrl/xrkpCeAczly0xw6o0NYZ/gzgzb5JQv9R6oi32lS3Xc0hPSzIl 3YASYFq0OBkSWght1d2/p45Ep+ABbhuzaY+6P6CKh4H5x9RZcQ5p5BWdZmz9t3doriAf yoeMIFG4mA31ThrqbbS+pdI0CCm9AAcum2lDlJCA6sQ05kw0MSC5OfLt+Zbqa0NtRVAZ TKHa5iMj2u6NPb4vjGQnaEntDW80KVvSjloQy62Dz+Jx0m1x80yh6Z4aWV2W8KK5vkmB V6gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=M8tFNozz; spf=pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-mmc-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i7si3348008pgc.634.2017.10.26.05.58.34; Thu, 26 Oct 2017 05:58:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=M8tFNozz; spf=pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-mmc-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932376AbdJZM6d (ORCPT + 6 others); Thu, 26 Oct 2017 08:58:33 -0400 Received: from mail-lf0-f67.google.com ([209.85.215.67]:46614 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932338AbdJZM6c (ORCPT ); Thu, 26 Oct 2017 08:58:32 -0400 Received: by mail-lf0-f67.google.com with SMTP id g70so3649222lfl.3 for ; Thu, 26 Oct 2017 05:58:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xMb91XuupIR4LhC/kfjRgIv1ARLJbnO7aEAeAP3JwZw=; b=M8tFNozz8WjNyX9JhLLgfsaV9OaHHUZqgYmgw+UD/yCXm9zd7kLdlD9KGbkBWoIDAk 3geHky1DilR3i+f5Oh3wJfqjKrLdivghewCeCNZgmkg9a++0G8x/szL+PgA/C94+IKY9 WmPX4bNyTNs4uIZUnZUjMJ1qjuf0VPJZpyyW8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=xMb91XuupIR4LhC/kfjRgIv1ARLJbnO7aEAeAP3JwZw=; b=SziHa+W/oReyv7zq1gaUCYaUVnkPtbIRMha15wB8QH3HKRsHE4tU0fqE9onRISBlLn 9yhGKEvoqkAfftwt2iHTdGcbfTcFdH7geLVTYrC9OyR8x+X6XMVw75+xJ5FEs3wxBNXR n3Rg4G5NnkldSc7lBWIVz+EvSsJ6HuZTUmQUroVtaITDjMwYfU8brktr63c6I0fHsOtF 7qJHjzIj9zl/NMHU2eTQFwVhhO/6rKhoKYhvZ7Nb7puXxblp32FTTu7hqM9ik3S51LlH LdknY+LqbsdIn2lz8iOokQiw/+6bOuPQARfusuREK7Jm+qYKtQkwOCAx56cFRAhlaKvu VO6Q== X-Gm-Message-State: AMCzsaWScC+zZRsVL15u6+MU1ZNePKFpcBTwBADRl/3pQF2M0PfYFaGW bUgLS+0fJKEhmxkHooOhA4WFllQhBn0= X-Received: by 10.25.104.21 with SMTP id d21mr5534550lfc.45.1509022710940; Thu, 26 Oct 2017 05:58:30 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id 34sm1165600lfr.25.2017.10.26.05.58.29 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 26 Oct 2017 05:58:30 -0700 (PDT) From: Linus Walleij To: linux-mmc@vger.kernel.org, Ulf Hansson Cc: linux-block@vger.kernel.org, Jens Axboe , Christoph Hellwig , Arnd Bergmann , Bartlomiej Zolnierkiewicz , Paolo Valente , Avri Altman , Adrian Hunter , Linus Walleij Subject: [PATCH 04/12 v4] mmc: core: do away with is_done_rcv Date: Thu, 26 Oct 2017 14:57:49 +0200 Message-Id: <20171026125757.10200-5-linus.walleij@linaro.org> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171026125757.10200-1-linus.walleij@linaro.org> References: <20171026125757.10200-1-linus.walleij@linaro.org> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org The "is_done_rcv" in the context info for the host is no longer needed: it is clear from context (ha!) that as long as we are waiting for the asynchronous request to come to completion, we are not done receiving data, and when the finalization work has run and completed the completion, we are indeed done. Signed-off-by: Linus Walleij --- drivers/mmc/core/core.c | 40 ++++++++++++++++------------------------ include/linux/mmc/host.h | 2 -- 2 files changed, 16 insertions(+), 26 deletions(-) -- 2.13.6 -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index f6a51608ab0b..68125360a078 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -370,10 +370,8 @@ EXPORT_SYMBOL(mmc_start_request); static void mmc_wait_data_done(struct mmc_request *mrq) { struct mmc_host *host = mrq->host; - struct mmc_context_info *context_info = &host->context_info; struct mmc_async_req *areq = mrq->areq; - context_info->is_done_rcv = true; /* Schedule a work to deal with finalizing this request */ if (!areq) pr_err("areq of the data mmc_request was NULL!\n"); @@ -656,7 +654,7 @@ EXPORT_SYMBOL(mmc_cqe_recovery); bool mmc_is_req_done(struct mmc_host *host, struct mmc_request *mrq) { if (host->areq) - return host->context_info.is_done_rcv; + return completion_done(&host->areq->complete); else return completion_done(&mrq->completion); } @@ -705,29 +703,24 @@ void mmc_finalize_areq(struct work_struct *work) struct mmc_async_req *areq = container_of(work, struct mmc_async_req, finalization_work); struct mmc_host *host = areq->host; - struct mmc_context_info *context_info = &host->context_info; enum mmc_blk_status status = MMC_BLK_SUCCESS; + struct mmc_command *cmd; - if (context_info->is_done_rcv) { - struct mmc_command *cmd; - - context_info->is_done_rcv = false; - cmd = areq->mrq->cmd; + cmd = areq->mrq->cmd; - if (!cmd->error || !cmd->retries || - mmc_card_removed(host->card)) { - status = areq->err_check(host->card, - areq); - } else { - mmc_retune_recheck(host); - pr_info("%s: req failed (CMD%u): %d, retrying...\n", - mmc_hostname(host), - cmd->opcode, cmd->error); - cmd->retries--; - cmd->error = 0; - __mmc_start_request(host, areq->mrq); - return; /* wait for done/new event again */ - } + if (!cmd->error || !cmd->retries || + mmc_card_removed(host->card)) { + status = areq->err_check(host->card, + areq); + } else { + mmc_retune_recheck(host); + pr_info("%s: req failed (CMD%u): %d, retrying...\n", + mmc_hostname(host), + cmd->opcode, cmd->error); + cmd->retries--; + cmd->error = 0; + __mmc_start_request(host, areq->mrq); + return; /* wait for done/new event again */ } mmc_retune_release(host); @@ -3005,7 +2998,6 @@ void mmc_unregister_pm_notifier(struct mmc_host *host) void mmc_init_context_info(struct mmc_host *host) { host->context_info.is_new_req = false; - host->context_info.is_done_rcv = false; host->context_info.is_waiting_last_req = false; } diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 65f23a9ea724..d536325a9640 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -241,12 +241,10 @@ struct mmc_slot { /** * mmc_context_info - synchronization details for mmc context - * @is_done_rcv wake up reason was done request * @is_new_req wake up reason was new request * @is_waiting_last_req mmc context waiting for single running request */ struct mmc_context_info { - bool is_done_rcv; bool is_new_req; bool is_waiting_last_req; };