]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/base/regmap/regmap-irq.c
Merge tag 'armsoc-dt' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
[karo-tx-linux.git] / drivers / base / regmap / regmap-irq.c
index 0b0ea3b88a9173da325841571821731e222bc87c..26f799e71c82355e02ef58ff9847cef33545e444 100644 (file)
@@ -379,6 +379,7 @@ static int regmap_irq_map(struct irq_domain *h, unsigned int virq,
        irq_set_chip_data(virq, data);
        irq_set_chip(virq, &data->irq_chip);
        irq_set_nested_thread(virq, 1);
+       irq_set_parent(virq, data->irq);
        irq_set_noprobe(virq);
 
        return 0;
@@ -655,13 +656,34 @@ EXPORT_SYMBOL_GPL(regmap_add_irq_chip);
  *
  * @irq: Primary IRQ for the device
  * @d:   regmap_irq_chip_data allocated by regmap_add_irq_chip()
+ *
+ * This function also dispose all mapped irq on chip.
  */
 void regmap_del_irq_chip(int irq, struct regmap_irq_chip_data *d)
 {
+       unsigned int virq;
+       int hwirq;
+
        if (!d)
                return;
 
        free_irq(irq, d);
+
+       /* Dispose all virtual irq from irq domain before removing it */
+       for (hwirq = 0; hwirq < d->chip->num_irqs; hwirq++) {
+               /* Ignore hwirq if holes in the IRQ list */
+               if (!d->chip->irqs[hwirq].mask)
+                       continue;
+
+               /*
+                * Find the virtual irq of hwirq on chip and if it is
+                * there then dispose it
+                */
+               virq = irq_find_mapping(d->domain, hwirq);
+               if (virq)
+                       irq_dispose_mapping(virq);
+       }
+
        irq_domain_remove(d->domain);
        kfree(d->type_buf);
        kfree(d->type_buf_def);