[PATCH v2 5/5] mmc: dw-mmc: fix the present flags for card detect

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



dw_mci_get_cd() is registered to call-back function.
If call host->ops->get_cd(), host didn't set any card present flag.
Then host didn't know whether card is present or not.
This patch fixed them.

Signed-off-by: Jaehoon Chung <jh80.chung@xxxxxxxxxxx>
Singed-off-by: Kyungmin Park <kyungmin.park@xxxxxxxxxxx>
---
 drivers/mmc/host/dw_mmc.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 3642455..8a87d38 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -909,10 +909,13 @@ static int dw_mci_get_cd(struct mmc_host *mmc)
 		present = (mci_readl(slot->host, CDETECT) & (1 << slot->id))
 			== 0 ? 1 : 0;
 
-	if (present)
+	if (present) {
+		set_bit(DW_MMC_CARD_PRESENT, &slot->flags);
 		dev_dbg(&mmc->class_dev, "card is present\n");
-	else
+	} else {
+		clear_bit(DW_MMC_CARD_PRESENT, &slot->flags);
 		dev_dbg(&mmc->class_dev, "card is not present\n");
+	}
 
 	return present;
 }
-- 
1.7.4.1
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux