]> rtime.felk.cvut.cz Git - linux-imx.git/blobdiff - kernel/irq/irqdomain.c
kernel/irq/irqdomain.c: before use 'irq_data', need check it whether valid.
[linux-imx.git] / kernel / irq / irqdomain.c
index 96f3a1d9c379673db27158e2715fd432ab05ea5b..8c4c8ea6a205c7c67a1d110abf683a01731e46ba 100644 (file)
@@ -191,6 +191,7 @@ struct irq_domain *irq_domain_add_simple(struct device_node *of_node,
        /* A linear domain is the default */
        return irq_domain_add_linear(of_node, size, ops, host_data);
 }
+EXPORT_SYMBOL_GPL(irq_domain_add_simple);
 
 /**
  * irq_domain_add_legacy() - Allocate and register a legacy revmap irq_domain.
@@ -397,11 +398,12 @@ static void irq_domain_disassociate_many(struct irq_domain *domain,
        while (count--) {
                int irq = irq_base + count;
                struct irq_data *irq_data = irq_get_irq_data(irq);
-               irq_hw_number_t hwirq = irq_data->hwirq;
+               irq_hw_number_t hwirq;
 
                if (WARN_ON(!irq_data || irq_data->domain != domain))
                        continue;
 
+               hwirq = irq_data->hwirq;
                irq_set_status_flags(irq, IRQ_NOREQUEST);
 
                /* remove chip and handler */
@@ -462,9 +464,23 @@ int irq_domain_associate_many(struct irq_domain *domain, unsigned int irq_base,
                if (domain->ops->map) {
                        ret = domain->ops->map(domain, virq, hwirq);
                        if (ret != 0) {
-                               pr_err("irq-%i==>hwirq-0x%lx mapping failed: %d\n",
-                                      virq, hwirq, ret);
-                               WARN_ON(1);
+                               /*
+                                * If map() returns -EPERM, this interrupt is protected
+                                * by the firmware or some other service and shall not
+                                * be mapped.
+                                *
+                                * Since on some platforms we blindly try to map everything
+                                * we end up with a log full of backtraces.
+                                *
+                                * So instead, we silently fail on -EPERM, it is the
+                                * responsibility of the PIC driver to display a relevant
+                                * message if needed.
+                                */
+                               if (ret != -EPERM) {
+                                       pr_err("irq-%i==>hwirq-0x%lx mapping failed: %d\n",
+                                              virq, hwirq, ret);
+                                       WARN_ON(1);
+                               }
                                irq_data->domain = NULL;
                                irq_data->hwirq = 0;
                                goto err_unmap;