[prev in list] [next in list] [prev in thread] [next in thread] 

List:       git-commits-head
Subject:    ARM: Fix Versatile/Realview/VExpress MMC card detection sense
From:       Linux Kernel Mailing List <linux-kernel () vger ! kernel ! org>
Date:       2010-07-31 2:59:10
Message-ID: 201007310259.o6V2xAbo016485 () hera ! kernel ! org
[Download RAW message or body]

Gitweb:     http://git.kernel.org/linus/74bc80931c8bc34d24545f992a35349ad548897c
Commit:     74bc80931c8bc34d24545f992a35349ad548897c
Parent:     831e8047eb2af310184a9d4d9e749f3de119ae39
Author:     Russell King <rmk+kernel@arm.linux.org.uk>
AuthorDate: Thu Jul 29 15:58:59 2010 +0100
Committer:  Russell King <rmk+kernel@arm.linux.org.uk>
CommitDate: Fri Jul 30 23:16:32 2010 +0100

    ARM: Fix Versatile/Realview/VExpress MMC card detection sense
    
    The MMC card detection sense has become really confused with negations
    at various levels, leading to some platforms not detecting inserted
    cards.  Fix this by converting everything to positive logic throughout,
    thereby getting rid of these negations.
    
    Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
 arch/arm/mach-realview/core.c |    2 +-
 arch/arm/mach-vexpress/v2m.c  |    2 +-
 drivers/mmc/host/mmci.c       |    8 ++++++--
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c
index 595be19..02e9fde 100644
--- a/arch/arm/mach-realview/core.c
+++ b/arch/arm/mach-realview/core.c
@@ -237,7 +237,7 @@ static unsigned int realview_mmc_status(struct device *dev)
 	else
 		mask = 2;
 
-	return !(readl(REALVIEW_SYSMCI) & mask);
+	return readl(REALVIEW_SYSMCI) & mask;
 }
 
 struct mmci_platform_data realview_mmc0_plat_data = {
diff --git a/arch/arm/mach-vexpress/v2m.c b/arch/arm/mach-vexpress/v2m.c
index d250711..c842397 100644
--- a/arch/arm/mach-vexpress/v2m.c
+++ b/arch/arm/mach-vexpress/v2m.c
@@ -241,7 +241,7 @@ static struct platform_device v2m_flash_device = {
 
 static unsigned int v2m_mmci_status(struct device *dev)
 {
-	return !(readl(MMIO_P2V(V2M_SYS_MCI)) & (1 << 0));
+	return readl(MMIO_P2V(V2M_SYS_MCI)) & (1 << 0);
 }
 
 static struct mmci_platform_data v2m_mmci_data = {
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index 4917af9..2ed435b 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -539,9 +539,13 @@ static int mmci_get_cd(struct mmc_host *mmc)
 	if (host->gpio_cd == -ENOSYS)
 		status = host->plat->status(mmc_dev(host->mmc));
 	else
-		status = gpio_get_value(host->gpio_cd);
+		status = !gpio_get_value(host->gpio_cd);
 
-	return !status;
+	/*
+	 * Use positive logic throughout - status is zero for no card,
+	 * non-zero for card inserted.
+	 */
+	return status;
 }
 
 static const struct mmc_host_ops mmci_ops = {
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic