From: Nicolas Ferre <nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
To: Thierry Reding
<thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
Cc: "Tony Lindgren (maintainer:OMAP SUPPORT)"
<tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>,
"Catalin Marinas (commit_signer:9/18=50%)"
<catalin.marinas-5wv7dgnIgG8@public.gmane.org>,
"Daniel Walker (maintainer:ARM/QUALCOMM MSM...)"
<dwalker-zu3NM2574RrQT0dZR+AlfA@public.gmane.org>,
"Russell King (maintainer:ARM PORT, commit_signer:12/18=67%,
commit_signer:1/6=17%)"
<linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org>,
"\"Uwe Kleine-König (commit_signer:2/5=40%)\""
<u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>,
"David Brown (maintainer:ARM/QUALCOMM MSM...)"
<davidb-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>,
"open list:ARM/QUALCOMM MSM..."
<linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
"Rob Herring (commit_signer:3/6=50%)"
<rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>,
"Barry Song (maintainer:ARM/CSR SIRFPRIMA...)"
<baohua.song-kQvG35nSl+M@public.gmane.org>,
"Thomas Gleixner (maintainer:IRQ SUBSYSTEM,
commit_signer:2/18=11%,
commit_signer:3/6=50%)"
<tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
Subject: Re: [PATCH] irqdomain: Initialize number of IRQs for simple domains
Date: Fri, 06 Jan 2012 15:36:37 +0100 [thread overview]
Message-ID: <4F0706F5.6010509@atmel.com> (raw)
In-Reply-To: <1325860112-22051-1-git-send-email-thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
On 01/06/2012 03:28 PM, Thierry Reding :
> The irq_domain_add() function needs the number of interrupts in the
> domain to properly initialize them. In addition the allocated domain
> is now returned by the irq_domain_{add,generate}_simple() helpers.
>
> Signed-off-by: Thierry Reding <thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
Hi Thierry,
Good to see this patch ;-)
Thanks for having done this modification.
For AT91 and irqdomain (as far as I can tell)
Acked-by: Nicolas Ferre <nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
Best regards,
> ---
> arch/arm/mach-at91/board-dt.c | 6 +++++-
> arch/arm/mach-imx/imx51-dt.c | 13 +++++++++++--
> arch/arm/mach-imx/imx53-dt.c | 13 +++++++++++--
> arch/arm/mach-imx/mach-imx6q.c | 4 +++-
> arch/arm/mach-msm/board-msm8x60.c | 7 +++++--
> arch/arm/mach-omap2/board-generic.c | 7 +++++--
> arch/arm/mach-prima2/irq.c | 4 +++-
> arch/arm/mach-versatile/core.c | 10 ++++++++--
> arch/arm/plat-mxc/include/mach/irqs.h | 1 +
> arch/arm/plat-mxc/tzic.c | 2 --
> include/linux/irqdomain.h | 27 ++++++++++++++++++++++-----
> kernel/irq/irqdomain.c | 30 +++++++++++++++++++-----------
> 12 files changed, 93 insertions(+), 31 deletions(-)
>
> diff --git a/arch/arm/mach-at91/board-dt.c b/arch/arm/mach-at91/board-dt.c
> index bb6b434..12f003d 100644
> --- a/arch/arm/mach-at91/board-dt.c
> +++ b/arch/arm/mach-at91/board-dt.c
> @@ -95,7 +95,11 @@ static const struct of_device_id aic_of_match[] __initconst = {
>
> static void __init at91_dt_init_irq(void)
> {
> - irq_domain_generate_simple(aic_of_match, 0xfffff000, 0);
> + struct irq_domain *domain;
> +
> + domain = irq_domain_generate_simple(aic_of_match, 0xfffff000, 0,
> + NR_AIC_IRQS);
> + WARN_ON(IS_ERR(domain));
> at91_init_irq_default();
> }
>
> diff --git a/arch/arm/mach-imx/imx51-dt.c b/arch/arm/mach-imx/imx51-dt.c
> index e6bad17..72bf94c 100644
> --- a/arch/arm/mach-imx/imx51-dt.c
> +++ b/arch/arm/mach-imx/imx51-dt.c
> @@ -47,7 +47,12 @@ static const struct of_dev_auxdata imx51_auxdata_lookup[] __initconst = {
> static int __init imx51_tzic_add_irq_domain(struct device_node *np,
> struct device_node *interrupt_parent)
> {
> - irq_domain_add_simple(np, 0);
> + struct irq_domain *domain;
> +
> + domain = irq_domain_add_simple(np, 0, TZIC_NUM_IRQS);
> + if (IS_ERR(domain))
> + return PTR_ERR(domain);
> +
> return 0;
> }
>
> @@ -55,9 +60,13 @@ static int __init imx51_gpio_add_irq_domain(struct device_node *np,
> struct device_node *interrupt_parent)
> {
> static int gpio_irq_base = MXC_GPIO_IRQ_START + ARCH_NR_GPIOS;
> + struct irq_domain *domain;
>
> gpio_irq_base -= 32;
> - irq_domain_add_simple(np, gpio_irq_base);
> +
> + domain = irq_domain_add_simple(np, gpio_irq_base, 32);
> + if (IS_ERR(domain))
> + return PTR_ERR(domain);
>
> return 0;
> }
> diff --git a/arch/arm/mach-imx/imx53-dt.c b/arch/arm/mach-imx/imx53-dt.c
> index 05ebb3e..ccae620 100644
> --- a/arch/arm/mach-imx/imx53-dt.c
> +++ b/arch/arm/mach-imx/imx53-dt.c
> @@ -51,7 +51,12 @@ static const struct of_dev_auxdata imx53_auxdata_lookup[] __initconst = {
> static int __init imx53_tzic_add_irq_domain(struct device_node *np,
> struct device_node *interrupt_parent)
> {
> - irq_domain_add_simple(np, 0);
> + struct irq_domain *domain;
> +
> + domain = irq_domain_add_simple(np, 0, TZIC_NUM_IRQS);
> + if (IS_ERR(domain))
> + return PTR_ERR(domain);
> +
> return 0;
> }
>
> @@ -59,9 +64,13 @@ static int __init imx53_gpio_add_irq_domain(struct device_node *np,
> struct device_node *interrupt_parent)
> {
> static int gpio_irq_base = MXC_GPIO_IRQ_START + ARCH_NR_GPIOS;
> + struct irq_domain *domain;
>
> gpio_irq_base -= 32;
> - irq_domain_add_simple(np, gpio_irq_base);
> +
> + domain = irq_domain_add_simple(np, gpio_irq_base, 32);
> + if (IS_ERR(domain))
> + return PTR_ERR(domain);
>
> return 0;
> }
> diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c
> index c257281..9ed7812 100644
> --- a/arch/arm/mach-imx/mach-imx6q.c
> +++ b/arch/arm/mach-imx/mach-imx6q.c
> @@ -95,9 +95,11 @@ static int __init imx6q_gpio_add_irq_domain(struct device_node *np,
> struct device_node *interrupt_parent)
> {
> static int gpio_irq_base = MXC_GPIO_IRQ_START + ARCH_NR_GPIOS;
> + struct irq_domain *domain;
>
> gpio_irq_base -= 32;
> - irq_domain_add_simple(np, gpio_irq_base);
> + domain = irq_domain_add_simple(np, gpio_irq_base, 32);
> + WARN_ON(IS_ERR(domain));
>
> return 0;
> }
> diff --git a/arch/arm/mach-msm/board-msm8x60.c b/arch/arm/mach-msm/board-msm8x60.c
> index 0a11342..a50c7e2 100644
> --- a/arch/arm/mach-msm/board-msm8x60.c
> +++ b/arch/arm/mach-msm/board-msm8x60.c
> @@ -84,8 +84,11 @@ static void __init msm8x60_dt_init(void)
>
> node = of_find_matching_node_by_address(NULL, msm_dt_gic_match,
> MSM8X60_QGIC_DIST_PHYS);
> - if (node)
> - irq_domain_add_simple(node, GIC_SPI_START);
> + if (node) {
> + struct irq_domain *domain = irq_domain_add_simple(node,
> + GIC_SPI_START, NR_MSM_IRQS);
> + WARN_ON(IS_ERR(domain));
> + }
>
> if (of_machine_is_compatible("qcom,msm8660-surf")) {
> printk(KERN_INFO "Init surf UART registers\n");
> diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c
> index d587560..bf67781 100644
> --- a/arch/arm/mach-omap2/board-generic.c
> +++ b/arch/arm/mach-omap2/board-generic.c
> @@ -66,8 +66,11 @@ static struct of_device_id intc_match[] __initdata = {
> static void __init omap_generic_init(void)
> {
> struct device_node *node = of_find_matching_node(NULL, intc_match);
> - if (node)
> - irq_domain_add_simple(node, 0);
> + if (node) {
> + struct irq_domain *domain;
> + domain = irq_domain_add_simple(node, 0, INTCPS_NR_IRQS);
> + WARN_ON(IS_ERR(domain));
> + }
>
> omap_sdrc_init(NULL, NULL);
>
> diff --git a/arch/arm/mach-prima2/irq.c b/arch/arm/mach-prima2/irq.c
> index d93ceef..d3c5136 100644
> --- a/arch/arm/mach-prima2/irq.c
> +++ b/arch/arm/mach-prima2/irq.c
> @@ -58,6 +58,7 @@ static struct of_device_id intc_ids[] = {
>
> void __init sirfsoc_of_irq_init(void)
> {
> + struct irq_domain *domain;
> struct device_node *np;
>
> np = of_find_matching_node(NULL, intc_ids);
> @@ -68,7 +69,8 @@ void __init sirfsoc_of_irq_init(void)
> if (!sirfsoc_intc_base)
> panic("unable to map intc cpu registers\n");
>
> - irq_domain_add_simple(np, 0);
> + domain = irq_domain_add_simple(np, 0, NR_IRQS);
> + WARN_ON(IS_ERR(domain));
>
> of_node_put(np);
>
> diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
> index 02b7b93..6c40be4 100644
> --- a/arch/arm/mach-versatile/core.c
> +++ b/arch/arm/mach-versatile/core.c
> @@ -98,13 +98,19 @@ static const struct of_device_id sic_of_match[] __initconst = {
>
> void __init versatile_init_irq(void)
> {
> + struct irq_domain *domain;
> +
> vic_init(VA_VIC_BASE, IRQ_VIC_START, ~0, 0);
> - irq_domain_generate_simple(vic_of_match, VERSATILE_VIC_BASE, IRQ_VIC_START);
> + domain = irq_domain_generate_simple(vic_of_match, VERSATILE_VIC_BASE,
> + IRQ_VIC_START, IRQ_VIC_END - IRQ_VIC_START + 1);
> + WARN_ON(IS_ERR(domain));
>
> writel(~0, VA_SIC_BASE + SIC_IRQ_ENABLE_CLEAR);
>
> fpga_irq_init(IRQ_VICSOURCE31, ~PIC_MASK, &sic_irq);
> - irq_domain_generate_simple(sic_of_match, VERSATILE_SIC_BASE, IRQ_SIC_START);
> + domain = irq_domain_generate_simple(sic_of_match, VERSATILE_SIC_BASE,
> + IRQ_SIC_START, IRQ_SIC_END - IRQ_SIC_START + 1);
> + WARN_ON(IS_ERR(domain));
>
> /*
> * Interrupts on secondary controller from 0 to 8 are routed to
> diff --git a/arch/arm/plat-mxc/include/mach/irqs.h b/arch/arm/plat-mxc/include/mach/irqs.h
> index fd9efb0..2fda5aa 100644
> --- a/arch/arm/plat-mxc/include/mach/irqs.h
> +++ b/arch/arm/plat-mxc/include/mach/irqs.h
> @@ -54,6 +54,7 @@
> /* REVISIT: Add IPU irqs on IMX51 */
>
> #define NR_IRQS (MXC_IPU_IRQ_START + MX3_IPU_IRQS)
> +#define TZIC_NUM_IRQS 128
>
> extern int imx_irq_set_priority(unsigned char irq, unsigned char prio);
>
> diff --git a/arch/arm/plat-mxc/tzic.c b/arch/arm/plat-mxc/tzic.c
> index 98308ec..98b23b8 100644
> --- a/arch/arm/plat-mxc/tzic.c
> +++ b/arch/arm/plat-mxc/tzic.c
> @@ -50,8 +50,6 @@
>
> void __iomem *tzic_base; /* Used as irq controller base in entry-macro.S */
>
> -#define TZIC_NUM_IRQS 128
> -
> #ifdef CONFIG_FIQ
> static int tzic_set_irq_fiq(unsigned int irq, unsigned int type)
> {
> diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
> index bd4272b..1538d4c 100644
> --- a/include/linux/irqdomain.h
> +++ b/include/linux/irqdomain.h
> @@ -15,6 +15,7 @@
> #ifndef _LINUX_IRQDOMAIN_H
> #define _LINUX_IRQDOMAIN_H
>
> +#include <linux/err.h>
> #include <linux/irq.h>
> #include <linux/mod_devicetable.h>
>
> @@ -96,12 +97,28 @@ extern struct irq_domain_ops irq_domain_simple_ops;
> #endif /* CONFIG_IRQ_DOMAIN */
>
> #if defined(CONFIG_IRQ_DOMAIN) && defined(CONFIG_OF_IRQ)
> -extern void irq_domain_add_simple(struct device_node *controller, int irq_base);
> -extern void irq_domain_generate_simple(const struct of_device_id *match,
> - u64 phys_base, unsigned int irq_start);
> +extern struct irq_domain *irq_domain_add_simple(struct device_node *controller,
> + unsigned int irq_base,
> + unsigned int nr_irq);
> +extern struct irq_domain *irq_domain_generate_simple(const struct of_device_id *match,
> + u64 phys_base,
> + unsigned int irq_start,
> + unsigned int nr_irq);
> #else /* CONFIG_IRQ_DOMAIN && CONFIG_OF_IRQ */
> -static inline void irq_domain_generate_simple(const struct of_device_id *match,
> - u64 phys_base, unsigned int irq_start) { }
> +static inline struct irq_domain *irq_domain_add_simple(struct device_node *controller,
> + int irq_base,
> + unsigned int nr_irq)
> +{
> + return ERR_PTR(-ENOSYS);
> +}
> +
> +static inline struct irq_domain *irq_domain_generate_simple(const struct of_device_id *match,
> + u64 phys_base,
> + unsigned int irq_start,
> + unsigned int nr_irq)
> +{
> + return ERR_PTR(-ENOSYS);
> +}
> #endif /* CONFIG_IRQ_DOMAIN && CONFIG_OF_IRQ */
>
> #endif /* _LINUX_IRQDOMAIN_H */
> diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
> index 1f9e265..807c44b 100644
> --- a/kernel/irq/irqdomain.c
> +++ b/kernel/irq/irqdomain.c
> @@ -147,36 +147,44 @@ int irq_domain_simple_dt_translate(struct irq_domain *d,
> }
>
> /**
> - * irq_domain_create_simple() - Set up a 'simple' translation range
> + * irq_domain_add_simple() - Set up a 'simple' translation range
> */
> -void irq_domain_add_simple(struct device_node *controller, int irq_base)
> +struct irq_domain *irq_domain_add_simple(struct device_node *controller,
> + unsigned int irq_base,
> + unsigned int nr_irq)
> {
> struct irq_domain *domain;
>
> domain = kzalloc(sizeof(*domain), GFP_KERNEL);
> - if (!domain) {
> - WARN_ON(1);
> - return;
> - }
> + if (!domain)
> + return ERR_PTR(-ENOMEM);
>
> domain->irq_base = irq_base;
> + domain->nr_irq = nr_irq;
> domain->of_node = of_node_get(controller);
> domain->ops = &irq_domain_simple_ops;
> irq_domain_add(domain);
> +
> + return domain;
> }
> EXPORT_SYMBOL_GPL(irq_domain_add_simple);
>
> -void irq_domain_generate_simple(const struct of_device_id *match,
> - u64 phys_base, unsigned int irq_start)
> +struct irq_domain *irq_domain_generate_simple(const struct of_device_id *match,
> + u64 phys_base,
> + unsigned int irq_start,
> + unsigned int nr_irq)
> {
> + struct irq_domain *domain = ERR_PTR(-ENODEV);
> struct device_node *node;
> - pr_info("looking for phys_base=%llx, irq_start=%i\n",
> - (unsigned long long) phys_base, (int) irq_start);
> + pr_info("looking for phys_base=%llx, irq_start=%u, nr_irq=%u\n",
> + (unsigned long long) phys_base, irq_start, nr_irq);
> node = of_find_matching_node_by_address(NULL, match, phys_base);
> if (node)
> - irq_domain_add_simple(node, irq_start);
> + domain = irq_domain_add_simple(node, irq_start, nr_irq);
> else
> pr_info("no node found\n");
> +
> + return domain;
> }
> EXPORT_SYMBOL_GPL(irq_domain_generate_simple);
> #endif /* CONFIG_OF_IRQ */
--
Nicolas Ferre
WARNING: multiple messages have this Message-ID (diff)
From: nicolas.ferre@atmel.com (Nicolas Ferre)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] irqdomain: Initialize number of IRQs for simple domains
Date: Fri, 06 Jan 2012 15:36:37 +0100 [thread overview]
Message-ID: <4F0706F5.6010509@atmel.com> (raw)
In-Reply-To: <1325860112-22051-1-git-send-email-thierry.reding@avionic-design.de>
On 01/06/2012 03:28 PM, Thierry Reding :
> The irq_domain_add() function needs the number of interrupts in the
> domain to properly initialize them. In addition the allocated domain
> is now returned by the irq_domain_{add,generate}_simple() helpers.
>
> Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Hi Thierry,
Good to see this patch ;-)
Thanks for having done this modification.
For AT91 and irqdomain (as far as I can tell)
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Best regards,
> ---
> arch/arm/mach-at91/board-dt.c | 6 +++++-
> arch/arm/mach-imx/imx51-dt.c | 13 +++++++++++--
> arch/arm/mach-imx/imx53-dt.c | 13 +++++++++++--
> arch/arm/mach-imx/mach-imx6q.c | 4 +++-
> arch/arm/mach-msm/board-msm8x60.c | 7 +++++--
> arch/arm/mach-omap2/board-generic.c | 7 +++++--
> arch/arm/mach-prima2/irq.c | 4 +++-
> arch/arm/mach-versatile/core.c | 10 ++++++++--
> arch/arm/plat-mxc/include/mach/irqs.h | 1 +
> arch/arm/plat-mxc/tzic.c | 2 --
> include/linux/irqdomain.h | 27 ++++++++++++++++++++++-----
> kernel/irq/irqdomain.c | 30 +++++++++++++++++++-----------
> 12 files changed, 93 insertions(+), 31 deletions(-)
>
> diff --git a/arch/arm/mach-at91/board-dt.c b/arch/arm/mach-at91/board-dt.c
> index bb6b434..12f003d 100644
> --- a/arch/arm/mach-at91/board-dt.c
> +++ b/arch/arm/mach-at91/board-dt.c
> @@ -95,7 +95,11 @@ static const struct of_device_id aic_of_match[] __initconst = {
>
> static void __init at91_dt_init_irq(void)
> {
> - irq_domain_generate_simple(aic_of_match, 0xfffff000, 0);
> + struct irq_domain *domain;
> +
> + domain = irq_domain_generate_simple(aic_of_match, 0xfffff000, 0,
> + NR_AIC_IRQS);
> + WARN_ON(IS_ERR(domain));
> at91_init_irq_default();
> }
>
> diff --git a/arch/arm/mach-imx/imx51-dt.c b/arch/arm/mach-imx/imx51-dt.c
> index e6bad17..72bf94c 100644
> --- a/arch/arm/mach-imx/imx51-dt.c
> +++ b/arch/arm/mach-imx/imx51-dt.c
> @@ -47,7 +47,12 @@ static const struct of_dev_auxdata imx51_auxdata_lookup[] __initconst = {
> static int __init imx51_tzic_add_irq_domain(struct device_node *np,
> struct device_node *interrupt_parent)
> {
> - irq_domain_add_simple(np, 0);
> + struct irq_domain *domain;
> +
> + domain = irq_domain_add_simple(np, 0, TZIC_NUM_IRQS);
> + if (IS_ERR(domain))
> + return PTR_ERR(domain);
> +
> return 0;
> }
>
> @@ -55,9 +60,13 @@ static int __init imx51_gpio_add_irq_domain(struct device_node *np,
> struct device_node *interrupt_parent)
> {
> static int gpio_irq_base = MXC_GPIO_IRQ_START + ARCH_NR_GPIOS;
> + struct irq_domain *domain;
>
> gpio_irq_base -= 32;
> - irq_domain_add_simple(np, gpio_irq_base);
> +
> + domain = irq_domain_add_simple(np, gpio_irq_base, 32);
> + if (IS_ERR(domain))
> + return PTR_ERR(domain);
>
> return 0;
> }
> diff --git a/arch/arm/mach-imx/imx53-dt.c b/arch/arm/mach-imx/imx53-dt.c
> index 05ebb3e..ccae620 100644
> --- a/arch/arm/mach-imx/imx53-dt.c
> +++ b/arch/arm/mach-imx/imx53-dt.c
> @@ -51,7 +51,12 @@ static const struct of_dev_auxdata imx53_auxdata_lookup[] __initconst = {
> static int __init imx53_tzic_add_irq_domain(struct device_node *np,
> struct device_node *interrupt_parent)
> {
> - irq_domain_add_simple(np, 0);
> + struct irq_domain *domain;
> +
> + domain = irq_domain_add_simple(np, 0, TZIC_NUM_IRQS);
> + if (IS_ERR(domain))
> + return PTR_ERR(domain);
> +
> return 0;
> }
>
> @@ -59,9 +64,13 @@ static int __init imx53_gpio_add_irq_domain(struct device_node *np,
> struct device_node *interrupt_parent)
> {
> static int gpio_irq_base = MXC_GPIO_IRQ_START + ARCH_NR_GPIOS;
> + struct irq_domain *domain;
>
> gpio_irq_base -= 32;
> - irq_domain_add_simple(np, gpio_irq_base);
> +
> + domain = irq_domain_add_simple(np, gpio_irq_base, 32);
> + if (IS_ERR(domain))
> + return PTR_ERR(domain);
>
> return 0;
> }
> diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c
> index c257281..9ed7812 100644
> --- a/arch/arm/mach-imx/mach-imx6q.c
> +++ b/arch/arm/mach-imx/mach-imx6q.c
> @@ -95,9 +95,11 @@ static int __init imx6q_gpio_add_irq_domain(struct device_node *np,
> struct device_node *interrupt_parent)
> {
> static int gpio_irq_base = MXC_GPIO_IRQ_START + ARCH_NR_GPIOS;
> + struct irq_domain *domain;
>
> gpio_irq_base -= 32;
> - irq_domain_add_simple(np, gpio_irq_base);
> + domain = irq_domain_add_simple(np, gpio_irq_base, 32);
> + WARN_ON(IS_ERR(domain));
>
> return 0;
> }
> diff --git a/arch/arm/mach-msm/board-msm8x60.c b/arch/arm/mach-msm/board-msm8x60.c
> index 0a11342..a50c7e2 100644
> --- a/arch/arm/mach-msm/board-msm8x60.c
> +++ b/arch/arm/mach-msm/board-msm8x60.c
> @@ -84,8 +84,11 @@ static void __init msm8x60_dt_init(void)
>
> node = of_find_matching_node_by_address(NULL, msm_dt_gic_match,
> MSM8X60_QGIC_DIST_PHYS);
> - if (node)
> - irq_domain_add_simple(node, GIC_SPI_START);
> + if (node) {
> + struct irq_domain *domain = irq_domain_add_simple(node,
> + GIC_SPI_START, NR_MSM_IRQS);
> + WARN_ON(IS_ERR(domain));
> + }
>
> if (of_machine_is_compatible("qcom,msm8660-surf")) {
> printk(KERN_INFO "Init surf UART registers\n");
> diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c
> index d587560..bf67781 100644
> --- a/arch/arm/mach-omap2/board-generic.c
> +++ b/arch/arm/mach-omap2/board-generic.c
> @@ -66,8 +66,11 @@ static struct of_device_id intc_match[] __initdata = {
> static void __init omap_generic_init(void)
> {
> struct device_node *node = of_find_matching_node(NULL, intc_match);
> - if (node)
> - irq_domain_add_simple(node, 0);
> + if (node) {
> + struct irq_domain *domain;
> + domain = irq_domain_add_simple(node, 0, INTCPS_NR_IRQS);
> + WARN_ON(IS_ERR(domain));
> + }
>
> omap_sdrc_init(NULL, NULL);
>
> diff --git a/arch/arm/mach-prima2/irq.c b/arch/arm/mach-prima2/irq.c
> index d93ceef..d3c5136 100644
> --- a/arch/arm/mach-prima2/irq.c
> +++ b/arch/arm/mach-prima2/irq.c
> @@ -58,6 +58,7 @@ static struct of_device_id intc_ids[] = {
>
> void __init sirfsoc_of_irq_init(void)
> {
> + struct irq_domain *domain;
> struct device_node *np;
>
> np = of_find_matching_node(NULL, intc_ids);
> @@ -68,7 +69,8 @@ void __init sirfsoc_of_irq_init(void)
> if (!sirfsoc_intc_base)
> panic("unable to map intc cpu registers\n");
>
> - irq_domain_add_simple(np, 0);
> + domain = irq_domain_add_simple(np, 0, NR_IRQS);
> + WARN_ON(IS_ERR(domain));
>
> of_node_put(np);
>
> diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
> index 02b7b93..6c40be4 100644
> --- a/arch/arm/mach-versatile/core.c
> +++ b/arch/arm/mach-versatile/core.c
> @@ -98,13 +98,19 @@ static const struct of_device_id sic_of_match[] __initconst = {
>
> void __init versatile_init_irq(void)
> {
> + struct irq_domain *domain;
> +
> vic_init(VA_VIC_BASE, IRQ_VIC_START, ~0, 0);
> - irq_domain_generate_simple(vic_of_match, VERSATILE_VIC_BASE, IRQ_VIC_START);
> + domain = irq_domain_generate_simple(vic_of_match, VERSATILE_VIC_BASE,
> + IRQ_VIC_START, IRQ_VIC_END - IRQ_VIC_START + 1);
> + WARN_ON(IS_ERR(domain));
>
> writel(~0, VA_SIC_BASE + SIC_IRQ_ENABLE_CLEAR);
>
> fpga_irq_init(IRQ_VICSOURCE31, ~PIC_MASK, &sic_irq);
> - irq_domain_generate_simple(sic_of_match, VERSATILE_SIC_BASE, IRQ_SIC_START);
> + domain = irq_domain_generate_simple(sic_of_match, VERSATILE_SIC_BASE,
> + IRQ_SIC_START, IRQ_SIC_END - IRQ_SIC_START + 1);
> + WARN_ON(IS_ERR(domain));
>
> /*
> * Interrupts on secondary controller from 0 to 8 are routed to
> diff --git a/arch/arm/plat-mxc/include/mach/irqs.h b/arch/arm/plat-mxc/include/mach/irqs.h
> index fd9efb0..2fda5aa 100644
> --- a/arch/arm/plat-mxc/include/mach/irqs.h
> +++ b/arch/arm/plat-mxc/include/mach/irqs.h
> @@ -54,6 +54,7 @@
> /* REVISIT: Add IPU irqs on IMX51 */
>
> #define NR_IRQS (MXC_IPU_IRQ_START + MX3_IPU_IRQS)
> +#define TZIC_NUM_IRQS 128
>
> extern int imx_irq_set_priority(unsigned char irq, unsigned char prio);
>
> diff --git a/arch/arm/plat-mxc/tzic.c b/arch/arm/plat-mxc/tzic.c
> index 98308ec..98b23b8 100644
> --- a/arch/arm/plat-mxc/tzic.c
> +++ b/arch/arm/plat-mxc/tzic.c
> @@ -50,8 +50,6 @@
>
> void __iomem *tzic_base; /* Used as irq controller base in entry-macro.S */
>
> -#define TZIC_NUM_IRQS 128
> -
> #ifdef CONFIG_FIQ
> static int tzic_set_irq_fiq(unsigned int irq, unsigned int type)
> {
> diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
> index bd4272b..1538d4c 100644
> --- a/include/linux/irqdomain.h
> +++ b/include/linux/irqdomain.h
> @@ -15,6 +15,7 @@
> #ifndef _LINUX_IRQDOMAIN_H
> #define _LINUX_IRQDOMAIN_H
>
> +#include <linux/err.h>
> #include <linux/irq.h>
> #include <linux/mod_devicetable.h>
>
> @@ -96,12 +97,28 @@ extern struct irq_domain_ops irq_domain_simple_ops;
> #endif /* CONFIG_IRQ_DOMAIN */
>
> #if defined(CONFIG_IRQ_DOMAIN) && defined(CONFIG_OF_IRQ)
> -extern void irq_domain_add_simple(struct device_node *controller, int irq_base);
> -extern void irq_domain_generate_simple(const struct of_device_id *match,
> - u64 phys_base, unsigned int irq_start);
> +extern struct irq_domain *irq_domain_add_simple(struct device_node *controller,
> + unsigned int irq_base,
> + unsigned int nr_irq);
> +extern struct irq_domain *irq_domain_generate_simple(const struct of_device_id *match,
> + u64 phys_base,
> + unsigned int irq_start,
> + unsigned int nr_irq);
> #else /* CONFIG_IRQ_DOMAIN && CONFIG_OF_IRQ */
> -static inline void irq_domain_generate_simple(const struct of_device_id *match,
> - u64 phys_base, unsigned int irq_start) { }
> +static inline struct irq_domain *irq_domain_add_simple(struct device_node *controller,
> + int irq_base,
> + unsigned int nr_irq)
> +{
> + return ERR_PTR(-ENOSYS);
> +}
> +
> +static inline struct irq_domain *irq_domain_generate_simple(const struct of_device_id *match,
> + u64 phys_base,
> + unsigned int irq_start,
> + unsigned int nr_irq)
> +{
> + return ERR_PTR(-ENOSYS);
> +}
> #endif /* CONFIG_IRQ_DOMAIN && CONFIG_OF_IRQ */
>
> #endif /* _LINUX_IRQDOMAIN_H */
> diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
> index 1f9e265..807c44b 100644
> --- a/kernel/irq/irqdomain.c
> +++ b/kernel/irq/irqdomain.c
> @@ -147,36 +147,44 @@ int irq_domain_simple_dt_translate(struct irq_domain *d,
> }
>
> /**
> - * irq_domain_create_simple() - Set up a 'simple' translation range
> + * irq_domain_add_simple() - Set up a 'simple' translation range
> */
> -void irq_domain_add_simple(struct device_node *controller, int irq_base)
> +struct irq_domain *irq_domain_add_simple(struct device_node *controller,
> + unsigned int irq_base,
> + unsigned int nr_irq)
> {
> struct irq_domain *domain;
>
> domain = kzalloc(sizeof(*domain), GFP_KERNEL);
> - if (!domain) {
> - WARN_ON(1);
> - return;
> - }
> + if (!domain)
> + return ERR_PTR(-ENOMEM);
>
> domain->irq_base = irq_base;
> + domain->nr_irq = nr_irq;
> domain->of_node = of_node_get(controller);
> domain->ops = &irq_domain_simple_ops;
> irq_domain_add(domain);
> +
> + return domain;
> }
> EXPORT_SYMBOL_GPL(irq_domain_add_simple);
>
> -void irq_domain_generate_simple(const struct of_device_id *match,
> - u64 phys_base, unsigned int irq_start)
> +struct irq_domain *irq_domain_generate_simple(const struct of_device_id *match,
> + u64 phys_base,
> + unsigned int irq_start,
> + unsigned int nr_irq)
> {
> + struct irq_domain *domain = ERR_PTR(-ENODEV);
> struct device_node *node;
> - pr_info("looking for phys_base=%llx, irq_start=%i\n",
> - (unsigned long long) phys_base, (int) irq_start);
> + pr_info("looking for phys_base=%llx, irq_start=%u, nr_irq=%u\n",
> + (unsigned long long) phys_base, irq_start, nr_irq);
> node = of_find_matching_node_by_address(NULL, match, phys_base);
> if (node)
> - irq_domain_add_simple(node, irq_start);
> + domain = irq_domain_add_simple(node, irq_start, nr_irq);
> else
> pr_info("no node found\n");
> +
> + return domain;
> }
> EXPORT_SYMBOL_GPL(irq_domain_generate_simple);
> #endif /* CONFIG_OF_IRQ */
--
Nicolas Ferre
next prev parent reply other threads:[~2012-01-06 14:36 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-06 14:28 [PATCH] irqdomain: Initialize number of IRQs for simple domains Thierry Reding
2012-01-06 14:28 ` Thierry Reding
[not found] ` <1325860112-22051-1-git-send-email-thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
2012-01-06 14:36 ` Nicolas Ferre [this message]
2012-01-06 14:36 ` Nicolas Ferre
2012-01-06 15:04 ` Grant Likely
2012-01-06 15:04 ` Grant Likely
2012-01-06 16:20 ` Thierry Reding
2012-01-06 16:20 ` Thierry Reding
[not found] ` <20120106162016.GB5593-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2012-01-06 21:34 ` Grant Likely
2012-01-06 21:34 ` Grant Likely
[not found] ` <20120106213422.GF7457-e0URQFbLeQY2iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2012-01-07 11:40 ` Thierry Reding
2012-01-07 11:40 ` Thierry Reding
2012-01-06 16:58 ` Cousson, Benoit
2012-01-06 16:58 ` Cousson, Benoit
2012-01-06 16:58 ` Cousson, Benoit
2012-01-09 9:03 ` Thierry Reding
2012-01-09 9:03 ` Thierry Reding
2012-01-09 9:03 ` Thierry Reding
2012-01-07 5:58 ` Shawn Guo
2012-01-07 5:58 ` Shawn Guo
[not found] ` <20120107055817.GG4790-rvtDTF3kK1ictlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
2012-01-07 11:47 ` Thierry Reding
2012-01-07 11:47 ` Thierry Reding
2012-01-06 16:07 ` David Brown
2012-01-06 16:07 ` David Brown
[not found] ` <20120106160744.GA7687-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2012-01-06 16:12 ` Thierry Reding
2012-01-06 16:12 ` Thierry Reding
2012-01-06 16:26 ` Rob Herring
2012-01-06 16:26 ` Rob Herring
[not found] ` <4F0720A9.8070400-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-01-06 18:52 ` David Brown
2012-01-06 18:52 ` David Brown
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=4F0706F5.6010509@atmel.com \
--to=nicolas.ferre-aife0yeh4naavxtiumwx3w@public.gmane.org \
--cc=baohua.song-kQvG35nSl+M@public.gmane.org \
--cc=catalin.marinas-5wv7dgnIgG8@public.gmane.org \
--cc=davidb-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
--cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
--cc=dwalker-zu3NM2574RrQT0dZR+AlfA@public.gmane.org \
--cc=linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org \
--cc=rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org \
--cc=tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org \
--cc=thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org \
--cc=tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org \
--cc=u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.