mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Tony Lindgren <tony@atomide.com>, Ulf Hansson <ulf.hansson@linaro.org>
Cc: Andreas Fenkart <afenkart@gmail.com>,
	linux-mmc <linux-mmc@vger.kernel.org>,
	lkml <linux-kernel@vger.kernel.org>,
	GTA04 owners <gta04-owner@goldelico.com>,
	NeilBrown <neil@brown.name>,
	linux-omap <linux-omap@vger.kernel.org>
Subject: [PATCH 2/4] mmc: core: allow non-blocking form of mmc_claim_host
Date: Tue, 24 Feb 2015 13:42:23 +1100	[thread overview]
Message-ID: <20150224024223.22719.95786.stgit@notabene.brown> (raw)
In-Reply-To: <20150224024023.22719.32436.stgit@notabene.brown>

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 <neil@brown.name>
---
 drivers/mmc/core/core.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 23f10f72e5f3..541c8903dc6b 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);



  parent reply	other threads:[~2015-02-24  2:43 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-24  2:42 [PATCH 0/4] Switch to 1-bit mode SDIO before disabling clocks NeilBrown
2015-02-24  2:42 ` [PATCH 1/4] mmc: core: fold mmc_set_bus_width calls into sdio_enable_4bit_bus NeilBrown
2015-03-23  9:34   ` Ulf Hansson
2015-02-24  2:42 ` NeilBrown [this message]
2015-03-23  9:58   ` [PATCH 2/4] mmc: core: allow non-blocking form of mmc_claim_host Ulf Hansson
2015-03-23 15:19     ` Ulf Hansson
2015-02-24  2:42 ` [PATCH 3/4] mmc: sdio: support switching to 1-bit before turning off clocks NeilBrown
2015-03-03 22:53   ` Tony Lindgren
2015-03-04  5:28     ` NeilBrown
2015-03-04 15:08       ` Tony Lindgren
2015-03-23  9:10   ` Ulf Hansson
2015-03-25 21:49     ` NeilBrown
2015-02-24  2:42 ` [PATCH 4/4] mmc: omap_hsmmc: switch to 1-bit before stopping clocks NeilBrown
  -- strict thread matches above, loose matches on Subject: below --
2015-01-30 19:05 [PATCH-v2 0/4] mmc: switch to 1-bit mode which " NeilBrown
2015-01-30 19:05 ` [PATCH 2/4] mmc: core: allow non-blocking form of mmc_claim_host NeilBrown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150224024223.22719.95786.stgit@notabene.brown \
    --to=neilb@suse.de \
    --cc=afenkart@gmail.com \
    --cc=gta04-owner@goldelico.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=neil@brown.name \
    --cc=tony@atomide.com \
    --cc=ulf.hansson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome