From patchwork Thu Aug 8 20:47:34 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Daudt X-Patchwork-Id: 2841410 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 32BDC9F271 for ; Thu, 8 Aug 2013 20:47:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3996920284 for ; Thu, 8 Aug 2013 20:47:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5CCB620279 for ; Thu, 8 Aug 2013 20:47:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966547Ab3HHUru (ORCPT ); Thu, 8 Aug 2013 16:47:50 -0400 Received: from mms2.broadcom.com ([216.31.210.18]:1482 "EHLO mms2.broadcom.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966546Ab3HHUrt (ORCPT ); Thu, 8 Aug 2013 16:47:49 -0400 Received: from [10.9.208.53] by mms2.broadcom.com with ESMTP (Broadcom SMTP Relay (Email Firewall v6.5)); Thu, 08 Aug 2013 13:41:29 -0700 X-Server-Uuid: 4500596E-606A-40F9-852D-14843D8201B2 Received: from IRVEXCHSMTP3.corp.ad.broadcom.com (10.9.207.53) by IRVEXCHCAS06.corp.ad.broadcom.com (10.9.208.53) with Microsoft SMTP Server (TLS) id 14.1.438.0; Thu, 8 Aug 2013 13:47:36 -0700 Received: from mail-irva-13.broadcom.com (10.10.10.20) by IRVEXCHSMTP3.corp.ad.broadcom.com (10.9.207.53) with Microsoft SMTP Server id 14.1.438.0; Thu, 8 Aug 2013 13:47:36 -0700 Received: from mothra.ric.broadcom.com (test-csd10.ric.broadcom.com [10.136.18.149]) by mail-irva-13.broadcom.com (Postfix) with ESMTP id 598B7F2D73; Thu, 8 Aug 2013 13:47:36 -0700 (PDT) From: "Christian Daudt" To: "Christian Daudt" cc: "Chris Ball" , "Guennadi Liakhovetski" , "Shawn Guo" , linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] mmc: change mmc_gpio_get_cd to call non-sleep gpio Date: Thu, 8 Aug 2013 13:47:34 -0700 Message-ID: <1375994855-12472-1-git-send-email-csd@broadcom.com> X-Mailer: git-send-email 1.7.10.4 MIME-Version: 1.0 X-WSS-ID: 7E1ADDF31R078647768-01-01 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 Given that mmc_gpio_get_cd can be called in softirq context (by sdhci_tasklet_card -> sdhci_card_event -> sdhci_do_get_cd -> mmc_gpio_get_cd ), it is necessary for it to use gpio_get_value instead of gpio_get_value_cansleep Note that at present sdhci_card_event gets called both from mmc_gpio_cd_irqt and sdhci_tasklet_card, and from both it gets called immediately while the actual cd processing is debounced to 200ms later. I think that the better solution might be to move the sdhci_card_event callback into mmc_rescan and remove it from its 2 present locations. That way the cd related callbacks are aligned with the actual cd detection code. I can submit a follow-up patch with these mods if that sounds like a better way to solve this. Signed-off-by: Christian Daudt diff --git a/drivers/mmc/core/slot-gpio.c b/drivers/mmc/core/slot-gpio.c index 3242351..897b298 100644 --- a/drivers/mmc/core/slot-gpio.c +++ b/drivers/mmc/core/slot-gpio.c @@ -87,7 +87,7 @@ int mmc_gpio_get_cd(struct mmc_host *host) if (!ctx || !gpio_is_valid(ctx->cd_gpio)) return -ENOSYS; - return !gpio_get_value_cansleep(ctx->cd_gpio) ^ + return !gpio_get_value(ctx->cd_gpio) ^ !!(host->caps2 & MMC_CAP2_CD_ACTIVE_HIGH); } EXPORT_SYMBOL(mmc_gpio_get_cd);