diff options
Diffstat (limited to 'include/linux/irqdomain.h')
-rw-r--r-- | include/linux/irqdomain.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h index 3ad553e8eae2..99834e581b9e 100644 --- a/include/linux/irqdomain.h +++ b/include/linux/irqdomain.h | |||
@@ -47,6 +47,7 @@ struct irq_domain_ops { | |||
47 | * of the irq_domain is responsible for allocating the array of | 47 | * of the irq_domain is responsible for allocating the array of |
48 | * irq_desc structures. | 48 | * irq_desc structures. |
49 | * @nr_irq: Number of irqs managed by the irq domain | 49 | * @nr_irq: Number of irqs managed by the irq domain |
50 | * @hwirq_base: Starting number for hwirqs managed by the irq domain | ||
50 | * @ops: pointer to irq_domain methods | 51 | * @ops: pointer to irq_domain methods |
51 | * @priv: private data pointer for use by owner. Not touched by irq_domain | 52 | * @priv: private data pointer for use by owner. Not touched by irq_domain |
52 | * core code. | 53 | * core code. |
@@ -57,6 +58,7 @@ struct irq_domain { | |||
57 | struct list_head list; | 58 | struct list_head list; |
58 | unsigned int irq_base; | 59 | unsigned int irq_base; |
59 | unsigned int nr_irq; | 60 | unsigned int nr_irq; |
61 | unsigned int hwirq_base; | ||
60 | const struct irq_domain_ops *ops; | 62 | const struct irq_domain_ops *ops; |
61 | void *priv; | 63 | void *priv; |
62 | struct device_node *of_node; | 64 | struct device_node *of_node; |
@@ -72,9 +74,21 @@ struct irq_domain { | |||
72 | static inline unsigned int irq_domain_to_irq(struct irq_domain *d, | 74 | static inline unsigned int irq_domain_to_irq(struct irq_domain *d, |
73 | unsigned long hwirq) | 75 | unsigned long hwirq) |
74 | { | 76 | { |
75 | return d->ops->to_irq ? d->ops->to_irq(d, hwirq) : d->irq_base + hwirq; | 77 | if (d->ops->to_irq) |
78 | return d->ops->to_irq(d, hwirq); | ||
79 | if (WARN_ON(hwirq < d->hwirq_base)) | ||
80 | return 0; | ||
81 | return d->irq_base + hwirq - d->hwirq_base; | ||
76 | } | 82 | } |
77 | 83 | ||
84 | #define irq_domain_for_each_hwirq(d, hw) \ | ||
85 | for (hw = d->hwirq_base; hw < d->hwirq_base + d->nr_irq; hw++) | ||
86 | |||
87 | #define irq_domain_for_each_irq(d, hw, irq) \ | ||
88 | for (hw = d->hwirq_base, irq = irq_domain_to_irq(d, hw); \ | ||
89 | hw < d->hwirq_base + d->nr_irq; \ | ||
90 | hw++, irq = irq_domain_to_irq(d, hw)) | ||
91 | |||
78 | extern void irq_domain_add(struct irq_domain *domain); | 92 | extern void irq_domain_add(struct irq_domain *domain); |
79 | extern void irq_domain_del(struct irq_domain *domain); | 93 | extern void irq_domain_del(struct irq_domain *domain); |
80 | #endif /* CONFIG_IRQ_DOMAIN */ | 94 | #endif /* CONFIG_IRQ_DOMAIN */ |