From patchwork Fri Oct 11 17:57:03 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 20984 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vb0-f70.google.com (mail-vb0-f70.google.com [209.85.212.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id EC4A325EA1 for ; Fri, 11 Oct 2013 17:57:11 +0000 (UTC) Received: by mail-vb0-f70.google.com with SMTP id h10sf7836338vbh.5 for ; Fri, 11 Oct 2013 10:57:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=mime-version:x-gm-message-state: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=yucV+l2w4j23eHFkr4e9FF5vRSZpW1Jf+jeCAPIL14k=; b=Oei+M4AfBf4lkIgPBUBfpIh3UJS1I/whabWaXhCTcNmIODvzdtvuR21HbACdWEa7ce 1zwENVZkedBW9zxuteiwfhIXPSHL6U8ra7fe2lFpWxdMQavVA/R3mVau9hLpYfjq4CwU 6UyYa/ZtSmobcoh7Vwlg8iwwizCCW8jWf4Gx6t2O5idlMfij0YwDCnVS9FgQ5irNFIKC AvgAKkcOLn4wK7YdYQ8PhIJ42g5Cevc5yH9zkdLqmGwPHytp43MGm7J/hFiJOlA840Ev NpL3fVMsyUePuP6WTsVrhoGZQ110pmOrEIHfpfQ4TJedssfOzbgVOgkARI+wtVG5SEhj /m+A== X-Received: by 10.236.32.74 with SMTP id n50mr20272618yha.13.1381514231323; Fri, 11 Oct 2013 10:57:11 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.30.37 with SMTP id p5ls1522592qeh.51.gmail; Fri, 11 Oct 2013 10:57:11 -0700 (PDT) X-Received: by 10.52.243.138 with SMTP id wy10mr18856853vdc.2.1381514231238; Fri, 11 Oct 2013 10:57:11 -0700 (PDT) Received: from mail-vb0-f45.google.com (mail-vb0-f45.google.com [209.85.212.45]) by mx.google.com with ESMTPS id dj3si17083621vcb.119.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 11 Oct 2013 10:57:11 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.45 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.45; Received: by mail-vb0-f45.google.com with SMTP id e15so3056594vbg.32 for ; Fri, 11 Oct 2013 10:57:11 -0700 (PDT) X-Gm-Message-State: ALoCoQkXjN0N+j48nZlJRvv1buXBl70ImxupJa1K9S865pZL9FsBRZ02FFBLbEuTlEoN/id83ofr X-Received: by 10.220.237.208 with SMTP id kp16mr22257698vcb.4.1381514231121; Fri, 11 Oct 2013 10:57:11 -0700 (PDT) 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.220.174.196 with SMTP id u4csp58903vcz; Fri, 11 Oct 2013 10:57:10 -0700 (PDT) X-Received: by 10.180.198.115 with SMTP id jb19mr4215810wic.28.1381514230193; Fri, 11 Oct 2013 10:57:10 -0700 (PDT) Received: from mail-wg0-f45.google.com (mail-wg0-f45.google.com [74.125.82.45]) by mx.google.com with ESMTPS id w7si21185369wje.104.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 11 Oct 2013 10:57:10 -0700 (PDT) Received-SPF: neutral (google.com: 74.125.82.45 is neither permitted nor denied by best guess record for domain of linus.walleij@linaro.org) client-ip=74.125.82.45; Received: by mail-wg0-f45.google.com with SMTP id z12so2878901wgg.12 for ; Fri, 11 Oct 2013 10:57:09 -0700 (PDT) X-Received: by 10.180.20.177 with SMTP id o17mr4184039wie.38.1381514229533; Fri, 11 Oct 2013 10:57:09 -0700 (PDT) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id ft19sm7813056wic.5.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 11 Oct 2013 10:57:08 -0700 (PDT) From: Linus Walleij To: linux-gpio@vger.kernel.org Cc: Alexandre Courbot , Linus Walleij , Vipul Kumar Samar , Lee Jones , Gabriel Fernandez , Jean-Nicolas Graux Subject: [PATCH] gpio: stmpe: drop references to "virtual" IRQ, fix bug Date: Fri, 11 Oct 2013 19:57:03 +0200 Message-Id: <1381514223-8515-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 1.8.3.1 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: linus.walleij@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.45 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: , Rename the argument "virq" to just "irq", this IRQ isn't any more "virtual" than any other Linux IRQ number, we use "hwirq" for the actual hw-numbers, "virq" is just bogus. When doing this I see that the hwirq argument is used for mapping rather than the Linux IRQ in the map function. This doesn't look right. Use the Linux IRQ instead. Cc: Vipul Kumar Samar Cc: Lee Jones Cc: Gabriel Fernandez Cc: Jean-Nicolas Graux Signed-off-by: Linus Walleij --- I cannot test this patch so I don't know if the mapping change is correct, however since absolutely every other driver does it the other way around this doesn't look sound at all. Please help out with review. --- drivers/gpio/gpio-stmpe.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/drivers/gpio/gpio-stmpe.c b/drivers/gpio/gpio-stmpe.c index b33bad1..2647e24 100644 --- a/drivers/gpio/gpio-stmpe.c +++ b/drivers/gpio/gpio-stmpe.c @@ -254,9 +254,10 @@ static irqreturn_t stmpe_gpio_irq(int irq, void *dev) while (stat) { int bit = __ffs(stat); int line = bank * 8 + bit; - int virq = irq_find_mapping(stmpe_gpio->domain, line); + int child_irq = irq_find_mapping(stmpe_gpio->domain, + line); - handle_nested_irq(virq); + handle_nested_irq(child_irq); stat &= ~(1 << bit); } @@ -271,7 +272,7 @@ static irqreturn_t stmpe_gpio_irq(int irq, void *dev) return IRQ_HANDLED; } -static int stmpe_gpio_irq_map(struct irq_domain *d, unsigned int virq, +static int stmpe_gpio_irq_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hwirq) { struct stmpe_gpio *stmpe_gpio = d->host_data; @@ -279,26 +280,26 @@ static int stmpe_gpio_irq_map(struct irq_domain *d, unsigned int virq, if (!stmpe_gpio) return -EINVAL; - irq_set_chip_data(hwirq, stmpe_gpio); - irq_set_chip_and_handler(hwirq, &stmpe_gpio_irq_chip, + irq_set_chip_data(irq, stmpe_gpio); + irq_set_chip_and_handler(irq, &stmpe_gpio_irq_chip, handle_simple_irq); - irq_set_nested_thread(hwirq, 1); + irq_set_nested_thread(irq, 1); #ifdef CONFIG_ARM - set_irq_flags(hwirq, IRQF_VALID); + set_irq_flags(irq, IRQF_VALID); #else - irq_set_noprobe(hwirq); + irq_set_noprobe(irq); #endif return 0; } -static void stmpe_gpio_irq_unmap(struct irq_domain *d, unsigned int virq) +static void stmpe_gpio_irq_unmap(struct irq_domain *d, unsigned int irq) { #ifdef CONFIG_ARM - set_irq_flags(virq, 0); + set_irq_flags(irq, 0); #endif - irq_set_chip_and_handler(virq, NULL, NULL); - irq_set_chip_data(virq, NULL); + irq_set_chip_and_handler(irq, NULL, NULL); + irq_set_chip_data(irq, NULL); } static const struct irq_domain_ops stmpe_gpio_irq_simple_ops = {