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 /kernel | |
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 'kernel')
-rw-r--r-- | kernel/irq/irqdomain.c | 34 |
1 files changed, 8 insertions, 26 deletions
diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c index e47b35671384..836a0f7ec2a9 100644 --- a/kernel/irq/irqdomain.c +++ b/kernel/irq/irqdomain.c | |||
@@ -559,35 +559,17 @@ unsigned int irq_find_mapping(struct irq_domain *domain, | |||
559 | return hwirq; | 559 | return hwirq; |
560 | } | 560 | } |
561 | 561 | ||
562 | return irq_linear_revmap(domain, hwirq); | 562 | /* Check if the hwirq is in the linear revmap. */ |
563 | if (hwirq < domain->revmap_size) | ||
564 | return domain->linear_revmap[hwirq]; | ||
565 | |||
566 | rcu_read_lock(); | ||
567 | data = radix_tree_lookup(&domain->revmap_tree, hwirq); | ||
568 | rcu_read_unlock(); | ||
569 | return data ? data->irq : 0; | ||
563 | } | 570 | } |
564 | EXPORT_SYMBOL_GPL(irq_find_mapping); | 571 | EXPORT_SYMBOL_GPL(irq_find_mapping); |
565 | 572 | ||
566 | /** | ||
567 | * irq_linear_revmap() - Find a linux irq from a hw irq number. | ||
568 | * @domain: domain owning this hardware interrupt | ||
569 | * @hwirq: hardware irq number in that domain space | ||
570 | * | ||
571 | * This is a fast path that can be called directly by irq controller code to | ||
572 | * save a handful of instructions. | ||
573 | */ | ||
574 | unsigned int irq_linear_revmap(struct irq_domain *domain, | ||
575 | irq_hw_number_t hwirq) | ||
576 | { | ||
577 | struct irq_data *data; | ||
578 | |||
579 | /* Check revmap bounds; complain if exceeded */ | ||
580 | if (hwirq >= domain->revmap_size) { | ||
581 | rcu_read_lock(); | ||
582 | data = radix_tree_lookup(&domain->revmap_tree, hwirq); | ||
583 | rcu_read_unlock(); | ||
584 | return data ? data->irq : 0; | ||
585 | } | ||
586 | |||
587 | return domain->linear_revmap[hwirq]; | ||
588 | } | ||
589 | EXPORT_SYMBOL_GPL(irq_linear_revmap); | ||
590 | |||
591 | #ifdef CONFIG_IRQ_DOMAIN_DEBUG | 573 | #ifdef CONFIG_IRQ_DOMAIN_DEBUG |
592 | static int virq_debug_show(struct seq_file *m, void *private) | 574 | static int virq_debug_show(struct seq_file *m, void *private) |
593 | { | 575 | { |