From patchwork Mon Apr 15 11:25:38 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: 2444661 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork1.kernel.org (Postfix) with ESMTP id BD5A63FD8C for ; Mon, 15 Apr 2013 11:26:11 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1URhY2-0005u1-3i; Mon, 15 Apr 2013 11:26:10 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1URhXz-0007ln-Gx; Mon, 15 Apr 2013 11:26:07 +0000 Received: from mail-ia0-x234.google.com ([2607:f8b0:4001:c02::234]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1URhXv-0007lS-78 for linux-arm-kernel@lists.infradead.org; Mon, 15 Apr 2013 11:26:04 +0000 Received: by mail-ia0-f180.google.com with SMTP id l29so4160845iag.25 for ; Mon, 15 Apr 2013 04:25:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=NO6BZd6lo9hpEvye3XhHYADiA+dv6Xdmx+P/xC6Y/aw=; b=010qBXNoQOO8FGsVdQOslR1RGj7OKmeIc7VsBCaUCRcPI1+kYttPUNke7/5fSKHfSk mJBhPTVFM+DonQsSzejywO0e9ARK9toQ2qlWpVSxB6Mh6vpw3hgWuGiDuBiDk4qS35lb RA6sL2BrG+GTjgV8s1E8nDFz5vf7eV3/RBFFKkceYTNEuyKTsaZfG+9DjVIQiLxbAkGE wAx7xH7psWGjU4RS/h0YMEl3DJJNAI1IrFDAxrmQuTSDjxyv2MHgSeRtCRdsUczSwA/O Rt5Jwze3YePDp8y2819dfzAdo4K6vUtLPZA3TUWbzlLWPHj2pRCqgRSjF5mM+UBdLhki O7gg== X-Received: by 10.50.141.129 with SMTP id ro1mr4941898igb.39.1366025158813; Mon, 15 Apr 2013 04:25:58 -0700 (PDT) MIME-Version: 1.0 Received: by 10.64.71.2 with HTTP; Mon, 15 Apr 2013 04:25:38 -0700 (PDT) In-Reply-To: References: <1329321854-24490-1-git-send-email-b-cousson@ti.com> <4F47AD08.4030504@ti.com> <512D39DA.7020306@ti.com> <512D3AB1.1080202@wwwdotorg.org> <512D3EC2.6050408@ti.com> <20130302200524.D230F3E1571@localhost> <51391F41.5000303@ti.com> <514C79E1.4090106@wwwdotorg.org> <514CE0AB.6060207@ti.com> <515319D5.20105@wwwdotorg.org> <5155C902.7080207@wwwdotorg.org> <5165CB9D.1090202@wwwdotorg.org> <51671D7B.5060303@wwwdotorg.org> <51673D70.3010503@wwwdotorg.org> From: Javier Martinez Canillas Date: Mon, 15 Apr 2013 13:25:38 +0200 Message-ID: Subject: Re: [PATCH 3/5] gpio/omap: Add DT support to GPIO driver To: Linus Walleij X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130415_072603_360602_CF443CB4 X-CRM114-Status: GOOD ( 25.69 ) X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (martinez.javier[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: Stephen Warren , Stephen Warren , Kevin Hilman , "devicetree-discuss@lists.ozlabs.org" , Grant Likely , Alexandre Courbot , Jon Hunter , "linux-omap@vger.kernel.org" , Tarun Kanti DebBarma , "linux-arm-kernel@lists.infradead.org" X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org On Sun, Apr 14, 2013 at 10:53 PM, Linus Walleij wrote: > On Sun, Apr 14, 2013 at 3:35 AM, Javier Martinez Canillas > wrote: > >> Is the following inlined patch [1] what you were thinking that would >> be the right approach? Hi Linus, thanks a lot for your feedback. > > This looks sort of OK, but I'm still struggling with the question of > what we could do to help other implementations facing the same issue. > Yes, I don't know how we can make it easier to other implementations (besides adding the irq_request hook to irq_chip) since the logic is GPIO controller specific. For example I took a look to drivers/gpio/gpio-tegra.c and if I understood correctly, the implementation for this driver should be something like this: .irq_ack = tegra_gpio_irq_ack, @@ -355,6 +360,7 @@ static struct irq_chip tegra_gpio_irq_chip = { #ifdef CONFIG_PM_SLEEP .irq_set_wake = tegra_gpio_wake_enable, #endif + .irq_request = tegra_gpio_irq_request, }; static const struct dev_pm_ops tegra_gpio_pm_ops = { This is definitely quite similar to the omap-gpio.c change but not the same. > This is a pretty hard design pattern to properly replicate in every such > driver is it not? > > Hmmmm > Is indeed a hard design pattern but I couldn't figure out a more generic way to handle this. Maybe we could use [1] for now to solve the issue that we have with OMAP GPIO and later when the same issue is found on other GPIO controllers and a similar change is made on these drivers we will see some form of pattern that emerge allowing us to make a later refactor to reduce the code duplication. Or do you have a better idea on how to solve this? > Yours, > Linus Walleij Best regards, Javier diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c index 414ad91..a2d5c3d 100644 --- a/drivers/gpio/gpio-tegra.c +++ b/drivers/gpio/gpio-tegra.c @@ -346,6 +346,11 @@ static int tegra_gpio_wake_enable(struct irq_data *d, unsigned int enable) } #endif +static int tegra_gpio_irq_request(struct irq_data *d) +{ + tegra_gpio_request(NULL, d->hwirq); +} + static struct irq_chip tegra_gpio_irq_chip = { .name = "GPIO",