* [PATCH 1/2] mmc: core: Invoke ->card_event() callback only when needed
@ 2015-11-05 15:08 Ulf Hansson
2015-11-05 15:08 ` [PATCH 2/2] mmc: core: Keep host claimed in mmc_rescan() while calling host ops Ulf Hansson
0 siblings, 1 reply; 2+ messages in thread
From: Ulf Hansson @ 2015-11-05 15:08 UTC (permalink / raw)
To: linux-mmc, Ulf Hansson
The ->card_event() callback may be called when re-scan is disabled and for
non-removable cards, which both cases are unnecessary.
Instead let's move the call later in mmc_rescan() where these constraints
have been validated.
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
drivers/mmc/core/core.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 5ae89e4..c1027a4 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -2567,11 +2567,6 @@ void mmc_rescan(struct work_struct *work)
container_of(work, struct mmc_host, detect.work);
int i;
- if (host->trigger_card_event && host->ops->card_event) {
- host->ops->card_event(host);
- host->trigger_card_event = false;
- }
-
if (host->rescan_disable)
return;
@@ -2580,6 +2575,11 @@ void mmc_rescan(struct work_struct *work)
return;
host->rescan_entered = 1;
+ if (host->trigger_card_event && host->ops->card_event) {
+ host->ops->card_event(host);
+ host->trigger_card_event = false;
+ }
+
mmc_bus_get(host);
/*
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH 2/2] mmc: core: Keep host claimed in mmc_rescan() while calling host ops
2015-11-05 15:08 [PATCH 1/2] mmc: core: Invoke ->card_event() callback only when needed Ulf Hansson
@ 2015-11-05 15:08 ` Ulf Hansson
0 siblings, 0 replies; 2+ messages in thread
From: Ulf Hansson @ 2015-11-05 15:08 UTC (permalink / raw)
To: linux-mmc, Ulf Hansson
As mmc_claim_host() invokes pm_runtime_get_sync() for the mmc host device,
it's important that the host is kept claimed for *all* accesses to it via
the host_ops callbacks.
In mmc_rescan(), the ->card_event() and the ->get_cd() callback are being
invoked without claiming the host, let's fix this.
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
drivers/mmc/core/core.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index c1027a4..394963d 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -2576,7 +2576,9 @@ void mmc_rescan(struct work_struct *work)
host->rescan_entered = 1;
if (host->trigger_card_event && host->ops->card_event) {
+ mmc_claim_host(host);
host->ops->card_event(host);
+ mmc_release_host(host);
host->trigger_card_event = false;
}
@@ -2611,15 +2613,14 @@ void mmc_rescan(struct work_struct *work)
*/
mmc_bus_put(host);
+ mmc_claim_host(host);
if (!(host->caps & MMC_CAP_NONREMOVABLE) && host->ops->get_cd &&
host->ops->get_cd(host) == 0) {
- mmc_claim_host(host);
mmc_power_off(host);
mmc_release_host(host);
goto out;
}
- mmc_claim_host(host);
for (i = 0; i < ARRAY_SIZE(freqs); i++) {
if (!mmc_rescan_try_freq(host, max(freqs[i], host->f_min)))
break;
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-11-05 15:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-05 15:08 [PATCH 1/2] mmc: core: Invoke ->card_event() callback only when needed Ulf Hansson
2015-11-05 15:08 ` [PATCH 2/2] mmc: core: Keep host claimed in mmc_rescan() while calling host ops Ulf Hansson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).