From patchwork Thu Feb 9 15:33:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 93723 Delivered-To: patch@linaro.org Received: by 10.182.3.34 with SMTP id 2csp81272obz; Thu, 9 Feb 2017 07:36:26 -0800 (PST) X-Received: by 10.99.112.6 with SMTP id l6mr4647850pgc.33.1486654586096; Thu, 09 Feb 2017 07:36:26 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p1si10315679pga.393.2017.02.09.07.36.25; Thu, 09 Feb 2017 07:36:26 -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; 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 S1752464AbdBIPgO (ORCPT + 5 others); Thu, 9 Feb 2017 10:36:14 -0500 Received: from mail-lf0-f46.google.com ([209.85.215.46]:36831 "EHLO mail-lf0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752957AbdBIPgI (ORCPT ); Thu, 9 Feb 2017 10:36:08 -0500 Received: by mail-lf0-f46.google.com with SMTP id z134so4498453lff.3 for ; Thu, 09 Feb 2017 07:35:08 -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=JxkPNTaKmWf0vTJfB44NRFuomWpqWZy0ZnKSU/LpDxk=; b=C1NLPCYKr5Ui0fuIF4jYHAfn/jr1I5dg0qxZ+Qv6u8rTmYJCkHIZfcu/85C+siApPF xGs1hMJTB6JxNuSdDRRAiLBng/iwxwJfubadH1jS/BTS30RLFYCmno9dXLiU/494UR/u GAw+Rv+yANOmg8S+n3WEXdbJDNRfx79c2JJrY= 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=JxkPNTaKmWf0vTJfB44NRFuomWpqWZy0ZnKSU/LpDxk=; b=mwyVZaiR4MMZGaoot3q2Ct++BZL372xkK7YYZ804eEEpw1HF0PSB58ggGJ9tFfTZbW 0+nRdzu2m8oBV7PHxd/dvoHSmdLpeJIjAa+jhH+BNLF11S+E3Mmnd9vuedkDKJC/UDNT 0hSDH6i360IeEYAcW+1YoAkkzo6wc1wlsWxJSvSSkaOeaMRpTAykU6p0XbBlPm57QBOg 749/4aYw82hHQ5y73YYg1/F97UTmthEeIt2lBARYWv3ykrvRBe0FJV4KdnNVXYyKy975 1kRN02cevC5uXm80EBn7hoToyt+UPqbD4lG99MTr8ZTLo3lSEtgNcaoDppumdBJAZwU/ JUwA== X-Gm-Message-State: AMke39me6K1pExxRSqhgpU2ICqOGCzUFXJ2x6ViN6NDQZ+dxrJPIc3ffgWpoltsjoyvlKqEl X-Received: by 10.46.84.78 with SMTP id y14mr1406719ljd.63.1486654502656; Thu, 09 Feb 2017 07:35:02 -0800 (PST) Received: from gnarp.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id e86sm3670614lji.32.2017.02.09.07.35.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Feb 2017 07:35:01 -0800 (PST) From: Linus Walleij To: linux-mmc@vger.kernel.org, Ulf Hansson , Adrian Hunter , Paolo Valente Cc: Chunyan Zhang , Baolin Wang , linux-block@vger.kernel.org, Jens Axboe , Christoph Hellwig , Arnd Bergmann , Linus Walleij Subject: [PATCH 07/16] mmc: core: do away with is_done_rcv Date: Thu, 9 Feb 2017 16:33:54 +0100 Message-Id: <20170209153403.9730-8-linus.walleij@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170209153403.9730-1-linus.walleij@linaro.org> References: <20170209153403.9730-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.9.3 -- 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 Reviewed-by: Bartlomiej Zolnierkiewicz diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 8ecf61e51662..fcb40ade9b82 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -416,10 +416,8 @@ EXPORT_SYMBOL(mmc_start_bkops); 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 = host->areq; - context_info->is_done_rcv = true; /* Schedule a work to deal with finalizing this request */ kthread_queue_work(&host->req_done_worker, &areq->finalization_work); } @@ -551,7 +549,7 @@ EXPORT_SYMBOL(mmc_wait_for_req_done); 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); } @@ -600,29 +598,24 @@ void mmc_finalize_areq(struct kthread_work *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); @@ -2993,7 +2986,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 c5f61f2f2310..cbb40682024a 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -194,12 +194,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; };