From patchwork Fri Sep 26 11:52:29 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 37958 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0817020F2E for ; Fri, 26 Sep 2014 11:52:40 +0000 (UTC) Received: by mail-la0-f69.google.com with SMTP id q1sf1475030lam.4 for ; Fri, 26 Sep 2014 04:52:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=HM1eWm3Vdy5ITGVaouKh+ESwvdtuED7RuLF1TWoYCgw=; b=k8IVcaZpc1QDrIEY8fO9mYC7bUZnqQEN8qr1o79wqk2pG6fpnHgDVDgmbbGI1zGVyw Ut5SoP0QXNuYs2UH2EY1LZ9NFCKNzKsgfQotxAyXPQp3H3seCR+7ggHd727wY0sEtWAM YIHp/7JnnrzdeG6S5eym6LxmCoXcwvUVNHjYzFyjPh5XsCXHuvDe/QK8MyEZlPjAN5Na Fb/KZf+X7rub3Su3jG/F3R5s5FYfpfV4kRQgNbxjj5MOnLtZ+cY9lOkzlO5ObNKJWGVE DCyH+HrpbzYUQERPGEQh8/nMbsJt8vYm4QcgJNZb0dDRZ03VR/47HbbSP0us7LWZWJta Ld4Q== X-Gm-Message-State: ALoCoQl4BknZrLeIiI0gEGZT9/U8XDCwSHqJl0OaUIq1PRtsCYlD5snyWVEgX4VdccXwq5bRzXGp X-Received: by 10.112.190.102 with SMTP id gp6mr2514603lbc.10.1411732359755; Fri, 26 Sep 2014 04:52:39 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.5.97 with SMTP id r1ls366055lar.84.gmail; Fri, 26 Sep 2014 04:52:39 -0700 (PDT) X-Received: by 10.152.87.193 with SMTP id ba1mr20056206lab.83.1411732359616; Fri, 26 Sep 2014 04:52:39 -0700 (PDT) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com [209.85.215.43]) by mx.google.com with ESMTPS id w12si6777950lbi.129.2014.09.26.04.52.39 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 26 Sep 2014 04:52:39 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) client-ip=209.85.215.43; Received: by mail-la0-f43.google.com with SMTP id gb8so4784666lab.16 for ; Fri, 26 Sep 2014 04:52:39 -0700 (PDT) X-Received: by 10.112.62.200 with SMTP id a8mr18691713lbs.34.1411732359397; Fri, 26 Sep 2014 04:52:39 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.130.169 with SMTP id of9csp46756lbb; Fri, 26 Sep 2014 04:52:38 -0700 (PDT) X-Received: by 10.66.222.199 with SMTP id qo7mr29313269pac.134.1411732357902; Fri, 26 Sep 2014 04:52:37 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id om9si8842058pdb.171.2014.09.26.04.52.37 for ; Fri, 26 Sep 2014 04:52:37 -0700 (PDT) Received-SPF: none (google.com: linux-gpio-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754141AbaIZLwg (ORCPT ); Fri, 26 Sep 2014 07:52:36 -0400 Received: from mail-wg0-f45.google.com ([74.125.82.45]:35922 "EHLO mail-wg0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753851AbaIZLwg (ORCPT ); Fri, 26 Sep 2014 07:52:36 -0400 Received: by mail-wg0-f45.google.com with SMTP id x13so8886189wgg.28 for ; Fri, 26 Sep 2014 04:52:35 -0700 (PDT) X-Received: by 10.180.36.141 with SMTP id q13mr26214612wij.32.1411732354829; Fri, 26 Sep 2014 04:52:34 -0700 (PDT) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id nf2sm1954395wic.4.2014.09.26.04.52.33 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Sep 2014 04:52:34 -0700 (PDT) From: Linus Walleij To: linux-gpio@vger.kernel.org Cc: Alexandre Courbot , Linus Walleij Subject: [PATCH] gpio: set parent irq on chained handlers Date: Fri, 26 Sep 2014 13:52:29 +0200 Message-Id: <1411732349-19178-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 1.9.3 Sender: linux-gpio-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-gpio@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: linus.walleij@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , If the IRQ from the parent is nested the IRQ may need to be resent under certain conditions. Currently the chained IRQ handler in gpiolib does not handle connecting nested IRQs but it is conceptually correct to indicate the actual parent IRQ. Reported-by: Grygorii Strashko Signed-off-by: Linus Walleij --- drivers/gpio/gpiolib.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 550e575c6ffb..9362b5b817af 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -398,17 +398,30 @@ void gpiochip_set_chained_irqchip(struct gpio_chip *gpiochip, int parent_irq, irq_flow_handler_t parent_handler) { + unsigned int offset; + if (gpiochip->can_sleep) { chip_err(gpiochip, "you cannot have chained interrupts on a chip that may sleep\n"); return; } + if (!gpiochip->irqdomain) { + chip_err(gpiochip, "called %s before setting up irqchip\n", + __func__); + return; + } irq_set_chained_handler(parent_irq, parent_handler); + /* * The parent irqchip is already using the chip_data for this * irqchip, so our callbacks simply use the handler_data. */ irq_set_handler_data(parent_irq, gpiochip); + + /* Set the parent IRQ for all affected IRQs */ + for (offset = 0; offset < gpiochip->ngpio; offset++) + irq_set_parent(irq_find_mapping(gpiochip->irqdomain, offset), + parent_irq); } EXPORT_SYMBOL_GPL(gpiochip_set_chained_irqchip);