of: irq: use of_irq_get() in of_irq_to_resource()
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Tue, 16 May 2017 12:09:04 +0000 (14:09 +0200)
committerRob Herring <robh@kernel.org>
Tue, 16 May 2017 14:11:22 +0000 (09:11 -0500)
commit7a4228bbff769ebf449981a4248616db9f0cffec
treee91223b383a97dcf5693d4ca82a207ff3edbaccf
parenta2b3cf070920959d49ec3e1fd544b1f8784b58b5
of: irq: use of_irq_get() in of_irq_to_resource()

of_irq_to_resource() currently uses irq_of_parse_and_map() to
translate a DT interrupt specification into a Linux virtual interrupt
number. While this works in most cases, irq_of_parse_and_map() doesn't
properly handle the case where the interrupt controller is not yet
available (due to deferred probing for example).

So instead, use of_irq_get(), which is implemented exactly like
irq_of_parse_and_map(), with the exception that if the interrupt
controller is not yet available, it returns -EPROBE_DEFER. Obviously,
we also handle this error and bail out from of_irq_to_resource() when
of_irq_get() returns an error.

This allows to avoid silly error messages at boot time caused by
irq_create_of_mapping() when the interrupt controller is not
available:

[    0.153168] irq: no irq domain found for /ap806/config-space@f0000000/interrupt-controller@3f0100 !
[    0.154041] irq: no irq domain found for /cp110-master/config-space@f2000000/interrupt-controller@1e0000 !
[    0.154124] irq: no irq domain found for /cp110-master/config-space@f2000000/interrupt-controller@1e0000 !
[    0.154207] irq: no irq domain found for /cp110-master/config-space@f2000000/interrupt-controller@1e0000 !
[    0.154437] irq: no irq domain found for /cp110-master/config-space@f2000000/interrupt-controller@1e0000 !
[    0.154518] irq: no irq domain found for /cp110-master/config-space@f2000000/interrupt-controller@1e0000 !

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Rob Herring <robh@kernel.org>
drivers/of/irq.c