Skip to content

Commit

Permalink
irqdomain: Replace revmap_direct_max_irq field with hwirq_max field
Browse files Browse the repository at this point in the history
In commit "4f86a06e2d6e irqdomain: Make normal and nomap irqdomains exclusive",
use revmap_size field instead of revmap_direct_max_irq. revmap_size field
originally indicates the maximum hwirq of linear Mapping. This results in
revmap_size having two different layers of meaning that can be confusing.

This patch optimization point is to solve this confusion point. During
direct mapping, the values of hwirq_max and revmap_direct_max_irq are the same
and have the same meanings. They both indicate the maximum hwirq supported by
direct Mapping. The optimization method is to delete revmap_direct_max_irq
field and use hwirq_max instead of revmap_direct_max_irq.

Signed-off-by: Xu Qiang <xuqiang36@huawei.com>
  • Loading branch information
Xu Qiang authored and intel-lab-lkp committed Jul 18, 2022
1 parent e09ea2c commit 36d8f25
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions kernel/irq/irqdomain.c
Expand Up @@ -147,7 +147,8 @@ struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, unsigned int s
static atomic_t unknown_domains;

if (WARN_ON((size && direct_max) ||
(!IS_ENABLED(CONFIG_IRQ_DOMAIN_NOMAP) && direct_max)))
(!IS_ENABLED(CONFIG_IRQ_DOMAIN_NOMAP) && direct_max) ||
(direct_max && (direct_max != hwirq_max))))
return NULL;

domain = kzalloc_node(struct_size(domain, revmap, size),
Expand Down Expand Up @@ -219,7 +220,6 @@ struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, unsigned int s
domain->hwirq_max = hwirq_max;

if (direct_max) {
size = direct_max;
domain->flags |= IRQ_DOMAIN_FLAG_NO_MAP;
}

Expand Down Expand Up @@ -650,9 +650,9 @@ unsigned int irq_create_direct_mapping(struct irq_domain *domain)
pr_debug("create_direct virq allocation failed\n");
return 0;
}
if (virq >= domain->revmap_size) {
if (virq >= domain->hwirq_max) {
pr_err("ERROR: no free irqs available below %i maximum\n",
domain->revmap_size);
domain->hwirq_max);
irq_free_desc(virq);
return 0;
}
Expand Down Expand Up @@ -906,7 +906,7 @@ struct irq_desc *__irq_resolve_mapping(struct irq_domain *domain,
return desc;

if (irq_domain_is_nomap(domain)) {
if (hwirq < domain->revmap_size) {
if (hwirq < domain->hwirq_max) {
data = irq_domain_get_irq_data(domain, hwirq);
if (data && data->hwirq == hwirq)
desc = irq_data_to_desc(data);
Expand Down

0 comments on commit 36d8f25

Please sign in to comment.