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: 3490761 Return-Path: X-Original-To: patchwork-linux-samsung-soc@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 B41EE9F169 for ; Wed, 15 Jan 2014 08:35:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C7CD6201D3 for ; Wed, 15 Jan 2014 08:35:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7AED020155 for ; Wed, 15 Jan 2014 08:35:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751527AbaAOIfg (ORCPT ); Wed, 15 Jan 2014 03:35:36 -0500 Received: from mail-pd0-f176.google.com ([209.85.192.176]:64450 "EHLO mail-pd0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751132AbaAOIff (ORCPT ); Wed, 15 Jan 2014 03:35:35 -0500 Received: by mail-pd0-f176.google.com with SMTP id r10so819231pdi.35 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=KTEn5ITUlGDrP5dyxa09jQBA95UkPcG7ThMHi1V2jEVYy/HHgxdpFsbB0cd2o1wW0E BVwXf/J8Q39vLwV1PI+5YGhXFg95HEYYAOoF8Mh5uV7VI39D2E7grl7AjU4ISgqBAJCz 1HiZgjIZXeYt4I15kCHvIIpYTHQFQw4O0iRymraJeYkawtvs3DhQO1xwQuJFib0YOMC5 nbDflVu+rGy3+DrNhHLsMWmhuG3cDqtbLhQuyMQNac2wd4r8gPRuk+NUcwfgiofObwQr Tw57Z3qDoS8g53tSrSavY3n8371dx45KZVXwRqvC1vnFLhvkZFHPKItI/gvu36XErJpq ZxpA== X-Gm-Message-State: ALoCoQkA2gMN7RxjOT9VIKML18yz4pjNQuUAcjXXa37p41dQs2B0JVwIYmzo1w/K8vxGe5tbLHZB 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-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@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;