From patchwork Tue Jul 2 17:31:44 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Martinez Canillas X-Patchwork-Id: 2814211 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 A9828BF4A1 for ; Tue, 2 Jul 2013 17:32:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6E9FA2015A for ; Tue, 2 Jul 2013 17:32:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 760042008F for ; Tue, 2 Jul 2013 17:32:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753951Ab3GBRcH (ORCPT ); Tue, 2 Jul 2013 13:32:07 -0400 Received: from mail-ie0-f171.google.com ([209.85.223.171]:47580 "EHLO mail-ie0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753085Ab3GBRcG (ORCPT ); Tue, 2 Jul 2013 13:32:06 -0400 Received: by mail-ie0-f171.google.com with SMTP id qd12so13250162ieb.30 for ; Tue, 02 Jul 2013 10:32:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=0LkxvLzoJuAeW0CH1S/T4G2OJZ4Hb1OcbZkNrl5JgcI=; b=upQKzXerspfDTohbOPW0pyZ9mUnS1nRzE2u//j0AcOJ7HMEArSQvh1J0raVqmqTFLN 8BZzbMwj0Hu/aal/tL6YYLae6dgZzRtRSV3WsuG/h2Ar20zbv2+hTf+fbQwzm3pKzIMT wNsDs11nRuzVM2t5pXgGssFWH+WrgI6l9OOhTyfCc9Rl5avlhettGtmQNdqeRWPv6ho3 5+jZOIVTkw+NcnXmnJzD0HMH3c89DAx8EPva2sMgVrzwVF131tgszxQfxlfc+HVJcOVV II5hVVKFyjfqpMTVcI3WR0mCXUyR5S1+uUTQmlOygi5uvf/srnm0x9oDziP7/7NBYXr1 OAQg== X-Received: by 10.50.101.16 with SMTP id fc16mr21505204igb.49.1372786324885; Tue, 02 Jul 2013 10:32:04 -0700 (PDT) MIME-Version: 1.0 Received: by 10.64.67.46 with HTTP; Tue, 2 Jul 2013 10:31:44 -0700 (PDT) In-Reply-To: References: <1372276203-21755-1-git-send-email-javier.martinez@collabora.co.uk> From: Javier Martinez Canillas Date: Tue, 2 Jul 2013 19:31:44 +0200 Message-ID: Subject: Re: [PATCH v3 0/2]: auto request GPIO as input if used as IRQ via DT To: Kevin Hilman Cc: Javier Martinez Canillas , Grant Likely , jgchunter@gmail.com, Santosh Shilimkar , Tony Lindgren , Linus Walleij , Jean-Christophe PLAGNIOL-VILLARD , eballetbo@gmail.com, Thomas Petazzoni , linux-omap , Florian Vaussard , aaro.koskinen@iki.fi Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 On Tue, Jul 2, 2013 at 6:10 PM, Kevin Hilman wrote: > On Wed, Jun 26, 2013 at 12:50 PM, Javier Martinez Canillas > wrote: > > [...] > >> Aaro, could you please test if these changes break any of your OMAP1 boards? >> Although it shouldn't do it as far as I can tell. > > This doesn't build for omap1_defconfig (at least in next-20130702): > > /work/kernel/next/drivers/gpio/gpio-omap.c: In function 'omap_gpio_chip_init': > /work/kernel/next/drivers/gpio/gpio-omap.c:1080:17: error: 'struct > gpio_chip' has no member named 'of_node' > /work/kernel/next/drivers/gpio/gpio-omap.c: In function 'omap_gpio_irq_map': > /work/kernel/next/drivers/gpio/gpio-omap.c:1116:16: error: 'struct > gpio_chip' has no member named 'of_node' > > Probably because OMAP1 is non-DT? > > Kevin > -- Hi Kevin, Yes, sorry about that. In the a previous version of the patch-set of_have_populated_dt() was used instead of chip.of_node and it built correctly with OMAP1 since it just default to return false. Then I was told to check if the struct gpio_chip has an associated device node instead and forget to build test for OMAP1 :-( Could you please tell me if the following patch looks like a good fix to you so I can do a proper post? From 2d14bcc7c300a9451d7d8a37eeff4e0285c977a0 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Tue, 2 Jul 2013 19:04:14 +0200 Subject: [PATCH 1/1] gpio/omap: fix build error when CONFIG_OF_GPIO is not defined. The OMAP GPIO driver check if the chip has an associated DT device node using the struct gpio_chip of_node member. But this is only built if CONFIG_OF_GPIO is defined which leads to the following error when using omap1_defconfig: linux/drivers/gpio/gpio-omap.c: In function 'omap_gpio_chip_init': linux/drivers/gpio/gpio-omap.c:1080:17: error: 'struct gpio_chip' has no member named 'of_node' linux/drivers/gpio/gpio-omap.c: In function 'omap_gpio_irq_map': linux/drivers/gpio/gpio-omap.c:1116:16: error: 'struct gpio_chip' has no member named 'of_node' Reported-by: Kevin Hilman Signed-off-by: Javier Martinez Canillas --- drivers/gpio/gpio-omap.c | 16 ++++++++++++++-- 1 files changed, 14 insertions(+), 2 deletions(-) int j; @@ -1077,7 +1089,7 @@ static void omap_gpio_chip_init(struct gpio_bank *bank) * irq_create_of_mapping() only for the GPIO lines that * are used as interrupts. */ - if (!bank->chip.of_node) + if (!omap_gpio_chip_dt_boot(&bank->chip)) for (j = 0; j < bank->width; j++) irq_create_mapping(bank->domain, j); irq_set_chained_handler(bank->irq, gpio_irq_handler); @@ -1113,7 +1125,7 @@ static int omap_gpio_irq_map(struct irq_domain *d, unsigned int virq, * but until then this has to be done on a per driver * basis. Remove this once this is managed by the core. */ - if (bank->chip.of_node) { + if (omap_gpio_chip_dt_boot(&bank->chip)) { gpio = irq_to_gpio(bank, hwirq); ret = gpio_request_one(gpio, GPIOF_IN, NULL); if (ret) { diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index c4f0aa2..bd536f1 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c @@ -1037,6 +1037,18 @@ omap_mpuio_alloc_gc(struct gpio_bank *bank, unsigned int irq_start, IRQ_NOREQUEST | IRQ_NOPROBE, 0); } +#if defined(CONFIG_OF_GPIO) +static inline bool omap_gpio_chip_dt_boot(struct gpio_chip *chip) +{ + return chip->of_node != NULL; +} +#else +static inline bool omap_gpio_chip_dt_boot(struct gpio_chip *chip) +{ + return false; +} +#endif + static void omap_gpio_chip_init(struct gpio_bank *bank) {