From patchwork Thu Apr 19 08:29:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 133706 Delivered-To: patch@linaro.org Received: by 10.46.66.142 with SMTP id h14csp366158ljf; Thu, 19 Apr 2018 01:29:40 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/93kkdkSfmGfeFmwHMO20azcaePO2AB4uwseDN+997iPu7QUCI2B7RrYoBWvYoEPwTfno3 X-Received: by 10.98.236.220 with SMTP id e89mr5029186pfm.33.1524126580657; Thu, 19 Apr 2018 01:29:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524126580; cv=none; d=google.com; s=arc-20160816; b=YqNkvyKKlv+2kkzad6hLYy9grqj8fkZaDsVOSYxZyuvnu7skG6HvPHiec0ZQNDg8BO c7JyNz2B6KCum1UktMAu3yam2XXeEHJlupCiNSG2CmXV5cK3dj7dkTiKFm3+OVFXkS5I gNYCIFpErDhNH59R8qPMgLvJDfcFbK3KotRFzzRUpWSXcg4c5OuqFN0ct/7y5qvYJk3l PRa8uIBEtAuWsozAklZL7zZEz+GhccfGrx7nnmlb3g0C0vCQXrnN6GupagJuMeYaBEAV WYyjYSI//rdF1sHRTHMKWWQuf6PTqG7RVsfWQhTlh0Nu9d21X3JhvM1nQn50LbpH2ThA z+Hw== 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:arc-authentication-results; bh=VAq3P6/UemN08CMyCkF2w1JSuO182Dk3QiFwTwnPj6U=; b=EnXQHtMSjUjmPJjjrL/WvL/dNpN1ELPVJ7GK8Kw+wD89RtnygK747fxKgIc16wSWfw sVmaUVpWsjo/cC8ecgN9WkTFFkjLtxGG9MMvG4jyLNAfrXy8FXz+K1c2aPC4agAU3PIU ViCykSw6dguzozeFgVro4Y/aTQExzMbVKtfuAAYeMxUuy4bccdJuBqI9cf/gnjaYBOAS 8M9FIqPKltzA2u/xjQoEubYmQA3atiNFGOqdEEem4ESfNaZNLdKUkHu7CYsgFDM6/omr 5i5B35lA2a7J5jkIvtLZi2DN3ipv9kc0lq3pejYRuVd9Ki4dSK8tUPqkg5hAdvREvw70 O/eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=StSAJVGX; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x11-v6si2965543plv.149.2018.04.19.01.29.40; Thu, 19 Apr 2018 01:29:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-gpio-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=@linaro.org header.s=google header.b=StSAJVGX; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751882AbeDSI3j (ORCPT + 5 others); Thu, 19 Apr 2018 04:29:39 -0400 Received: from mail-lf0-f65.google.com ([209.85.215.65]:35947 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750980AbeDSI3i (ORCPT ); Thu, 19 Apr 2018 04:29:38 -0400 Received: by mail-lf0-f65.google.com with SMTP id d20-v6so6540279lfe.3 for ; Thu, 19 Apr 2018 01:29:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=r584L7epZw4fxAOQOz5MxG8A9Jh72PYT1QtqdhUNFQA=; b=StSAJVGXBHVZuwAPN5H2WrL/lNCYhl/u6jf4AnICfo+FKjlY1dkNlj96uihVs2IZ1W dR8eh0PsDs9ltu9ZmBMYDoLlZgeD5JATbuY9NygxC/v3i6X8BHdCoatQZvYpBMPw7g5R 0uoSW3xV068tlfIoS1Pvpg7Nlw9nsqev+E5fk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=r584L7epZw4fxAOQOz5MxG8A9Jh72PYT1QtqdhUNFQA=; b=AlMlb1REtgBuZCZtbBiRMhBwW7wSW86m3O1DTlH68uTeuN9w/HPZO5JXBAsLaoVu66 UKs7OTnY3TarDX66mY8BaQ6AxNanp7pDPqwdo7X9igLNvQJBBEtxwncTpiN3E0ofS5cI 7OkmadLZuRB0JCGwz46/43djfPfwpppnpDcZ/U72Kpb36jkLBW7CHDvt2wHkGgZwwt08 9BcI2SDNFT0svwnEYi+MjLD1LHzc73IzGv613TNZALu4bDdbdzdtI8e//PxTs1q/0reT 7KkIvLUlQXG89Q5w7QFQ4au1Ci3o2Gb0WDLEBkdKRkO6JkvgUCkOClVGiH6y/8GOAE46 RvEw== X-Gm-Message-State: ALQs6tBYvaV1IxQtJMboNpNHoHNLiZMEYAH9AIq1KoJEGnC8e78mcfSR x7No1BZGvQnuHsFMc+MgWY4QwHa5rCU= X-Received: by 2002:a19:e48a:: with SMTP id x10-v6mr3742287lfi.115.1524126576876; Thu, 19 Apr 2018 01:29:36 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id c63-v6sm632124lfg.17.2018.04.19.01.29.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Apr 2018 01:29:36 -0700 (PDT) From: Linus Walleij To: linux-gpio@vger.kernel.org Cc: Linus Walleij , Vladimir Zapolskiy , Fabio Estevam , Shawn Guo Subject: [PATCH] gpio: mxc: Remove reliance on Date: Thu, 19 Apr 2018 10:29:33 +0200 Message-Id: <20180419082933.5953-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.14.3 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org This is a driver so we should only include . However this driver was using gpio_get_value() to fetch the current value of a GPIO used as IRQ line to determine trigger direction, so we need a better way than looping over the global GPIO numberspace. Fix this by just calling the .get() function in the GPIO chip, as we don't want to end up creating a consumer dependency on ourselves. Cc: Vladimir Zapolskiy Cc: Fabio Estevam Cc: Shawn Guo Signed-off-by: Linus Walleij --- drivers/gpio/gpio-mxc.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) -- 2.14.3 -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Acked-by: Shawn Guo diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c index 5245a2fe62ae..11ec7228ab08 100644 --- a/drivers/gpio/gpio-mxc.c +++ b/drivers/gpio/gpio-mxc.c @@ -30,8 +30,6 @@ #include #include #include -/* FIXME: for gpio_get_value() replace this with direct register read */ -#include #include #include #include @@ -174,7 +172,6 @@ static int gpio_set_irq_type(struct irq_data *d, u32 type) struct mxc_gpio_port *port = gc->private; u32 bit, val; u32 gpio_idx = d->hwirq; - u32 gpio = port->gc.base + gpio_idx; int edge; void __iomem *reg = port->base; @@ -190,13 +187,13 @@ static int gpio_set_irq_type(struct irq_data *d, u32 type) if (GPIO_EDGE_SEL >= 0) { edge = GPIO_INT_BOTH_EDGES; } else { - val = gpio_get_value(gpio); + val = port->gc.get(&port->gc, gpio_idx); if (val) { edge = GPIO_INT_LOW_LEV; - pr_debug("mxc: set GPIO %d to low trigger\n", gpio); + pr_debug("mxc: set GPIO %d to low trigger\n", gpio_idx); } else { edge = GPIO_INT_HIGH_LEV; - pr_debug("mxc: set GPIO %d to high trigger\n", gpio); + pr_debug("mxc: set GPIO %d to high trigger\n", gpio_idx); } port->both_edges |= 1 << gpio_idx; }