Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 333743
b: refs/heads/master
c: 2854d16
h: refs/heads/master
i:
  333741: b43c424
  333739: 3cab9a8
  333735: 4a35f5d
  333727: 036e4c4
v: v3
  • Loading branch information
Linus Walleij committed Oct 10, 2012
1 parent 13bf7cf commit 81a4f03
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c22df08c7ffbfb281b0e5dff3fff4e192d1a7863
refs/heads/master: 2854d167cc545d0642277bf8b77f972a91146fc6
33 changes: 28 additions & 5 deletions trunk/kernel/irq/irqdomain.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ static unsigned int irq_domain_legacy_revmap(struct irq_domain *domain,
* @host_data: Controller private data pointer
*
* Allocates a legacy irq_domain if irq_base is positive or a linear
* domain otherwise.
* domain otherwise. For the legacy domain, IRQ descriptors will also
* be allocated.
*
* This is intended to implement the expected behaviour for most
* interrupt controllers which is that a linear mapping should
Expand All @@ -162,11 +163,33 @@ struct irq_domain *irq_domain_add_simple(struct device_node *of_node,
const struct irq_domain_ops *ops,
void *host_data)
{
if (first_irq > 0)
return irq_domain_add_legacy(of_node, size, first_irq, 0,
if (first_irq > 0) {
int irq_base;

if (IS_ENABLED(CONFIG_SPARSE_IRQ)) {
/*
* Set the descriptor allocator to search for a
* 1-to-1 mapping, such as irq_alloc_desc_at().
* Use of_node_to_nid() which is defined to
* numa_node_id() on platforms that have no custom
* implementation.
*/
irq_base = irq_alloc_descs(first_irq, first_irq, size,
of_node_to_nid(of_node));
if (irq_base < 0) {
WARN(1, "Cannot allocate irq_descs @ IRQ%d, assuming pre-allocated\n",
first_irq);
irq_base = first_irq;
}
} else
irq_base = first_irq;

return irq_domain_add_legacy(of_node, size, irq_base, 0,
ops, host_data);
else
return irq_domain_add_linear(of_node, size, ops, host_data);
}

/* A linear domain is the default */
return irq_domain_add_linear(of_node, size, ops, host_data);
}

/**
Expand Down

0 comments on commit 81a4f03

Please sign in to comment.