Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 320876
b: refs/heads/master
c: 781d0f4
h: refs/heads/master
v: v3
  • Loading branch information
Mark Brown authored and Grant Likely committed Jul 11, 2012
1 parent 3a8d4a6 commit 6aa0c85
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: aed98048bd1c83469d96932c1901e867d9ba519a
refs/heads/master: 781d0f46d81e2c26c70649903b503bcfe817efc8
5 changes: 5 additions & 0 deletions trunk/Documentation/IRQ-domain.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ Linux IRQ number into the hardware.
Most drivers cannot use this mapping.

==== Legacy ====
irq_domain_add_simple()
irq_domain_add_legacy()
irq_domain_add_legacy_isa()

Expand All @@ -115,3 +116,7 @@ The legacy map should only be used if fixed IRQ mappings must be
supported. For example, ISA controllers would use the legacy map for
mapping Linux IRQs 0-15 so that existing ISA drivers get the correct IRQ
numbers.

Most users of legacy mappings should use irq_domain_add_simple() which
will use a legacy domain only if an IRQ range is supplied by the
system and will otherwise use a linear domain mapping.
5 changes: 5 additions & 0 deletions trunk/include/linux/irqdomain.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ struct irq_domain {
};

#ifdef CONFIG_IRQ_DOMAIN
struct irq_domain *irq_domain_add_simple(struct device_node *of_node,
unsigned int size,
unsigned int first_irq,
const struct irq_domain_ops *ops,
void *host_data);
struct irq_domain *irq_domain_add_legacy(struct device_node *of_node,
unsigned int size,
unsigned int first_irq,
Expand Down
30 changes: 30 additions & 0 deletions trunk/kernel/irq/irqdomain.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,36 @@ static unsigned int irq_domain_legacy_revmap(struct irq_domain *domain,
return hwirq - first_hwirq + domain->revmap_data.legacy.first_irq;
}

/**
* irq_domain_add_simple() - Allocate and register a simple irq_domain.
* @of_node: pointer to interrupt controller's device tree node.
* @size: total number of irqs in mapping
* @first_irq: first number of irq block assigned to the domain
* @ops: map/unmap domain callbacks
* @host_data: Controller private data pointer
*
* Allocates a legacy irq_domain if irq_base is positive or a linear
* domain otherwise.
*
* This is intended to implement the expected behaviour for most
* interrupt controllers which is that a linear mapping should
* normally be used unless the system requires a legacy mapping in
* order to support supplying interrupt numbers during non-DT
* registration of devices.
*/
struct irq_domain *irq_domain_add_simple(struct device_node *of_node,
unsigned int size,
unsigned int first_irq,
const struct irq_domain_ops *ops,
void *host_data)
{
if (first_irq > 0)
return irq_domain_add_legacy(of_node, size, first_irq, 0,
ops, host_data);
else
return irq_domain_add_linear(of_node, size, ops, host_data);
}

/**
* irq_domain_add_legacy() - Allocate and register a legacy revmap irq_domain.
* @of_node: pointer to interrupt controller's device tree node.
Expand Down

0 comments on commit 6aa0c85

Please sign in to comment.