From: Marc Zyngier <marc.zyngier@arm.com>
To: Thomas Gleixner <tglx@linutronix.de>,
Jiang Liu <jiang.liu@linux.intel.com>,
Jason Cooper <jason@lakedaemon.net>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>,
Mark Rutland <mark.rutland@arm.com>,
Rob Herring <robh+dt@kernel.org>,
Frank Rowand <frowand.list@gmail.com>
Cc: linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
Tomasz Nowicki <tomasz.nowicki@linaro.org>,
Hanjun Guo <hanjun.guo@linaro.org>,
Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>,
Graeme Gregory <graeme@xora.org.uk>,
Jake Oshins <jakeo@microsoft.com>
Subject: [PATCH v4 3/9] genirq/irqdomain: Add a fwnode_handle allocator
Date: Mon, 28 Sep 2015 17:42:56 +0100 [thread overview]
Message-ID: <1443458582-7497-4-git-send-email-marc.zyngier@arm.com> (raw)
In-Reply-To: <1443458582-7497-1-git-send-email-marc.zyngier@arm.com>
In order to be able to reference an irqdomain from ACPI, we need
to be able to create an identifier, which is a struct device_node.
This device node does't really fit the ACPI infrastructure, so
we cunningly hide it by returning the contained fwnode_handle.
This will help a (still hypothetical) further migration of
irqdomain from device_node to fwnode_handle.
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
include/linux/irqdomain.h | 2 ++
kernel/irq/irqdomain.c | 30 ++++++++++++++++++++++++++++++
2 files changed, 32 insertions(+)
diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
index d3ca792..3193c61 100644
--- a/include/linux/irqdomain.h
+++ b/include/linux/irqdomain.h
@@ -162,6 +162,8 @@ enum {
};
#ifdef CONFIG_IRQ_DOMAIN
+struct fwnode_handle *irq_domain_alloc_fwnode(void *data);
+void irq_domain_free_fwnode(struct fwnode_handle *fwnode);
struct irq_domain *__irq_domain_add(struct device_node *of_node, int size,
irq_hw_number_t hwirq_max, int direct_max,
const struct irq_domain_ops *ops,
diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
index e5c1e4c..5e7214a 100644
--- a/kernel/irq/irqdomain.c
+++ b/kernel/irq/irqdomain.c
@@ -29,6 +29,36 @@ static int irq_domain_alloc_descs(int virq, unsigned int nr_irqs,
static void irq_domain_check_hierarchy(struct irq_domain *domain);
/**
+ * irq_domain_alloc_fwnode - Allocate a OF-backed fwnode_handle suitable for
+ * identifying an irq domain
+ * @data: optional user-provided data
+ *
+ * Allocate a struct device_node, and return a poiner to the embedded
+ * fwnode_handle (or NULL on failure).
+ */
+struct fwnode_handle *irq_domain_alloc_fwnode(void *data)
+{
+ struct device_node *of_node;
+
+ of_node = of_node_alloc("irqdomain@%p", data);
+ if (!of_node)
+ return NULL;
+
+ of_node->data = data;
+ return &of_node->fwnode;
+}
+
+/**
+ * irq_domain_free_fwnode - Free a OF-backed fwnode_handle
+ *
+ * Free a fwnode_handle allocated with irq_domain_alloc_fwnode.
+ */
+void irq_domain_free_fwnode(struct fwnode_handle *fwnode)
+{
+ of_node_put(to_of_node(fwnode));
+}
+
+/**
* __irq_domain_add() - Allocate a new irq_domain data structure
* @of_node: optional device-tree node of the interrupt controller
* @size: Size of linear map; 0 for radix mapping only
--
2.1.4
next prev parent reply other threads:[~2015-09-28 16:42 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-28 16:42 [PATCH v4 0/9] Making the generic ACPI GSI layer irqdomain aware Marc Zyngier
2015-09-28 16:42 ` [PATCH v4 1/9] drivers/of: Introduce of_node_alloc Marc Zyngier
2015-09-28 22:50 ` Frank Rowand
[not found] ` <5609C43E.1040106-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-09-29 8:01 ` Marc Zyngier
2015-09-28 16:42 ` [PATCH v4 2/9] genirq/irqdomain: Add irq_create_acpi_mapping Marc Zyngier
2015-09-28 16:42 ` Marc Zyngier [this message]
2015-09-28 16:42 ` [PATCH v4 4/9] acpi/gsi: Always perform an irq domain lookup Marc Zyngier
2015-09-28 16:42 ` [PATCH v4 5/9] acpi/gsi: Add acpi_set_irq_model to initialize the GSI layer Marc Zyngier
2015-09-28 16:42 ` [PATCH v4 6/9] acpi/gsi: Select OF_DYNAMIC when ACPI_GENERIC_GSI is selected Marc Zyngier
2015-09-28 16:43 ` [PATCH v4 7/9] irqchip/GIC: Get rid of gic_init_bases() Marc Zyngier
2015-09-28 16:43 ` [PATCH v4 8/9] irqchip/GIC: Switch ACPI support to stacked domains Marc Zyngier
2015-09-28 16:43 ` [PATCH v4 9/9] acpi/gsi: Cleanup acpi_register_gsi Marc Zyngier
[not found] ` <1443458582-7497-1-git-send-email-marc.zyngier-5wv7dgnIgG8@public.gmane.org>
2015-09-29 17:11 ` [PATCH v4 0/9] Making the generic ACPI GSI layer irqdomain aware Rob Herring
2015-09-29 17:17 ` Marc Zyngier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1443458582-7497-4-git-send-email-marc.zyngier@arm.com \
--to=marc.zyngier@arm.com \
--cc=Suravee.Suthikulpanit@amd.com \
--cc=devicetree@vger.kernel.org \
--cc=frowand.list@gmail.com \
--cc=graeme@xora.org.uk \
--cc=hanjun.guo@linaro.org \
--cc=jakeo@microsoft.com \
--cc=jason@lakedaemon.net \
--cc=jiang.liu@linux.intel.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=mark.rutland@arm.com \
--cc=rjw@rjwysocki.net \
--cc=robh+dt@kernel.org \
--cc=tglx@linutronix.de \
--cc=tomasz.nowicki@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).