Page MenuHomeFreeBSD

D48849.id150500.diff
No OneTemporary

D48849.id150500.diff

diff --git a/sys/dev/sdhci/sdhci.c b/sys/dev/sdhci/sdhci.c
--- a/sys/dev/sdhci/sdhci.c
+++ b/sys/dev/sdhci/sdhci.c
@@ -715,34 +715,39 @@
SDHCI_LOCK(slot);
present = SDHCI_GET_CARD_PRESENT(slot->bus, slot);
- if (present && slot->dev == NULL) {
+ d = slot->dev;
+ SDHCI_UNLOCK(slot);
+
+ if (present && d == NULL) {
/* If card is present - attach mmc bus. */
if (bootverbose || sdhci_debug)
slot_printf(slot, "Card inserted\n");
- d = slot->dev = device_add_child(slot->bus, "mmc",
- DEVICE_UNIT_ANY);
- SDHCI_UNLOCK(slot);
- if (d) {
+ d = device_add_child(slot->bus, "mmc", DEVICE_UNIT_ANY);
+ if (d != NULL) {
device_set_ivars(d, slot);
(void)device_probe_and_attach(d);
}
- } else if (!present && slot->dev != NULL) {
- d = slot->dev;
+
+ SDHCI_LOCK(slot);
+ slot->dev = d;
+ SDHCI_UNLOCK(slot);
+ } else if (!present && d != NULL) {
/* If no card present - detach mmc bus. */
if (bootverbose || sdhci_debug)
slot_printf(slot, "Card removed\n");
+ SDHCI_LOCK(slot);
slot->dev = NULL;
slot->intmask &= ~sdhci_tuning_intmask(slot);
WR4(slot, SDHCI_INT_ENABLE, slot->intmask);
WR4(slot, SDHCI_SIGNAL_ENABLE, slot->intmask);
slot->opt &= ~SDHCI_TUNING_ENABLED;
SDHCI_UNLOCK(slot);
+
callout_drain(&slot->retune_callout);
device_delete_child(slot->bus, d);
- } else
- SDHCI_UNLOCK(slot);
+ }
}
#endif /* MMCCAM */

File Metadata

Mime Type
text/plain
Expires
Wed, Mar 4, 9:51 AM (4 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29221673
Default Alt Text
D48849.id150500.diff (1 KB)

Event Timeline