Skip to content

Commit

Permalink
[MMC] Allow detection/removal to be delayed
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Richard Purdie authored and Russell King committed Sep 8, 2005
1 parent caf39e8 commit 8dc0033
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
12 changes: 8 additions & 4 deletions drivers/mmc/mmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1079,13 +1079,17 @@ static void mmc_setup(struct mmc_host *host)
/**
* mmc_detect_change - process change of state on a MMC socket
* @host: host which changed state.
* @delay: optional delay to wait before detection (jiffies)
*
* All we know is that card(s) have been inserted or removed
* from the socket(s). We don't know which socket or cards.
*/
void mmc_detect_change(struct mmc_host *host)
void mmc_detect_change(struct mmc_host *host, unsigned long delay)
{
schedule_work(&host->detect);
if (delay)
schedule_delayed_work(&host->detect, delay);
else
schedule_work(&host->detect);
}

EXPORT_SYMBOL(mmc_detect_change);
Expand Down Expand Up @@ -1189,7 +1193,7 @@ int mmc_add_host(struct mmc_host *host)
ret = mmc_add_host_sysfs(host);
if (ret == 0) {
mmc_power_off(host);
mmc_detect_change(host);
mmc_detect_change(host, 0);
}

return ret;
Expand Down Expand Up @@ -1259,7 +1263,7 @@ EXPORT_SYMBOL(mmc_suspend_host);
*/
int mmc_resume_host(struct mmc_host *host)
{
mmc_detect_change(host);
mmc_detect_change(host, 0);

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/mmc/mmci.c
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ static void mmci_check_status(unsigned long data)

status = host->plat->status(mmc_dev(host->mmc));
if (status ^ host->oldstat)
mmc_detect_change(host->mmc);
mmc_detect_change(host->mmc, 0);

host->oldstat = status;
mod_timer(&host->timer, jiffies + HZ);
Expand Down
2 changes: 1 addition & 1 deletion drivers/mmc/pxamci.c
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ static void pxamci_dma_irq(int dma, void *devid, struct pt_regs *regs)

static irqreturn_t pxamci_detect_irq(int irq, void *devid, struct pt_regs *regs)
{
mmc_detect_change(devid);
mmc_detect_change(devid, 0);
return IRQ_HANDLED;
}

Expand Down
4 changes: 2 additions & 2 deletions drivers/mmc/wbsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1122,7 +1122,7 @@ static void wbsd_detect_card(unsigned long data)

DBG("Executing card detection\n");

mmc_detect_change(host->mmc);
mmc_detect_change(host->mmc, 0);
}

/*
Expand Down Expand Up @@ -1198,7 +1198,7 @@ static void wbsd_tasklet_card(unsigned long param)
*/
spin_unlock(&host->lock);

mmc_detect_change(host->mmc);
mmc_detect_change(host->mmc, 0);
}
else
spin_unlock(&host->lock);
Expand Down
2 changes: 1 addition & 1 deletion include/linux/mmc/host.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ extern void mmc_free_host(struct mmc_host *);
extern int mmc_suspend_host(struct mmc_host *, pm_message_t);
extern int mmc_resume_host(struct mmc_host *);

extern void mmc_detect_change(struct mmc_host *);
extern void mmc_detect_change(struct mmc_host *, unsigned long delay);
extern void mmc_request_done(struct mmc_host *, struct mmc_request *);

#endif
Expand Down

0 comments on commit 8dc0033

Please sign in to comment.