From patchwork Sat May 18 22:56:30 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Figa X-Patchwork-Id: 2589511 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork2.kernel.org (Postfix) with ESMTP id 6AF74DF2E5 for ; Sat, 18 May 2013 22:57:16 +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 1Udq3u-0000Oa-KG; Sat, 18 May 2013 22:57:14 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Udq3r-0005MC-SF; Sat, 18 May 2013 22:57:11 +0000 Received: from mail-ee0-f49.google.com ([74.125.83.49]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Udq3p-0005Ll-Jx for linux-arm-kernel@lists.infradead.org; Sat, 18 May 2013 22:57:10 +0000 Received: by mail-ee0-f49.google.com with SMTP id d17so3213560eek.8 for ; Sat, 18 May 2013 15:56:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer; bh=s5n/KXQdJZJSfpAZza2PHMGZEkezl93JSv1d+YvK7qs=; b=TT/KhuzCPWjgw54mDH9mHCspkJ/iZtgnb+awm6f7yUoXTCFwd1DWzVMOTX3aVfDK0W 5LowJ60mo01mr6sEMXHaLKdduiXEuHS/N6BdBv1VebfD4mJH4cPqeIOpbaA8FxjkZvAT gAcjspMCtVBNCBYI3zx6UxFe23Mcn9RL6t8Itd4TCoE+LugvglmzCI0VVH97lsytyjPG e21mCOi65yBJei/5i6PvomZUO8TtRhpMW4Kr21PQsd6BxJV06Upl4qqnghP3Rl88QNev su0Pbfh3I2yLPY4Klcy2gmXalIYRnXYS74LbUQDU/Aa6/DNSS4p3osW9MEM8OhdyeoU7 0Xtw== X-Received: by 10.15.81.197 with SMTP id x45mr55095584eey.9.1368917807631; Sat, 18 May 2013 15:56:47 -0700 (PDT) Received: from flatron.tomeq (87-207-52-162.dynamic.chello.pl. [87.207.52.162]) by mx.google.com with ESMTPSA id w43sm28243842eeg.14.2013.05.18.15.56.45 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 18 May 2013 15:56:46 -0700 (PDT) From: Tomasz Figa To: devicetree-discuss@lists.ozlabs.org Subject: [PATCH] of: irq: Pass trigger type in IRQ resource flags Date: Sun, 19 May 2013 00:56:30 +0200 Message-Id: <1368917790-23770-1-git-send-email-tomasz.figa@gmail.com> X-Mailer: git-send-email 1.8.2.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130518_185709_834744_A26D61E9 X-CRM114-Status: UNSURE ( 9.41 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (tomasz.figa[at]gmail.com) -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [74.125.83.49 listed in list.dnswl.org] -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 0.0 T_FILL_THIS_FORM_SHORT Fill in a short form with personal information Cc: Grant Likely , Tomasz Figa , Rob Herring , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.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: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Some drivers might rely on availability of trigger flags in IRQ resource, for example to configure the hardware for particular interrupt type. However current code creating IRQ resources from data in device tree does not configure trigger flags in resulting resources. This patch solves the problem, based on the fact that irq_of_parse_and_map() configures the trigger based on DT interrupt specifier, IRQD_TRIGGER_* flags are consistent with IORESOURCE_IRQ_*, and we can get trigger type by calling irqd_get_trigger_type() after mapping the interrupt. Signed-off-by: Tomasz Figa --- drivers/of/irq.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/of/irq.c b/drivers/of/irq.c index a3c1c5a..79a7a26 100644 --- a/drivers/of/irq.c +++ b/drivers/of/irq.c @@ -355,6 +355,16 @@ int of_irq_to_resource(struct device_node *dev, int index, struct resource *r) r->start = r->end = irq; r->flags = IORESOURCE_IRQ; r->name = name ? name : dev->full_name; + + /* + * Some drivers might rely on availability of trigger flags + * in IRQ resource. Since irq_of_parse_and_map() configures the + * trigger based on interrupt specifier and IRQD_TRIGGER_* + * flags are consistent with IORESOURCE_IRQ_*, we can get + * trigger type that was just set and pass it through resource + * flags as well. + */ + r->flags |= irqd_get_trigger_type(irq_get_irq_data(irq)); } return irq;