|
|
@@ -567,6 +567,7 @@ static void of_phandle_args_to_fwspec(struct of_phandle_args *irq_data,
|
|
|
unsigned int irq_create_fwspec_mapping(struct irq_fwspec *fwspec)
|
|
|
{
|
|
|
struct irq_domain *domain;
|
|
|
+ struct irq_data *irq_data;
|
|
|
irq_hw_number_t hwirq;
|
|
|
unsigned int type = IRQ_TYPE_NONE;
|
|
|
int virq;
|
|
|
@@ -614,7 +615,11 @@ unsigned int irq_create_fwspec_mapping(struct irq_fwspec *fwspec)
|
|
|
* it now and return the interrupt number.
|
|
|
*/
|
|
|
if (irq_get_trigger_type(virq) == IRQ_TYPE_NONE) {
|
|
|
- irq_set_irq_type(virq, type);
|
|
|
+ irq_data = irq_get_irq_data(virq);
|
|
|
+ if (!irq_data)
|
|
|
+ return 0;
|
|
|
+
|
|
|
+ irqd_set_trigger_type(irq_data, type);
|
|
|
return virq;
|
|
|
}
|
|
|
|
|
|
@@ -634,10 +639,18 @@ unsigned int irq_create_fwspec_mapping(struct irq_fwspec *fwspec)
|
|
|
return virq;
|
|
|
}
|
|
|
|
|
|
- /* Set type if specified and different than the current one */
|
|
|
- if (type != IRQ_TYPE_NONE &&
|
|
|
- type != irq_get_trigger_type(virq))
|
|
|
- irq_set_irq_type(virq, type);
|
|
|
+ irq_data = irq_get_irq_data(virq);
|
|
|
+ if (!irq_data) {
|
|
|
+ if (irq_domain_is_hierarchy(domain))
|
|
|
+ irq_domain_free_irqs(virq, 1);
|
|
|
+ else
|
|
|
+ irq_dispose_mapping(virq);
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ /* Store trigger type */
|
|
|
+ irqd_set_trigger_type(irq_data, type);
|
|
|
+
|
|
|
return virq;
|
|
|
}
|
|
|
EXPORT_SYMBOL_GPL(irq_create_fwspec_mapping);
|