From patchwork Thu May 11 12:39:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 9721369 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0E91760387 for ; Thu, 11 May 2017 12:39:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0390E28652 for ; Thu, 11 May 2017 12:39:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ECB1E2865D; Thu, 11 May 2017 12:39:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 87D3628652 for ; Thu, 11 May 2017 12:39:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932708AbdEKMjL (ORCPT ); Thu, 11 May 2017 08:39:11 -0400 Received: from mail-wr0-f182.google.com ([209.85.128.182]:35343 "EHLO mail-wr0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932071AbdEKMjJ (ORCPT ); Thu, 11 May 2017 08:39:09 -0400 Received: by mail-wr0-f182.google.com with SMTP id z52so19513488wrc.2 for ; Thu, 11 May 2017 05:39:09 -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=6Z+X5DV4GGgVpcea4LF0/4EAHFhaXZ0ONLEJGWGi1VI=; b=JAgjfJr0n4WSVsy+IF+RpskwN2lilT/hHA2guvYK3snaFSoefEzHS60xZgsDBh2S6m 2PARDZhdOBVLIDSyzEvAikgb4axj1fcl07J1Z0WxfXTMOfGDz0gA9CyYTURP2ux2CCSl ETjmeZJQiiQJ+K94gp46CshMWMP5S54M62RHI= 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=6Z+X5DV4GGgVpcea4LF0/4EAHFhaXZ0ONLEJGWGi1VI=; b=PsTaLneSifHQk/WUnROSAkcVfeAQM6zg4FpillyAOdNgPB+X9pCTeWpqDZeaCjzrmv pE9PI0hq0N0+ZksLLoTkNPAKjN2oWJTxus7pEgkL90EibZDHo+EUEiKbQce25xgazrUK FTujbfh14F8Qk5CtCy/YdFc/F4J7scnmZefKKofMSVT9h4MWw7BkI95voVy/aaoiySAc 8pTuPUepFvsrASjCbvdqXjQICAU999DvT/RMZn1+5HAV1F3pz1ylpSTSB0CYnawz49YH hx/I2zcCiPfGwOW9d+gbtB091V84dzraq94+lcDYRQa35Azw6XHGyMMB1jZXJg18atSa XJUQ== X-Gm-Message-State: AODbwcAxdPDcugNSJAeZGLBkUZkvM4G/xBPKmxZQNu5VGUcRpolpsh00 eYFc2nYRXXlk9pJx X-Received: by 10.46.14.9 with SMTP id 9mr35545ljo.27.1494506348285; Thu, 11 May 2017 05:39:08 -0700 (PDT) Received: from localhost.localdomain (h-155-4-221-67.na.cust.bahnhof.se. [155.4.221.67]) by smtp.gmail.com with ESMTPSA id h13sm13935ljh.5.2017.05.11.05.39.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 11 May 2017 05:39:07 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson Cc: Jens Axboe , Paolo Valente , linux-block@vger.kernel.org, Linus Walleij , Mark Brown , Adrian Hunter Subject: [RFC PATCH 2/3] mmc: core: Remove redundant abort-able claim host API Date: Thu, 11 May 2017 14:39:01 +0200 Message-Id: <1494506343-28572-3-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1494506343-28572-1-git-send-email-ulf.hansson@linaro.org> References: <1494506343-28572-1-git-send-email-ulf.hansson@linaro.org> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The only user of the abort-able claim host API was the SDIO IRQ thread, but as that use has now been removed, let's simplify the code and remove the API. Signed-off-by: Ulf Hansson --- drivers/mmc/core/core.c | 31 ++++++++++--------------------- drivers/mmc/core/core.h | 13 +------------ 2 files changed, 11 insertions(+), 33 deletions(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 82c45dd..0701e30 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -1019,20 +1019,15 @@ unsigned int mmc_align_data_size(struct mmc_card *card, unsigned int sz) EXPORT_SYMBOL(mmc_align_data_size); /** - * __mmc_claim_host - exclusively claim a host + * mmc_claim_host - exclusively claim a host * @host: mmc host to claim - * @abort: whether or not the operation should be aborted * - * Claim a host for a set of operations. If @abort is non null and - * dereference a non-zero value then this will return prematurely with - * that non-zero value without acquiring the lock. Returns zero - * with the lock held otherwise. + * Claim a host for a set of operations. */ -int __mmc_claim_host(struct mmc_host *host, atomic_t *abort) +void mmc_claim_host(struct mmc_host *host) { DECLARE_WAITQUEUE(wait, current); unsigned long flags; - int stop; bool pm = false; might_sleep(); @@ -1041,31 +1036,25 @@ int __mmc_claim_host(struct mmc_host *host, atomic_t *abort) spin_lock_irqsave(&host->lock, flags); while (1) { set_current_state(TASK_UNINTERRUPTIBLE); - stop = abort ? atomic_read(abort) : 0; - if (stop || !host->claimed || host->claimer == current) + if (!host->claimed || host->claimer == current) break; spin_unlock_irqrestore(&host->lock, flags); schedule(); spin_lock_irqsave(&host->lock, flags); } set_current_state(TASK_RUNNING); - if (!stop) { - host->claimed = 1; - host->claimer = current; - host->claim_cnt += 1; - if (host->claim_cnt == 1) - pm = true; - } else - wake_up(&host->wq); + host->claimed = 1; + host->claimer = current; + host->claim_cnt += 1; + if (host->claim_cnt == 1) + pm = true; spin_unlock_irqrestore(&host->lock, flags); remove_wait_queue(&host->wq, &wait); if (pm) pm_runtime_get_sync(mmc_dev(host)); - - return stop; } -EXPORT_SYMBOL(__mmc_claim_host); +EXPORT_SYMBOL(mmc_claim_host); /** * mmc_release_host - release a host diff --git a/drivers/mmc/core/core.h b/drivers/mmc/core/core.h index 55f543f..b247b1f 100644 --- a/drivers/mmc/core/core.h +++ b/drivers/mmc/core/core.h @@ -122,20 +122,9 @@ int mmc_set_blocklen(struct mmc_card *card, unsigned int blocklen); int mmc_set_blockcount(struct mmc_card *card, unsigned int blockcount, bool is_rel_write); -int __mmc_claim_host(struct mmc_host *host, atomic_t *abort); +void mmc_claim_host(struct mmc_host *host); void mmc_release_host(struct mmc_host *host); void mmc_get_card(struct mmc_card *card); void mmc_put_card(struct mmc_card *card); -/** - * mmc_claim_host - exclusively claim a host - * @host: mmc host to claim - * - * Claim a host for a set of operations. - */ -static inline void mmc_claim_host(struct mmc_host *host) -{ - __mmc_claim_host(host, NULL); -} - #endif