From patchwork Fri Mar 21 14:46:24 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Jacques Hiblot X-Patchwork-Id: 3874851 Return-Path: X-Original-To: patchwork-linux-arm@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 305C6BF540 for ; Fri, 21 Mar 2014 14:58:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5D1DB2028D for ; Fri, 21 Mar 2014 14:58:01 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4B5822026C for ; Fri, 21 Mar 2014 14:58:00 +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 1WR0tO-0005L0-4I; Fri, 21 Mar 2014 14:57:54 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WR0tH-0000CA-Vo; Fri, 21 Mar 2014 14:57:47 +0000 Received: from mail-wi0-f181.google.com ([209.85.212.181]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WR0tE-0000BL-PC for linux-arm-kernel@lists.infradead.org; Fri, 21 Mar 2014 14:57:45 +0000 Received: by mail-wi0-f181.google.com with SMTP id hm4so592584wib.8 for ; Fri, 21 Mar 2014 07:57:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Z86auhWBzqUfdEQymkN9A4hjupuoZqWwLmGKWPdN5H4=; b=iDf4wQaFTXiLqSXrgUJubYNmdTuOQTS140HAlMYtXA+1Vjap7ZxmlCKZjbpD9Pkehk vnpWQxMpIMjw1yAoNmG+wbaV1swt2TqFlIAR1uPZ2EBpflIiU48eF+HEcxykAm7mxkpT n0Q6TKSCqTb+ceQkjE6yolWcgnjcS5icDvX6pUt4EGDGmSEXlLXtQT+PZm5rfzn8aWAN fYqL72FEVIziq7S3jP0nKbpjZSddrHiBDb33hRveRT10wI2RFQnPVe+rrUrRvGwXgiY+ D97DbGVaMPA+F/ZIrf+IbqEy+aG4Wy7llPwYB4eidv1aKcEb0G2ACvZIc7PrcplA9oKk AONw== X-Received: by 10.180.98.35 with SMTP id ef3mr2982930wib.39.1395413396642; Fri, 21 Mar 2014 07:49:56 -0700 (PDT) Received: from stedf17-labo202.ds.jdsu.net. (4-161.80-90.static-ip.oleane.fr. [90.80.161.4]) by mx.google.com with ESMTPSA id bj3sm13805474wjb.14.2014.03.21.07.49.54 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 21 Mar 2014 07:49:55 -0700 (PDT) From: Jean-Jacques Hiblot To: grant.likely@secretlab.ca Subject: [PATCH v3 1/2] of: irq: Added of_find_irq_domain() to get the domain of an irq Date: Fri, 21 Mar 2014 15:46:24 +0100 Message-Id: <1395413185-29763-2-git-send-email-jjhiblot@traphandler.com> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1395413185-29763-1-git-send-email-jjhiblot@traphandler.com> References: <20140320161118.B7075C4067A@trevor.secretlab.ca> <1395413185-29763-1-git-send-email-jjhiblot@traphandler.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140321_105744_921337_7F240176 X-CRM114-Status: GOOD ( 11.30 ) X-Spam-Score: -2.6 (--) Cc: devicetree@vger.kernel.org, Jean-Jacques Hiblot , gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, robh+dt@kernel.org, gregory.clement@free-electrons.com, 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: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 This functions does the same parsing as irq_of_parse_and_map but instead of doing the mapping, it returns a pointer to the irq domain Signed-off-by: Jean-Jacques Hiblot --- drivers/of/irq.c | 20 ++++++++++++++++++++ include/linux/of_irq.h | 2 ++ 2 files changed, 22 insertions(+) diff --git a/drivers/of/irq.c b/drivers/of/irq.c index 9bcf2cf..7d3184f 100644 --- a/drivers/of/irq.c +++ b/drivers/of/irq.c @@ -46,6 +46,26 @@ unsigned int irq_of_parse_and_map(struct device_node *dev, int index) EXPORT_SYMBOL_GPL(irq_of_parse_and_map); /** + * of_find_irq_domain - Parse the DT and returns a pointer to the irq domain + * @dev: Device node of the device whose interrupt is concerned + * @index: Index of the interrupt to get the domain for + * + * This function is a wrapper that chains of_irq_parse_one() and + * irq_find_host() to make things easier to callers + */ +struct irq_domain *of_find_irq_domain(struct device_node *dev, int index) +{ + int rc; + struct of_phandle_args oirq; + + rc = of_irq_parse_one(dev, index, &oirq); + if (rc) + return ERR_PTR(rc); + + return irq_find_host(oirq.np); +} + +/** * of_irq_find_parent - Given a device node, find its interrupt parent node * @child: pointer to device node * diff --git a/include/linux/of_irq.h b/include/linux/of_irq.h index 3f23b44..600ff0a 100644 --- a/include/linux/of_irq.h +++ b/include/linux/of_irq.h @@ -58,6 +58,8 @@ static inline int of_irq_count(struct device_node *dev) * so declare it here regardless of the CONFIG_OF_IRQ setting. */ extern unsigned int irq_of_parse_and_map(struct device_node *node, int index); +extern struct irq_domain *of_find_irq_domain(struct device_node *dev, + int index); extern struct device_node *of_irq_find_parent(struct device_node *child); #else /* !CONFIG_OF */