From patchwork Fri Nov 10 10:01:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 118519 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp7722513qgn; Fri, 10 Nov 2017 02:02:05 -0800 (PST) X-Google-Smtp-Source: ABhQp+QpD0I+HAn0Nn+34WGJzq44vw2J0wNrhDaLGZaC3BXDyUgeucjGlJhJrzF2aegyt2KTPdaG X-Received: by 10.84.141.131 with SMTP id 3mr3680875plv.136.1510308125791; Fri, 10 Nov 2017 02:02:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510308125; cv=none; d=google.com; s=arc-20160816; b=C4b7jckrUWBy7V1d2jE2qxjzYgst9EsKHRNhS+5hX0L5Wnfz3B6djeSxh1h6mgBF9B uV3pSSfcKTWuMxT3a3virolX9B5gWishgQBHlhwQFwPt1zFUXyIiQ6KT5l8rgncO5C8v EITstWNhGI5TA6mnVH76uhT06rjN+RDTJkHSCUGAnXGbHzNvnSMDQlaIvuRNUBoVpQvU iwxzmY6RH2wYLoEKjtQ0ugtOX9zhDMUujeprmOK3fLLCqalqFGsnTpw5UmBlkFhcG5mS vy72vBVDUxUOyDE8n402rWanZTYYP8JhvBG+1X45Bz4ENzyHUZE+Uxvtepe5fI8eGMGc LHjA== 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=5pq/PVNz9TFEA5Xn+7UxJhgYNT5tI98Bf7wi3pwuxS0=; b=Qc7gyhgLeUQgrZsBGJ16TlQrAPib0eipry8a/iqFvwuNwb2u+rpRHsAhD1DHvtzo94 YsrBRtfsvDJ67C9OwmwHUwiXyTI3hed8ikwx06PeBoPW/ggbJvYDrRY5Lg3XTRsKe4qp CbO5hdDtmRZUkIV7MEIZTkytSB5qEhXZOXykJ1uvkJQRXFqDS8urFrgSK04VM6gVK03d ae1HQxAfXm8jfYm764XMZtvMCgF7k0B5gCEh+50MTDUam4QRtTW50CqE+r+lEJsNspmy k7BsfEfnKGumvBANHP76gaVMr0l+v8ltk2M+FgtEuypJO0TWwNNGYLQqOf+7QOQGvdF7 6zXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=V6ds9iV+; 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 z14si8801659plh.282.2017.11.10.02.02.05; Fri, 10 Nov 2017 02:02:05 -0800 (PST) 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=V6ds9iV+; 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 S1752314AbdKJKCC (ORCPT + 6 others); Fri, 10 Nov 2017 05:02:02 -0500 Received: from mail-lf0-f67.google.com ([209.85.215.67]:52334 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752241AbdKJKCA (ORCPT ); Fri, 10 Nov 2017 05:02:00 -0500 Received: by mail-lf0-f67.google.com with SMTP id b190so10439784lfg.9 for ; Fri, 10 Nov 2017 02:01:59 -0800 (PST) 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=C3XU0+pVlGYVASjcGgKG1LTrtdMJsWWafHTD3xEx+EA=; b=V6ds9iV+7H6jVQn6Zs1bFtfj4dTgnvAj48WOjOUTRBxX2u9z7Yd0h/FepknHZk8ZJB +7m3ZsChJHfHD0l8vj9AuwdNMexXiGSlfkA96X+ouLJdhg0xVaa78yH57dwrMs3gHOe3 B5AVyqPmvYIuK9BcW2AmZHH7SxLsiVh1Vw/gs= 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=C3XU0+pVlGYVASjcGgKG1LTrtdMJsWWafHTD3xEx+EA=; b=Nmx4FMQ8cjAJSn4rg+l97FKi5k/DYsLUxdOZorzkSlqw8tFifQMQX3unghg1mEB8tv 9gYIJwC5NHDPJyeSAQNpOpf19Z7atY/0FmlRu1mVwA3c5uLo78IJxVtvwQX57JTu2OEg UsXIXqYWWVW99XWZgsLfe1AF0McpBzEo6qCPEzUDACimh7gNTcOt4FWr030+WLHzAwYo q1GEZ6xmoryCObPHKNXt/t4g9TveZS90dRG6cABFGNXciwVLbmLdgrlE8Ne2FeQuHZdq u/aiyYFarxmoBOf0xsr+EYIsb7H7LCSANNrToxR7acvLqFVUNC1CiLSLdl4nzmKbiQV6 1zAQ== X-Gm-Message-State: AJaThX4YBNT2mJzlZ5pR7DG2gl08oFl9aLnYG2MT54E5sGvAfIT/5BYB SSi4LSG2TssZhR+FPMR9DLsItnXRMUM= X-Received: by 10.46.85.16 with SMTP id j16mr1538103ljb.109.1510308118337; Fri, 10 Nov 2017 02:01:58 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id n36sm310843lfi.78.2017.11.10.02.01.56 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 10 Nov 2017 02:01:57 -0800 (PST) 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] mmc: core: do away with is_done_rcv Date: Fri, 10 Nov 2017 11:01:35 +0100 Message-Id: <20171110100143.12256-5-linus.walleij@linaro.org> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171110100143.12256-1-linus.walleij@linaro.org> References: <20171110100143.12256-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 --- ChangeLog v1->v5: - Rebasing on the "next" branch in the MMC tree. --- 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 7440daa2f559..15a664d3c199 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); @@ -3015,7 +3008,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 d2ff79a16839..d43d26562fae 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; };