diff options
author | Grant Likely <grant.likely@linaro.org> | 2013-06-10 07:19:17 -0400 |
---|---|---|
committer | Grant Likely <grant.likely@linaro.org> | 2013-06-24 09:02:41 -0400 |
commit | d3dcb436f61593843af178d4a520c8c43c04d3fc (patch) | |
tree | 1c2f64841936402a5d01ed923abd427f311a0e7a /include/linux/irqdomain.h | |
parent | 56a3d5ac774d054ece9373277a861338a468a294 (diff) |
irqdomain: make irq_linear_revmap() a fast path again
Over the years, irq_linear_revmap() gained tests and checks to make sure
callers were using it safely, which while important, also make it less
of a fast path. After the irqdomain refactoring done recently, it is now
possible to make irq_linear_revmap() a fast path again. This patch moves
irq_linear_revmap() to the header file and makes it a static inline so
that interrupt controller drivers using a linear mapping can decode the
virq from a hwirq in just a couple of instructions.
Signed-off-by: Grant Likely <grant.likely@linaro.org>
Diffstat (limited to 'include/linux/irqdomain.h')
-rw-r--r-- | include/linux/irqdomain.h | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h index 6efbeccac56c..c983ed18c332 100644 --- a/include/linux/irqdomain.h +++ b/include/linux/irqdomain.h | |||
@@ -176,6 +176,22 @@ extern void irq_domain_associate_many(struct irq_domain *domain, | |||
176 | extern unsigned int irq_create_mapping(struct irq_domain *host, | 176 | extern unsigned int irq_create_mapping(struct irq_domain *host, |
177 | irq_hw_number_t hwirq); | 177 | irq_hw_number_t hwirq); |
178 | extern void irq_dispose_mapping(unsigned int virq); | 178 | extern void irq_dispose_mapping(unsigned int virq); |
179 | |||
180 | /** | ||
181 | * irq_linear_revmap() - Find a linux irq from a hw irq number. | ||
182 | * @domain: domain owning this hardware interrupt | ||
183 | * @hwirq: hardware irq number in that domain space | ||
184 | * | ||
185 | * This is a fast path alternative to irq_find_mapping() that can be | ||
186 | * called directly by irq controller code to save a handful of | ||
187 | * instructions. It is always safe to call, but won't find irqs mapped | ||
188 | * using the radix tree. | ||
189 | */ | ||
190 | static inline unsigned int irq_linear_revmap(struct irq_domain *domain, | ||
191 | irq_hw_number_t hwirq) | ||
192 | { | ||
193 | return hwirq < domain->revmap_size ? domain->linear_revmap[hwirq] : 0; | ||
194 | } | ||
179 | extern unsigned int irq_find_mapping(struct irq_domain *host, | 195 | extern unsigned int irq_find_mapping(struct irq_domain *host, |
180 | irq_hw_number_t hwirq); | 196 | irq_hw_number_t hwirq); |
181 | extern unsigned int irq_create_direct_mapping(struct irq_domain *host); | 197 | extern unsigned int irq_create_direct_mapping(struct irq_domain *host); |
@@ -189,9 +205,6 @@ static inline int irq_create_identity_mapping(struct irq_domain *host, | |||
189 | return irq_create_strict_mappings(host, hwirq, hwirq, 1); | 205 | return irq_create_strict_mappings(host, hwirq, hwirq, 1); |
190 | } | 206 | } |
191 | 207 | ||
192 | extern unsigned int irq_linear_revmap(struct irq_domain *host, | ||
193 | irq_hw_number_t hwirq); | ||
194 | |||
195 | extern const struct irq_domain_ops irq_domain_simple_ops; | 208 | extern const struct irq_domain_ops irq_domain_simple_ops; |
196 | 209 | ||
197 | /* stock xlate functions */ | 210 | /* stock xlate functions */ |