irqdomain changes for Linux v3.8

Trivial changes to irqdomain. An update to the documentation and make
 one of the error paths not quite so obnoxious.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (GNU/Linux)
 
 iQIcBAABAgAGBQJQx25bAAoJEEFnBt12D9kBmBkP/i4TONBT0TVWVKsK7RIdZpVF
 aQCC1W2gFuo5E8JITB6gfhvSw6LMiho9ThzX0NVP52SN6k5QWm0QzlB1sjQyaKph
 +rB7pepO9+MxYuz5zPz1RPNlBA7pvu+S2e7eDD0dtWfmJn9gjeubrschZINSU25E
 g0BYdy/eJTnNwOdsASNaXNN2Bu7/gO7EpV0Z5T8fCfbih9euyKcuGhHasXGdnHQX
 /PpYu87kq0FPYyLuHBo1+9WXIG++sGtlw8SPZ7kjPLFlnis4spiajoaXrwXWMyQN
 KJTdDLHh2DSRlxQEr+Ibw2ptajJ/iNIwQdQksFn1DzDzkcCDBgl8e+0sCCUhv0eb
 sQcf/jQ6clYmwH/7SCHo93kyLt7BpY4jocw8UL6XiITTY156I0u/4YTPJNCm/ai8
 NajWsmt0otekZOmLpKQhDEsnWrAfVMfmRiQOBAhACt2KPS78FtNpt3b8jCWYyEV4
 MB5aemsTdtRGSLCITe3nZ9W0CyFDS8fhgS310DV+y3QVa7KIT7oFYy2S8FuO2AOn
 HVRNjKqZJm1jwHdgSN4BXpve/KqxycTA3Kfz/SnaOs/JNP7oWxPY/X6MUrKHmcId
 eCciJ/hXknslgH6q+1OD/7RCJL7fAt0+9xmqzKStBGcfgswC4uIn3+gHmWUwdwlE
 1f8NCvsRERl+79biglT8
 =24xd
 -----END PGP SIGNATURE-----

Merge tag 'irqdomain-for-linus' of git://git.secretlab.ca/git/linux-2.6

Pull irqdomain changes from Grant Likely:
 "Trivial changes to irqdomain.  An update to the documentation and make
  one of the error paths not quite so obnoxious."

* tag 'irqdomain-for-linus' of git://git.secretlab.ca/git/linux-2.6:
  irqdomain: update documentation
  irqdomain: stop screaming about preallocated irqdescs
This commit is contained in:
Linus Torvalds 2012-12-11 11:30:08 -08:00
commit 259cdbee20
2 changed files with 35 additions and 3 deletions

View File

@ -7,6 +7,21 @@ systems with multiple interrupt controllers the kernel must ensure
that each one gets assigned non-overlapping allocations of Linux
IRQ numbers.
The number of interrupt controllers registered as unique irqchips
show a rising tendency: for example subdrivers of different kinds
such as GPIO controllers avoid reimplementing identical callback
mechanisms as the IRQ core system by modelling their interrupt
handlers as irqchips, i.e. in effect cascading interrupt controllers.
Here the interrupt number loose all kind of correspondence to
hardware interrupt numbers: whereas in the past, IRQ numbers could
be chosen so they matched the hardware IRQ line into the root
interrupt controller (i.e. the component actually fireing the
interrupt line to the CPU) nowadays this number is just a number.
For this reason we need a mechanism to separate controller-local
interrupt numbers, called hardware irq's, from Linux IRQ numbers.
The irq_alloc_desc*() and irq_free_desc*() APIs provide allocation of
irq numbers, but they don't provide any support for reverse mapping of
the controller-local IRQ (hwirq) number into the Linux IRQ number
@ -40,6 +55,10 @@ required hardware setup.
When an interrupt is received, irq_find_mapping() function should
be used to find the Linux IRQ number from the hwirq number.
The irq_create_mapping() function must be called *atleast once*
before any call to irq_find_mapping(), lest the descriptor will not
be allocated.
If the driver has the Linux IRQ number or the irq_data pointer, and
needs to know the associated hwirq number (such as in the irq_chip
callbacks) then it can be directly obtained from irq_data->hwirq.
@ -119,4 +138,17 @@ 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.
system and will otherwise use a linear domain mapping. The semantics
of this call are such that if an IRQ range is specified then
descriptors will be allocated on-the-fly for it, and if no range is
specified it will fall through to irq_domain_add_linear() which meand
*no* irq descriptors will be allocated.
A typical use case for simple domains is where an irqchip provider
is supporting both dynamic and static IRQ assignments.
In order to avoid ending up in a situation where a linear domain is
used and no descriptor gets allocated it is very important to make sure
that the driver using the simple domain call irq_create_mapping()
before any irq_find_mapping() since the latter will actually work
for the static IRQ assignment case.

View File

@ -177,8 +177,8 @@ struct irq_domain *irq_domain_add_simple(struct device_node *of_node,
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);
pr_info("Cannot allocate irq_descs @ IRQ%d, assuming pre-allocated\n",
first_irq);
irq_base = first_irq;
}
} else