Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 297331
b: refs/heads/master
c: f0cc9cf
h: refs/heads/master
i:
  297329: 76c22c9
  297327: 804be50
v: v3
  • Loading branch information
Ulf Hansson authored and Chris Ball committed Mar 27, 2012
1 parent bbf3ce4 commit c9aa001
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 885c3e800cf99db3391247776bfa2d262b21a72b
refs/heads/master: f0cc9cf99326926fd76f77645c48d16d647802eb
24 changes: 21 additions & 3 deletions trunk/drivers/mmc/core/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2121,18 +2121,36 @@ int _mmc_detect_card_removed(struct mmc_host *host)
int mmc_detect_card_removed(struct mmc_host *host)
{
struct mmc_card *card = host->card;
int ret;

WARN_ON(!host->claimed);

if (!card)
return 1;

ret = mmc_card_removed(card);
/*
* The card will be considered unchanged unless we have been asked to
* detect a change or host requires polling to provide card detection.
*/
if (card && !host->detect_change && !(host->caps & MMC_CAP_NEEDS_POLL))
return mmc_card_removed(card);
if (!host->detect_change && !(host->caps & MMC_CAP_NEEDS_POLL) &&
!(host->caps2 & MMC_CAP2_DETECT_ON_ERR))
return ret;

host->detect_change = 0;
if (!ret) {
ret = _mmc_detect_card_removed(host);
if (ret && (host->caps2 & MMC_CAP2_DETECT_ON_ERR)) {
/*
* Schedule a detect work as soon as possible to let a
* rescan handle the card removal.
*/
cancel_delayed_work(&host->detect);
mmc_detect_change(host, 0);
}
}

return _mmc_detect_card_removed(host);
return ret;
}
EXPORT_SYMBOL(mmc_detect_card_removed);

Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/mmc/host.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ struct mmc_host {
#define MMC_CAP2_HS200 (MMC_CAP2_HS200_1_8V_SDR | \
MMC_CAP2_HS200_1_2V_SDR)
#define MMC_CAP2_BROKEN_VOLTAGE (1 << 7) /* Use the broken voltage */
#define MMC_CAP2_DETECT_ON_ERR (1 << 8) /* On I/O err check card removal */

mmc_pm_flag_t pm_caps; /* supported pm features */
unsigned int power_notify_type;
Expand Down

0 comments on commit c9aa001

Please sign in to comment.