From patchwork Wed Jan 15 08:31:07 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 3490771 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D4E2E9F3EA for ; Wed, 15 Jan 2014 08:35:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D9FD1201D3 for ; Wed, 15 Jan 2014 08:35:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C77D320165 for ; Wed, 15 Jan 2014 08:35:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751132AbaAOIfg (ORCPT ); Wed, 15 Jan 2014 03:35:36 -0500 Received: from mail-pd0-f169.google.com ([209.85.192.169]:53882 "EHLO mail-pd0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751253AbaAOIfg (ORCPT ); Wed, 15 Jan 2014 03:35:36 -0500 Received: by mail-pd0-f169.google.com with SMTP id v10so834106pde.0 for ; Wed, 15 Jan 2014 00:35:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=kpFVUoI4KjFgillTUhPXxTOap5/t8Vd40mj7oiobnag=; b=JjXQza/ZvLH6F4bXeGvexpA7J/bJ/+bW0pJAcTZ12u7jABqxD0YSukfjZ122Ye5B8O DPoGuKpELqp/TAM7tgciUyS6AsF/usjFdPnhnMQtFU08zi7dgnu+mazyAJZVmHPjLRfq Vu6MIG7oKqT6oT8Ii64I9+D3NXIF1IRLkGOWD0UCV32FSwnwgVyd8rqRYrFb89LwAoxN YIxe+Hd+9Poi6AU2FmUcjG76V9cWnG1dd3CSbQnWyvRZWe57XM1FwLmPXy551+RQQB7t mPF59bsa+M1IPGR9U+TE1kOTPAvZ+y5MExGOl86ir8SbeM5x0Mpy9sAMu6KgFQPbeEK7 jgIw== X-Gm-Message-State: ALoCoQkkL1330se2RtGadBFm3dT1/wy789hRxLymZ3Cj2qIKnrNagFvu96xejZ98BTw828sgp4ID X-Received: by 10.68.162.66 with SMTP id xy2mr1228300pbb.46.1389774935548; Wed, 15 Jan 2014 00:35:35 -0800 (PST) Received: from linaro.sisodomain.com ([115.113.119.130]) by mx.google.com with ESMTPSA id ns7sm6411218pbc.32.2014.01.15.00.35.31 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 15 Jan 2014 00:35:35 -0800 (PST) From: Sachin Kamat To: linux-mmc@vger.kernel.org Cc: linux-samsung-soc@vger.kernel.org, chris@printf.net, tgih.jun@samsung.com, sachin.kamat@linaro.org, patches@linaro.org, Zhangfei Gao , Jaehoon Chung , Arnd Bergmann Subject: [PATCH 1/1] mmc: dw_mmc: Fix card detection regression Date: Wed, 15 Jan 2014 14:01:07 +0530 Message-Id: <1389774667-18309-1-git-send-email-sachin.kamat@linaro.org> X-Mailer: git-send-email 1.7.9.5 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP mmc_gpio_get_cd returns a negative error value upon failure. However gpio_cd was initialised with the negated return value of the above function. This negation resulted in losing of the error value thereby triggering the code to take a wrong path as IS_ERR_VALUE(gpio_cd) now returned 0 even when mmc_gpio_get_cd returned an error value. This issue introduced by commit bf626e5550f2 ("mmc: dw_mmc: use slot-gpio to handle cd pin") caused card detection failure on Exynos5 boards which is now fixed by this patch. Signed-off-by: Sachin Kamat Cc: Zhangfei Gao Cc: Jaehoon Chung Cc: Arnd Bergmann Reviewed-by: Sachin Kamat Tested-by: Sachin Kamat --- drivers/mmc/host/dw_mmc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index a776f24f4311..f1683ba194ee 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -1033,7 +1033,7 @@ static int dw_mci_get_cd(struct mmc_host *mmc) int present; struct dw_mci_slot *slot = mmc_priv(mmc); struct dw_mci_board *brd = slot->host->pdata; - int gpio_cd = !mmc_gpio_get_cd(mmc); + int gpio_cd = mmc_gpio_get_cd(mmc); /* Use platform get_cd function, else try onboard card detect */ if (brd->quirks & DW_MCI_QUIRK_BROKEN_CARD_DETECTION) @@ -1041,7 +1041,7 @@ static int dw_mci_get_cd(struct mmc_host *mmc) else if (brd->get_cd) present = !brd->get_cd(slot->id); else if (!IS_ERR_VALUE(gpio_cd)) - present = !!gpio_cd; + present = !gpio_cd; else present = (mci_readl(slot->host, CDETECT) & (1 << slot->id)) == 0 ? 1 : 0;