From patchwork Fri Jan 30 19:05:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: NeilBrown X-Patchwork-Id: 5753211 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7FA4F9F358 for ; Fri, 30 Jan 2015 22:32:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BC14620225 for ; Fri, 30 Jan 2015 22:32:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D929520219 for ; Fri, 30 Jan 2015 22:32:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751384AbbA3WcH (ORCPT ); Fri, 30 Jan 2015 17:32:07 -0500 Received: from cantor2.suse.de ([195.135.220.15]:38709 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753936AbbA3WcF (ORCPT ); Fri, 30 Jan 2015 17:32:05 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 192BAAC20; Fri, 30 Jan 2015 22:32:04 +0000 (UTC) From: NeilBrown To: Tony Lindgren , Ulf Hansson Date: Sat, 31 Jan 2015 06:05:37 +1100 Subject: [PATCH 2/4] mmc: core: allow non-blocking form of mmc_claim_host Cc: Andreas Fenkart , linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, GTA04 owners , NeilBrown , linux-omap@vger.kernel.org Message-ID: <20150130190537.20910.46413.stgit@notabene.brown> In-Reply-To: <20150130185742.20910.52715.stgit@notabene.brown> References: <20150130185742.20910.52715.stgit@notabene.brown> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00, DATE_IN_PAST_03_06, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Change the handling for the 'abort' flag so that if it is set, but we can claim the host, then do the claim, rather than aborting. When the abort is async this just means that a race between aborting an allowing a claim is resolved slightly differently. Any code must already be able to handle 'abort' being set just as the host is claimed. This allows extra functionality. If __mmc_claim_host() is called with an 'abort' pointer which is initialized to '1', it will effect a non-blocking 'claim'. Signed-off-by: NeilBrown --- drivers/mmc/core/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 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 e9eb721e3664..051198073d21 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -912,10 +912,11 @@ int __mmc_claim_host(struct mmc_host *host, atomic_t *abort) spin_lock_irqsave(&host->lock, flags); } set_current_state(TASK_RUNNING); - if (!stop) { + if (!host->claimed || host->claimer == current) { host->claimed = 1; host->claimer = current; host->claim_cnt += 1; + stop = 0; } else wake_up(&host->wq); spin_unlock_irqrestore(&host->lock, flags);