Re: [PATCH 07/12] irqdomain: Make ops->map hook optional

From: Benjamin Herrenschmidt
Date: Sat Jun 16 2012 - 02:00:14 EST


On Fri, 2012-06-15 at 23:01 -0600, Grant Likely wrote:
> There isn't a really compelling reason to force ->map to be populated,
> so allow it to be left unset.
>
> Signed-off-by: Grant Likely <grant.likely@xxxxxxxxxxxx>
> Cc: Paul Mundt <lethal@xxxxxxxxxxxx>
Acked-by: Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx>
> Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> Cc: Rob Herring <rob.herring@xxxxxxxxxxx>
> ---
> kernel/irq/irqdomain.c | 14 ++++----------
> 1 file changed, 4 insertions(+), 10 deletions(-)
>
> diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
> index 00c383b..e88a7b0 100644
> --- a/kernel/irq/irqdomain.c
> +++ b/kernel/irq/irqdomain.c
> @@ -205,7 +205,8 @@ struct irq_domain *irq_domain_add_legacy(struct device_node *of_node,
> * one can then use irq_create_mapping() to
> * explicitly change them
> */
> - ops->map(domain, irq, hwirq);
> + if (ops->map)
> + ops->map(domain, irq, hwirq);
>
> /* Clear norequest flags */
> irq_clear_status_flags(irq, IRQ_NOREQUEST);
> @@ -402,8 +403,8 @@ int irq_domain_associate_many(struct irq_domain *domain, unsigned int irq_base,
>
> irq_data->hwirq = hwirq;
> irq_data->domain = domain;
> - if (domain->ops->map(domain, virq, hwirq)) {
> - pr_debug("irq-%i==>hwirq-0x%lx mapping failed\n", virq, hwirq);
> + if (domain->ops->map && domain->ops->map(domain, virq, hwirq)) {
> + pr_err("irq-%i==>hwirq-0x%lx mapping failed\n", virq, hwirq);
> irq_data->domain = NULL;
> irq_data->hwirq = 0;
> goto err_unmap;
> @@ -783,12 +784,6 @@ static int __init irq_debugfs_init(void)
> __initcall(irq_debugfs_init);
> #endif /* CONFIG_IRQ_DOMAIN_DEBUG */
>
> -static int irq_domain_simple_map(struct irq_domain *d, unsigned int irq,
> - irq_hw_number_t hwirq)
> -{
> - return 0;
> -}
> -
> /**
> * irq_domain_xlate_onecell() - Generic xlate for direct one cell bindings
> *
> @@ -851,7 +846,6 @@ int irq_domain_xlate_onetwocell(struct irq_domain *d,
> EXPORT_SYMBOL_GPL(irq_domain_xlate_onetwocell);
>
> const struct irq_domain_ops irq_domain_simple_ops = {
> - .map = irq_domain_simple_map,
> .xlate = irq_domain_xlate_onetwocell,
> };
> EXPORT_SYMBOL_GPL(irq_domain_simple_ops);


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/