diff options
author | Richard Purdie <rpurdie@rpsys.net> | 2005-09-08 12:53:01 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2005-09-08 12:53:01 -0400 |
commit | 8dc003359cc3996abad9e53a7b2280b272610283 (patch) | |
tree | 7fc17315c0d948cd106b89d250355bf59978ae39 | |
parent | caf39e87cc1182f7dae84eefc43ca14d54c78ef9 (diff) |
[MMC] Allow detection/removal to be delayed
Change mmc_detect_change() to take a delay argument such that
the detection of card insertions and removals can be delayed
according to the requirements of the host driver or platform.
Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r-- | drivers/mmc/mmc.c | 12 | ||||
-rw-r--r-- | drivers/mmc/mmci.c | 2 | ||||
-rw-r--r-- | drivers/mmc/pxamci.c | 2 | ||||
-rw-r--r-- | drivers/mmc/wbsd.c | 4 | ||||
-rw-r--r-- | include/linux/mmc/host.h | 2 |
5 files changed, 13 insertions, 9 deletions
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 0a117c61cd18..ceae379a4d4c 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c | |||
@@ -1079,13 +1079,17 @@ static void mmc_setup(struct mmc_host *host) | |||
1079 | /** | 1079 | /** |
1080 | * mmc_detect_change - process change of state on a MMC socket | 1080 | * mmc_detect_change - process change of state on a MMC socket |
1081 | * @host: host which changed state. | 1081 | * @host: host which changed state. |
1082 | * @delay: optional delay to wait before detection (jiffies) | ||
1082 | * | 1083 | * |
1083 | * All we know is that card(s) have been inserted or removed | 1084 | * All we know is that card(s) have been inserted or removed |
1084 | * from the socket(s). We don't know which socket or cards. | 1085 | * from the socket(s). We don't know which socket or cards. |
1085 | */ | 1086 | */ |
1086 | void mmc_detect_change(struct mmc_host *host) | 1087 | void mmc_detect_change(struct mmc_host *host, unsigned long delay) |
1087 | { | 1088 | { |
1088 | schedule_work(&host->detect); | 1089 | if (delay) |
1090 | schedule_delayed_work(&host->detect, delay); | ||
1091 | else | ||
1092 | schedule_work(&host->detect); | ||
1089 | } | 1093 | } |
1090 | 1094 | ||
1091 | EXPORT_SYMBOL(mmc_detect_change); | 1095 | EXPORT_SYMBOL(mmc_detect_change); |
@@ -1189,7 +1193,7 @@ int mmc_add_host(struct mmc_host *host) | |||
1189 | ret = mmc_add_host_sysfs(host); | 1193 | ret = mmc_add_host_sysfs(host); |
1190 | if (ret == 0) { | 1194 | if (ret == 0) { |
1191 | mmc_power_off(host); | 1195 | mmc_power_off(host); |
1192 | mmc_detect_change(host); | 1196 | mmc_detect_change(host, 0); |
1193 | } | 1197 | } |
1194 | 1198 | ||
1195 | return ret; | 1199 | return ret; |
@@ -1259,7 +1263,7 @@ EXPORT_SYMBOL(mmc_suspend_host); | |||
1259 | */ | 1263 | */ |
1260 | int mmc_resume_host(struct mmc_host *host) | 1264 | int mmc_resume_host(struct mmc_host *host) |
1261 | { | 1265 | { |
1262 | mmc_detect_change(host); | 1266 | mmc_detect_change(host, 0); |
1263 | 1267 | ||
1264 | return 0; | 1268 | return 0; |
1265 | } | 1269 | } |
diff --git a/drivers/mmc/mmci.c b/drivers/mmc/mmci.c index 716c4ef4faf6..91c74843dc0d 100644 --- a/drivers/mmc/mmci.c +++ b/drivers/mmc/mmci.c | |||
@@ -442,7 +442,7 @@ static void mmci_check_status(unsigned long data) | |||
442 | 442 | ||
443 | status = host->plat->status(mmc_dev(host->mmc)); | 443 | status = host->plat->status(mmc_dev(host->mmc)); |
444 | if (status ^ host->oldstat) | 444 | if (status ^ host->oldstat) |
445 | mmc_detect_change(host->mmc); | 445 | mmc_detect_change(host->mmc, 0); |
446 | 446 | ||
447 | host->oldstat = status; | 447 | host->oldstat = status; |
448 | mod_timer(&host->timer, jiffies + HZ); | 448 | mod_timer(&host->timer, jiffies + HZ); |
diff --git a/drivers/mmc/pxamci.c b/drivers/mmc/pxamci.c index e99a53b09e32..5223cd3bfc1e 100644 --- a/drivers/mmc/pxamci.c +++ b/drivers/mmc/pxamci.c | |||
@@ -423,7 +423,7 @@ static void pxamci_dma_irq(int dma, void *devid, struct pt_regs *regs) | |||
423 | 423 | ||
424 | static irqreturn_t pxamci_detect_irq(int irq, void *devid, struct pt_regs *regs) | 424 | static irqreturn_t pxamci_detect_irq(int irq, void *devid, struct pt_regs *regs) |
425 | { | 425 | { |
426 | mmc_detect_change(devid); | 426 | mmc_detect_change(devid, 0); |
427 | return IRQ_HANDLED; | 427 | return IRQ_HANDLED; |
428 | } | 428 | } |
429 | 429 | ||
diff --git a/drivers/mmc/wbsd.c b/drivers/mmc/wbsd.c index dec01d38c782..a62c86fef5cc 100644 --- a/drivers/mmc/wbsd.c +++ b/drivers/mmc/wbsd.c | |||
@@ -1122,7 +1122,7 @@ static void wbsd_detect_card(unsigned long data) | |||
1122 | 1122 | ||
1123 | DBG("Executing card detection\n"); | 1123 | DBG("Executing card detection\n"); |
1124 | 1124 | ||
1125 | mmc_detect_change(host->mmc); | 1125 | mmc_detect_change(host->mmc, 0); |
1126 | } | 1126 | } |
1127 | 1127 | ||
1128 | /* | 1128 | /* |
@@ -1198,7 +1198,7 @@ static void wbsd_tasklet_card(unsigned long param) | |||
1198 | */ | 1198 | */ |
1199 | spin_unlock(&host->lock); | 1199 | spin_unlock(&host->lock); |
1200 | 1200 | ||
1201 | mmc_detect_change(host->mmc); | 1201 | mmc_detect_change(host->mmc, 0); |
1202 | } | 1202 | } |
1203 | else | 1203 | else |
1204 | spin_unlock(&host->lock); | 1204 | spin_unlock(&host->lock); |
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 6014160d9c06..c5d73c0cf6bb 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h | |||
@@ -123,7 +123,7 @@ extern void mmc_free_host(struct mmc_host *); | |||
123 | extern int mmc_suspend_host(struct mmc_host *, pm_message_t); | 123 | extern int mmc_suspend_host(struct mmc_host *, pm_message_t); |
124 | extern int mmc_resume_host(struct mmc_host *); | 124 | extern int mmc_resume_host(struct mmc_host *); |
125 | 125 | ||
126 | extern void mmc_detect_change(struct mmc_host *); | 126 | extern void mmc_detect_change(struct mmc_host *, unsigned long delay); |
127 | extern void mmc_request_done(struct mmc_host *, struct mmc_request *); | 127 | extern void mmc_request_done(struct mmc_host *, struct mmc_request *); |
128 | 128 | ||
129 | #endif | 129 | #endif |