]> git.karo-electronics.de Git - karo-tx-linux.git/commit
irqdomain: Refactor irq_domain_associate_many()
authorGrant Likely <grant.likely@linaro.org>
Mon, 10 Jun 2013 00:06:02 +0000 (01:06 +0100)
committerGrant Likely <grant.likely@linaro.org>
Mon, 10 Jun 2013 10:52:09 +0000 (11:52 +0100)
commitd39046ec729105c4ecf2bc64c592a84f026274af
tree00e8c07fc9d4032d87371ee0bc1e82b0bb6e389e
parent1400ea86025a22862f97e7fe544433751b43ecec
irqdomain: Refactor irq_domain_associate_many()

Originally, irq_domain_associate_many() was designed to unwind the
mapped irqs on a failure of any individual association. However, that
proved to be a problem with certain IRQ controllers. Some of them only
support a subset of irqs, and will fail when attempting to map a
reserved IRQ. In those cases we want to map as many IRQs as possible, so
instead it is better for irq_domain_associate_many() to make a
best-effort attempt to map irqs, but not fail if any or all of them
don't succeed. If a caller really cares about how many irqs got
associated, then it should instead go back and check that all of the
irqs is cares about were mapped.

The original design open-coded the individual association code into the
body of irq_domain_associate_many(), but with no longer needing to
unwind associations, the code becomes simpler to split out
irq_domain_associate() to contain the bulk of the logic, and
irq_domain_associate_many() to be a simple loop wrapper.

This patch also adds a new error check to the associate path to make
sure it isn't called for an irq larger than the controller can handle,
and adds locking so that the irq_domain_mutex is held while setting up a
new association.

v2: Fixup x86 warning. irq_domain_associate_many() no longer returns an
    error code, but reports errors to the printk log directly. In the
    majority of cases we don't actually want to fail if there is a
    problem, but rather log it and still try to boot the system.

Signed-off-by: Grant Likely <grant.likely@linaro.org>
arch/x86/kernel/devicetree.c
include/linux/irqdomain.h
kernel/irq/irqdomain.c