|
@@ -1538,13 +1538,10 @@ static int dw_mci_get_cd(struct mmc_host *mmc)
|
|
|
== 0 ? 1 : 0;
|
|
|
|
|
|
spin_lock_bh(&host->lock);
|
|
|
- if (present) {
|
|
|
- set_bit(DW_MMC_CARD_PRESENT, &slot->flags);
|
|
|
+ if (present && !test_and_set_bit(DW_MMC_CARD_PRESENT, &slot->flags))
|
|
|
dev_dbg(&mmc->class_dev, "card is present\n");
|
|
|
- } else {
|
|
|
- clear_bit(DW_MMC_CARD_PRESENT, &slot->flags);
|
|
|
+ else if (!test_and_clear_bit(DW_MMC_CARD_PRESENT, &slot->flags))
|
|
|
dev_dbg(&mmc->class_dev, "card is not present\n");
|
|
|
- }
|
|
|
spin_unlock_bh(&host->lock);
|
|
|
|
|
|
return present;
|