From patchwork Wed Apr 23 14:50:10 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 4041881 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3A64EBFF02 for ; Wed, 23 Apr 2014 14:50:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5ABA1201ED for ; Wed, 23 Apr 2014 14:50:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 49692201F7 for ; Wed, 23 Apr 2014 14:50:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752964AbaDWOuV (ORCPT ); Wed, 23 Apr 2014 10:50:21 -0400 Received: from mail-we0-f177.google.com ([74.125.82.177]:41208 "EHLO mail-we0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752314AbaDWOuQ (ORCPT ); Wed, 23 Apr 2014 10:50:16 -0400 Received: by mail-we0-f177.google.com with SMTP id u57so954388wes.22 for ; Wed, 23 Apr 2014 07:50:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=XjphOkTY/8lKM1sj+lxyfnnj2Tz1v68xgJYO8QKu2pI=; b=HOWifOsJdnLiQGKzzobFHP9R8V98Aj5c+iie8pmmUuLX8JJ5Wjs1dEhlfT6cfCgALz mCd7ZCscbEJz8q5Z5dnOCwvkl/MK2VU1XkAQI6TAPpwmMzost16k+P9t2MEBWXZTqc0t 8Uo5aSpuHtjUU01DSbbrESuOD+IGG1kd0IUAnyADi7x3MDiCTsfkonCXZLnHJXndJM6T tyd6DOnAmLdQLH/KDLxsLr3GI+8XVwCqMlXCOchmCZwiKoaolgdu/udFu9uaqOz45raQ BLSuD7ZF9gK1U3YCw88DnlS1VkKUnVWx4FALPZ2ew/lzayCRIoKkUxnF+8oMSm8v+4is g/Bw== X-Gm-Message-State: ALoCoQkZWOyKYMzAzr+BOdC51mWB2Y/7ncX3jELW/vvRpxYPTc308qdhqbCjOdWux5t9c+Cy+fKt X-Received: by 10.180.8.40 with SMTP id o8mr2147041wia.25.1398264614930; Wed, 23 Apr 2014 07:50:14 -0700 (PDT) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id c7sm1828495wjf.19.2014.04.23.07.50.13 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Apr 2014 07:50:14 -0700 (PDT) From: Linus Walleij To: linux-gpio@vger.kernel.org Cc: Alexandre Courbot , Linus Walleij , Nishanth Menon , Peter Ujfalusi , Ezequiel Garcia , Javier Martinez Canillas , Tony Lindgren , Santosh Shilimkar , linux-omap Subject: [PATCH] gpio: do not set up hardware for IRQ_TYPE_NONE Date: Wed, 23 Apr 2014 16:50:10 +0200 Message-Id: <1398264610-12663-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 1.9.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 Some GPIO irqchip drivers exploit the irqdomain mapping function to set up the IRQ default type in the hardware, make sure that if we pass IRQ_TYPE_NONE, no hardware setup whatsoever takes place (this should be the norm) until later when the IRQ gets utilized. Cc: Nishanth Menon Cc: Peter Ujfalusi Cc: Ezequiel Garcia Cc: Javier Martinez Canillas Cc: Tony Lindgren Cc: Santosh Shilimkar Cc: linux-omap Signed-off-by: Linus Walleij Tested-by: Javier Martinez Canillas Tested-by: Nishanth Menon Acked-by: Nishanth Menon Tested-by: Peter Ujfalusi --- TI folks: can you provide a Tested-by tag if this makes your OMAPs work? I am pretty sure the other platforms will be unaffected, if they aren't I will switch them over to react to IRQ_TYPE_DEFAULT. --- drivers/gpio/gpiolib.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index ee1819fdcf35..97d173e9aa2d 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -1409,7 +1409,12 @@ static int gpiochip_irq_map(struct irq_domain *d, unsigned int irq, #else irq_set_noprobe(irq); #endif - irq_set_irq_type(irq, chip->irq_default_type); + /* + * No set-up of the hardware will happen if IRQ_TYPE_NONE + * is passed as default type. + */ + if (chip->irq_default_type != IRQ_TYPE_NONE) + irq_set_irq_type(irq, chip->irq_default_type); return 0; } @@ -1490,7 +1495,8 @@ static void gpiochip_irqchip_remove(struct gpio_chip *gpiochip) * @first_irq: if not dynamically assigned, the base (first) IRQ to * allocate gpiochip irqs from * @handler: the irq handler to use (often a predefined irq core function) - * @type: the default type for IRQs on this irqchip + * @type: the default type for IRQs on this irqchip, pass IRQ_TYPE_NONE + * to have the core avoid setting up any default type in the hardware. * * This function closely associates a certain irqchip with a certain * gpiochip, providing an irq domain to translate the local IRQs to