From patchwork Thu Feb 9 15:33:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 93719 Delivered-To: patch@linaro.org Received: by 10.182.3.34 with SMTP id 2csp81245obz; Thu, 9 Feb 2017 07:36:23 -0800 (PST) X-Received: by 10.98.211.8 with SMTP id q8mr4356619pfg.164.1486654583234; Thu, 09 Feb 2017 07:36:23 -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.23; Thu, 09 Feb 2017 07:36:23 -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 S1753929AbdBIPgK (ORCPT + 5 others); Thu, 9 Feb 2017 10:36:10 -0500 Received: from mail-lf0-f52.google.com ([209.85.215.52]:33873 "EHLO mail-lf0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752162AbdBIPgI (ORCPT ); Thu, 9 Feb 2017 10:36:08 -0500 Received: by mail-lf0-f52.google.com with SMTP id v186so4542444lfa.1 for ; Thu, 09 Feb 2017 07:34:57 -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=Mu/ARdi/IpU+hzF3TBvWTiggjuulaAkuB4VzBddZvoE=; b=NE0SCJI7mbFCa+DVwLZOy1KzL80Ih5bmRJQELqkycdP20FWaY9bcZBTE45CoCseEOd TFuK90ijwn6A8tV6RaK6YXFbBIJIMxPy2FdegGDQIrxQMiIXc4sjMOnlLFseB5u5Ya4I pwrQ3F3C+E7TP4AAsVFh4VYeuILxONx73C5VA= 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=Mu/ARdi/IpU+hzF3TBvWTiggjuulaAkuB4VzBddZvoE=; b=loGj+xK+mNQ76YGxmQC15Bb9biNSS7Vj+gWhyiry8nmRNKm9kyChsKJQ6T7S0iBhvq oXRZvjSUawKfADp1A9ifLs0P/hRg9CasPVTMr2Dc6ZeDBuaeNcAt89hXW87XZPklZH2D Wmdl1yEXCEvQcNt334jjOttG2oaUH7ror76/CLColRjfkOTPIQFxxKNDAawpn8EF6XXU cldoMKRgVa6hUmynCoTJMqSKhJN6Oh23vCF61tCMLwspGLk0jOg8p3z3iNhfrTfa1zbs HaN2qBgA7lIsAv6o8vuyO7FxlnDl9S/2UgU+ryl/2v6jAWoLCLFllZziNkjPrp1Y3UQ8 QavA== X-Gm-Message-State: AMke39lFd1rk1NQwAMcRUZFtNSnJeL2pcUm23JO9snfCmfn9o7Jm0JxD1RxbCjJkb/BFLp9j X-Received: by 10.25.65.15 with SMTP id o15mr1182943lfa.14.1486654492060; Thu, 09 Feb 2017 07:34:52 -0800 (PST) Received: from gnarp.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id e86sm3670614lji.32.2017.02.09.07.34.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Feb 2017 07:34:50 -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 05/16] mmc: core: add a kthread for completing requests Date: Thu, 9 Feb 2017 16:33:52 +0100 Message-Id: <20170209153403.9730-6-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 As we want to complete requests autonomously from feeding the host with new requests, we create a worker thread to deal with this specifically in response to the callback from a host driver. This patch just adds the worker, later patches will make use of it. Signed-off-by: Linus Walleij --- drivers/mmc/core/core.c | 6 ++++++ drivers/mmc/core/host.c | 2 +- include/linux/mmc/host.h | 5 +++++ 3 files changed, 12 insertions(+), 1 deletion(-) -- 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 0972c649ea7a..663799240635 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -2794,6 +2794,10 @@ void mmc_start_host(struct mmc_host *host) host->f_init = max(freqs[0], host->f_min); host->rescan_disable = 0; host->ios.power_mode = MMC_POWER_UNDEFINED; + /* Worker for completing requests */ + host->req_done_worker_task = kthread_run(kthread_worker_fn, + &host->req_done_worker, + "mmc%d-reqdone", host->index); if (!(host->caps2 & MMC_CAP2_NO_PRESCAN_POWERUP)) { mmc_claim_host(host); @@ -2818,6 +2822,8 @@ void mmc_stop_host(struct mmc_host *host) host->rescan_disable = 1; cancel_delayed_work_sync(&host->detect); + kthread_flush_worker(&host->req_done_worker); + kthread_stop(host->req_done_worker_task); /* clear pm flags now and let card drivers set them as needed */ host->pm_flags = 0; diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c index 98f25ffb4258..d33e2b260bf3 100644 --- a/drivers/mmc/core/host.c +++ b/drivers/mmc/core/host.c @@ -388,7 +388,7 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev) init_waitqueue_head(&host->wq); INIT_DELAYED_WORK(&host->detect, mmc_rescan); setup_timer(&host->retune_timer, mmc_retune_timer, (unsigned long)host); - + kthread_init_worker(&host->req_done_worker); /* * By default, hosts do not support SGIO or large requests. * They have to set these according to their abilities. diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 97699d55b2ae..b04f8cd51c82 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -13,6 +13,7 @@ #include #include #include +#include #include #include @@ -375,6 +376,10 @@ struct mmc_host { struct mmc_async_req *areq; /* active async req */ struct mmc_context_info context_info; /* async synchronization info */ + /* finalization work thread, handles finalizing requests */ + struct kthread_worker req_done_worker; + struct task_struct *req_done_worker_task; + /* Ongoing data transfer that allows commands during transfer */ struct mmc_request *ongoing_mrq;