Эх сурвалжийг харах

mmc: core: Invoke ->card_event() callback only when needed

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>
Ulf Hansson 9 жил өмнө
parent
commit
86236813ff

+ 5 - 5
drivers/mmc/core/core.c

@@ -2567,11 +2567,6 @@ void mmc_rescan(struct work_struct *work)
 		container_of(work, struct mmc_host, detect.work);
 		container_of(work, struct mmc_host, detect.work);
 	int i;
 	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)
 	if (host->rescan_disable)
 		return;
 		return;
 
 
@@ -2580,6 +2575,11 @@ void mmc_rescan(struct work_struct *work)
 		return;
 		return;
 	host->rescan_entered = 1;
 	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);
 	mmc_bus_get(host);
 
 
 	/*
 	/*