Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F146527169
D48849.id150500.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D48849.id150500.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D48849: sdhci: refine locking in sdhci_card_task()
Attached
Detach File
Event Timeline
Log In to Comment