aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2014-06-17 15:51:02 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-07-31 12:52:57 -0700
commit25a59eef98fa3bb7993ea5fe0e0ea2cd08aab02a (patch)
tree1930fa4ecdf61783c48e6d49b338669bba4b9d95
parent3f9e431955574505f0df2aa1e95686023a9d5977 (diff)
platform_get_irq: Revert to platform_get_resource if of_irq_get fails
commit aff008ad813c7cf3cfe7b532e7ba2c526c136f22 upstream. Commits 9ec36ca (of/irq: do irq resolution in platform_get_irq) and ad69674 (of/irq: do irq resolution in platform_get_irq_byname) change the semantics of platform_get_irq and platform_get_irq_byname to always rely on devicetree information if devicetree is enabled and if a devicetree node is attached to the device. The functions now return an error if the devicetree data does not include interrupt information, even if the information is available as platform resource data. This causes mfd client drivers to fail if the interrupt number is passed via platform resources. Therefore, if of_irq_get fails, try platform_get_resource as method of last resort. This restores the original functionality for drivers depending on platform resources to get irq information. Cc: Russell King <linux@arm.linux.org.uk> Cc: Tony Lindgren <tony@atomide.com> Cc: Grant Likely <grant.likely@linaro.org> Cc: Grygorii Strashko <grygorii.strashko@ti.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Rob Herring <robh@kernel.org> [ Guenter Roeck: backported to 3.15 ] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
-rw-r--r--drivers/base/platform.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 3c51eb0bd65..9dbf4ef2b2a 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -89,8 +89,13 @@ int platform_get_irq(struct platform_device *dev, unsigned int num)
return dev->archdata.irqs[num];
#else
struct resource *r;
- if (IS_ENABLED(CONFIG_OF_IRQ) && dev->dev.of_node)
- return of_irq_get(dev->dev.of_node, num);
+ if (IS_ENABLED(CONFIG_OF_IRQ) && dev->dev.of_node) {
+ int ret;
+
+ ret = of_irq_get(dev->dev.of_node, num);
+ if (ret >= 0 || ret == -EPROBE_DEFER)
+ return ret;
+ }
r = platform_get_resource(dev, IORESOURCE_IRQ, num);