From patchwork Wed Nov 8 06:34:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 118217 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp4911269qgn; Tue, 7 Nov 2017 22:36:12 -0800 (PST) X-Google-Smtp-Source: ABhQp+Sh3TevtEP3ugw0Izx8K+kVNPaLAjcOrRI8iewNxr81bN+Mfqv/+mGP943SnZtUrZQPGiPy X-Received: by 10.99.113.5 with SMTP id m5mr598865pgc.9.1510122972100; Tue, 07 Nov 2017 22:36:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510122972; cv=none; d=google.com; s=arc-20160816; b=hoGwi6vtDjBWyeKOSY3Sn9p5f2MUmUXlcuHnE8yxKxjB0knFE+jLV3vgg8yJH88V52 3OrPK6BiKQelk80xbguBAlS52uiFKqO8s92xNs11gUEBuRsMQVvzgZBCAtvskZ+9WQvc nHsjs9njhEBUXHd3Esc7jycIfiALc/2UiVISpS8M8QQSBX+AYpknIqHNiKpzIDTmbKN5 LkTmeSPHMKurZcmlw1VKZrCV3cM+YfW3ycqRCr5g+LEA6cNTsQ9Bcy6u8a70bpRnC2Vf v1W9sINt4xGEnEbWpBwrrADdKQ7PGnmuHWRXkFQ+pnT2dqszle6gsGo94/UinAwfS6Et 8K+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter:arc-authentication-results; bh=CnB3rTNETcNkfiqTj+LCxXvxycnnZH2y5eukCcqnaG0=; b=lgpB5/DONu+WQGtLaT++ZY9OtkH4jpbSJedcBy4wEI9LiBrhs2/YnKB68/zrzP9NNq rRW3W1ahWA4xOEABlCl3uF2GiUfya4/3HqlE+xX/Fcwnfj0K7rOaR07+wlwlrI6NZi4o F/M+PM/yKJeUroLOQQF2MGjN5LlQJM5Pl7lOI0tXs1C1LFLZ34HAcZ9GCUNSvegldP7B WQLvHOTFp+bLZQX0U38NcmqWOYV/CjfltfnesycgA5nCVPLLfKNHMDVOLa2v1ZVWQqGo e8k0/z08UrVFPlfUIwtEM4shSBJyE8P6gTM0BaCG028Ew/2P2FHk6U4E1qE1UoCkJocP VzZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=iLuNXJ0r; spf=pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-mmc-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e14si3052894pgf.310.2017.11.07.22.36.11; Tue, 07 Nov 2017 22:36:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=iLuNXJ0r; spf=pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-mmc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752816AbdKHGgK (ORCPT + 6 others); Wed, 8 Nov 2017 01:36:10 -0500 Received: from conuserg-08.nifty.com ([210.131.2.75]:64401 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751910AbdKHGgJ (ORCPT ); Wed, 8 Nov 2017 01:36:09 -0500 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id vA86Z5mk026956; Wed, 8 Nov 2017 15:35:06 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com vA86Z5mk026956 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1510122906; bh=UWHd9U4sBZKzrnzTCCr6EQU3vS95avn76RlRoY8hIkw=; h=From:To:Cc:Subject:Date:From; b=iLuNXJ0rSJgBHsCkUNEOv8C8ZfYV7gEUVuIMI/NgXQ5ScKX1nWU9DSqgSq51E0zlt xymjYmcY8IkOGIq8O98D6u/RV1q5CGYG3XP6rxTVo3l7ns6RlhExTnNO10lpb9+6w6 WyFLnuDaUnEsEO8tXFE7CwN0z0yikRvJH6ieWURrbaOGZBzvSOiJPP/S28KT7u3fu1 /zVwmyhxAa/x3lSkJgaTo9THr+Bu4ggAiisY5I33hYSBds6k/sPdGZ9hfHZwX96z4d YBlwA08q1jIO3fFQUik9CQjC7FCm5negkottJHfJs7sPDtk1oim9d7kwuaTr7P8iHW wZ1Cw3UaoyGZQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-mmc@vger.kernel.org Cc: Masahiro Yamada , Adrian Hunter , linux-kernel@vger.kernel.org, Andy Shevchenko , Shawn Lin , Ulf Hansson Subject: [PATCH] mmc: slot-gpio: call gpiod_to_irq() only when MMC_CAP_NEEDS_POLL is unset Date: Wed, 8 Nov 2017 15:34:54 +0900 Message-Id: <1510122894-9296-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org It is not efficient to call gpiod_to_irq() regardless the flag, then ignore the returned irq if MMC_CAP_NEEDS_POLL. Move gpiod_to_irq() after the MMC_CAP_NEEDS_POLL check. Signed-off-by: Masahiro Yamada --- drivers/mmc/core/slot-gpio.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/mmc/core/slot-gpio.c b/drivers/mmc/core/slot-gpio.c index 863f1db..f7c6e05 100644 --- a/drivers/mmc/core/slot-gpio.c +++ b/drivers/mmc/core/slot-gpio.c @@ -121,20 +121,18 @@ EXPORT_SYMBOL(mmc_gpio_request_ro); void mmc_gpiod_request_cd_irq(struct mmc_host *host) { struct mmc_gpio *ctx = host->slot.handler_priv; - int ret, irq; + int irq = -EINVAL; + int ret; if (host->slot.cd_irq >= 0 || !ctx || !ctx->cd_gpio) return; - irq = gpiod_to_irq(ctx->cd_gpio); - /* - * Even if gpiod_to_irq() returns a valid IRQ number, the platform might - * still prefer to poll, e.g., because that IRQ number is already used - * by another unit and cannot be shared. + * Do not use IRQ if the platform prefers to poll, e.g., because that + * IRQ number is already used by another unit and cannot be shared. */ - if (irq >= 0 && host->caps & MMC_CAP_NEEDS_POLL) - irq = -EINVAL; + if (!(host->caps & MMC_CAP_NEEDS_POLL)) + irq = gpiod_to_irq(ctx->cd_gpio); if (irq >= 0) { if (!ctx->cd_gpio_isr)