* @host_data: private data pointer for use by owner.  Not touched by irq_domain
  *             core code.
  * @flags: host per irq_domain flags
+ * @mapcount: The number of mapped interrupts
  *
  * Optional elements
  * @of_node: Pointer to device tree nodes associated with the irq_domain. Used
        const struct irq_domain_ops *ops;
        void *host_data;
        unsigned int flags;
+       unsigned int mapcount;
 
        /* Optional data */
        struct fwnode_handle *fwnode;
 
 
        irq_data->domain = NULL;
        irq_data->hwirq = 0;
+       domain->mapcount--;
 
        /* Clear reverse map for this hwirq */
        if (hwirq < domain->revmap_size) {
                        domain->name = irq_data->chip->name;
        }
 
+       domain->mapcount++;
        if (hwirq < domain->revmap_size) {
                domain->linear_revmap[hwirq] = virq;
        } else {
                struct irq_domain *domain = data->domain;
                irq_hw_number_t hwirq = data->hwirq;
 
+               domain->mapcount++;
                if (hwirq < domain->revmap_size) {
                        domain->linear_revmap[hwirq] = virq;
                } else {
                struct irq_domain *domain = data->domain;
                irq_hw_number_t hwirq = data->hwirq;
 
+               domain->mapcount--;
                if (hwirq < domain->revmap_size) {
                        domain->linear_revmap[hwirq] = 0;
                } else {