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: 23223 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f198.google.com (mail-ve0-f198.google.com [209.85.128.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E3789206A0 for ; Wed, 15 Jan 2014 08:35:37 +0000 (UTC) Received: by mail-ve0-f198.google.com with SMTP id c14sf1283629vea.1 for ; Wed, 15 Jan 2014 00:35:36 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=kpFVUoI4KjFgillTUhPXxTOap5/t8Vd40mj7oiobnag=; b=U0I9jUmCeyX6aGQbtLKfYKWbWkPx0xSozrYXEjpQl20Uv567xilFUNVTpCTruE7TkM EgmhA2uhs7l+8otIMoXPpRu68EB7IxeaI/tlKDOKtxzQJGFNb0i+1NAtDS2OvqtyPEBq E1nWjgbzBv+9wKTYAktxlz9w6apP3zFDrh9VivmVlmsxApYl0V/B9VAMpyouIJqow0dt b/IQhDZsoRn+zVOrL3vGrqvZH5n/XvfBwWSKgDsNbBU5VXDjGUR71M0FMo+Kt1cwUT7M UmxzOpWmjoBKQr1HmSGzpCLverdIUgVTQLbrIo1k+PWHUd9QdHeOTsf8lyTE93115BQo ZOMg== X-Gm-Message-State: ALoCoQkZapCMni7BPQrWgWDq4hzcoYx5fyDB4aJRWPRFbHlDSuJ1d3QZGrKaKw4tmcjz2uLjxr02 X-Received: by 10.236.127.199 with SMTP id d47mr232764yhi.29.1389774936909; Wed, 15 Jan 2014 00:35:36 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.127.200 with SMTP id ni8ls45295qeb.22.gmail; Wed, 15 Jan 2014 00:35:36 -0800 (PST) X-Received: by 10.58.201.169 with SMTP id kb9mr400922vec.42.1389774936846; Wed, 15 Jan 2014 00:35:36 -0800 (PST) Received: from mail-vc0-f173.google.com (mail-vc0-f173.google.com [209.85.220.173]) by mx.google.com with ESMTPS id sg4si1329781vdc.131.2014.01.15.00.35.36 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 15 Jan 2014 00:35:36 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.173 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.173; Received: by mail-vc0-f173.google.com with SMTP id ld13so286533vcb.32 for ; Wed, 15 Jan 2014 00:35:36 -0800 (PST) X-Received: by 10.52.244.49 with SMTP id xd17mr569323vdc.26.1389774936786; Wed, 15 Jan 2014 00:35:36 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.59.13.131 with SMTP id ey3csp257651ved; Wed, 15 Jan 2014 00:35:36 -0800 (PST) X-Received: by 10.68.254.230 with SMTP id al6mr1140214pbd.3.1389774935958; Wed, 15 Jan 2014 00:35:35 -0800 (PST) Received: from mail-pb0-f45.google.com (mail-pb0-f45.google.com [209.85.160.45]) by mx.google.com with ESMTPS id eb3si3014431pbc.146.2014.01.15.00.35.35 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 15 Jan 2014 00:35:35 -0800 (PST) Received-SPF: neutral (google.com: 209.85.160.45 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) client-ip=209.85.160.45; Received: by mail-pb0-f45.google.com with SMTP id rp16so839864pbb.32 for ; Wed, 15 Jan 2014 00:35:35 -0800 (PST) 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 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: sachin.kamat@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.173 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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;