platform_get_irq: Revert to platform_get_resource if of_irq_get fails
PATCH v2 1/1 platform_get_irq: Revert to platform_get_resource if of_irq_get fails
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.
---
v2: Include change for platform_get_irq_byname
Handle EPROBE_DEFER
It looks like v1 got lost in space, so you may not have seen it. I am sending this patch as v2 anyway to avoid confusion, just in case v1 shows up somewhere.
At least 9ec36ca has been applied to -stable, so if this patch is accepted it may make sense to apply it to the same -stable releases.
drivers/base/platform.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
drivers/base/platform.c +14 -4
@@ -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);
@@ -133,8 +138,13 @@ int platform_get_irq_byname(struct platform_device *dev, const char *name) {struct resource *r; -if (IS_ENABLED (CONFIG_OF_IRQ ) && dev->dev.of_node) -return of_irq_get_byname (dev->dev.of_node, name); +if (IS_ENABLED (CONFIG_OF_IRQ ) && dev->dev.of_node) { +int ret; + + ret =of_irq_get_byname (dev->dev.of_node, name); +if (ret >=0 || ret == -EPROBE_DEFER ) +return ret; + } r =platform_get_resource_byname (dev,IORESOURCE_IRQ , name);return r ? r->start : -ENXIO ;
Signature · 1 line
1.9.1
ping ... any comments ?
Guenter
Quoted 72 lines · Guenter Roeck
Commits 9ec36ca (of/irq: do irq resolution in
platform_get_irq) and ad69674 (of/irq: do irq resolution inplatform_get_irq_byname) change the semantics ofplatform_get_irqandplatform_get_irq_bynameto 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_getfails, tryplatform_get_resourceas method of last resort. This restores the original functionality for drivers depending on platform resources to get irq information.Cc Russell King <[email protected]>Cc Rob Herring <[email protected]>Cc Tony Lindgren <[email protected]>Cc Grant Likely <[email protected]>Cc Grygorii Strashko <[email protected]>Signed-off-by Guenter Roeck <[email protected]>---
v2: Include change forplatform_get_irq_byname
HandleEPROBE_DEFERIt looks like v1 got lost in space, so you may not have seen it. I am sending this patch as v2 anyway to avoid confusion, just in case v1 shows up somewhere.
At least 9ec36ca has been applied to -stable, so if this patch is accepted it may make sense to apply it to the same -stable releases.
drivers/base/platform.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)drivers/base/platform.c +14
-4@@ -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);@@ -133,8 +138,13 @@ int platform_get_irq_byname(struct platform_device *dev, const char *name) {struct resource *r; -if (IS_ENABLED (CONFIG_OF_IRQ ) && dev->dev.of_node) -return of_irq_get_byname (dev->dev.of_node, name); +if (IS_ENABLED (CONFIG_OF_IRQ ) && dev->dev.of_node) { +int ret; + + ret =of_irq_get_byname (dev->dev.of_node, name); +if (ret >=0 || ret == -EPROBE_DEFER ) +return ret; + } r =platform_get_resource_byname (dev,IORESOURCE_IRQ , name);return r ? r->start : -ENXIO ;
Quoted 15 lines · Guenter Roeck
Commits 9ec36ca (of/irq: do irq resolution in
platform_get_irq) and ad69674 (of/irq: do irq resolution inplatform_get_irq_byname) change the semantics ofplatform_get_irqandplatform_get_irq_bynameto 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_getfails, tryplatform_get_resourceas method of last resort. This restores the original functionality for drivers depending on platform resources to get irq information.
Quoted 6 lines
Cc Russell King <[email protected]>Cc Rob Herring <[email protected]>Cc Tony Lindgren <[email protected]>Cc Grant Likely <[email protected]>Cc Grygorii Strashko <[email protected]>Signed-off-by Guenter Roeck <[email protected]>
Greg should take this for 3.16.
Rob
Quoted 53 lines
---
v2: Include change forplatform_get_irq_byname
HandleEPROBE_DEFERIt looks like v1 got lost in space, so you may not have seen it. I am sending this patch as v2 anyway to avoid confusion, just in case v1 shows up somewhere.
At least 9ec36ca has been applied to -stable, so if this patch is accepted it may make sense to apply it to the same -stable releases.
drivers/base/platform.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)drivers/base/platform.c +14
-5@@ -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);@@ -133,8 +138,13 @@ int platform_get_irq_byname(struct platform_device *dev, const char *name) {struct resource *r; -if (IS_ENABLED (CONFIG_OF_IRQ ) && dev->dev.of_node) -return of_irq_get_byname (dev->dev.of_node, name); +if (IS_ENABLED (CONFIG_OF_IRQ ) && dev->dev.of_node) { +int ret; + + ret =of_irq_get_byname (dev->dev.of_node, name); +if (ret >=0 || ret == -EPROBE_DEFER ) +return ret; + } r =platform_get_resource_byname (dev,IORESOURCE_IRQ , name);return r ? r->start : -ENXIO ; --1.9.1
Quoted 23 lines · Rob Herring
Quoted 15 lines · Guenter Roeck
Commits 9ec36ca (of/irq: do irq resolution in
platform_get_irq) and ad69674 (of/irq: do irq resolution inplatform_get_irq_byname) change the semantics ofplatform_get_irqandplatform_get_irq_bynameto 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_getfails, tryplatform_get_resourceas method of last resort. This restores the original functionality for drivers depending on platform resources to get irq information.Quoted 6 lines
Cc Russell King <[email protected]>Cc Rob Herring <[email protected]>Cc Tony Lindgren <[email protected]>Cc Grant Likely <[email protected]>Cc Grygorii Strashko <[email protected]>Signed-off-by Guenter Roeck <[email protected]>
Quoted 4 lines
Acked-by Rob Herring <[email protected]>Greg should take this for 3.16.
Wound be great. In the meantime, I asked for the da9055 code to be re-tested, since I suspect that it may be affected. There may be others, but I don't have the time to track it all down.
Thanks,
Guenter
Quoted 23 lines · Rob Herring
Quoted 15 lines · Guenter Roeck
Commits 9ec36ca (of/irq: do irq resolution in
platform_get_irq) and ad69674 (of/irq: do irq resolution inplatform_get_irq_byname) change the semantics ofplatform_get_irqandplatform_get_irq_bynameto 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_getfails, tryplatform_get_resourceas method of last resort. This restores the original functionality for drivers depending on platform resources to get irq information.Quoted 6 lines
Cc Russell King <[email protected]>Cc Rob Herring <[email protected]>Cc Tony Lindgren <[email protected]>Cc Grant Likely <[email protected]>Cc Grygorii Strashko <[email protected]>Signed-off-by Guenter Roeck <[email protected]>
Quoted 4 lines
Acked-by Rob Herring <[email protected]>Greg should take this for 3.16.
Doesn't seem to go anywhere. Guess it's one more patch I'll have to carry locally :-(. If anyone has a better idea how to fix the problem, please let me know.
Guenter
Greg Kroah-Hartman
maintainerQuoted 24 lines · Guenter Roeck
Quoted 23 lines · Rob Herring
Quoted 21 lines · Guenter Roeck
Commits 9ec36ca (of/irq: do irq resolution in
platform_get_irq) and ad69674 (of/irq: do irq resolution inplatform_get_irq_byname) change the semantics ofplatform_get_irqandplatform_get_irq_bynameto 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_getfails, tryplatform_get_resourceas method of last resort. This restores the original functionality for drivers depending on platform resources to get irq information.Cc Russell King <[email protected]>Cc Rob Herring <[email protected]>Cc Tony Lindgren <[email protected]>Cc Grant Likely <[email protected]>Cc Grygorii Strashko <[email protected]>Signed-off-by Guenter Roeck <[email protected]>
Quoted 7 lines
Quoted 4 lines
Acked-by Rob Herring <[email protected]>Greg should take this for 3.16.
Doesn't seem to go anywhere. Guess it's one more patch I'll have to carry locally :-(. If anyone has a better idea how to fix the problem, please let me know.
I can still queue this up, I was hoping that Grant would chime in...
greg k-h
Quoted 27 lines · Greg Kroah-Hartman
Quoted 26 lines · Guenter Roeck
Quoted 25 lines · Rob Herring
Quoted 15 lines · Guenter Roeck
Commits 9ec36ca (of/irq: do irq resolution in
platform_get_irq) and ad69674 (of/irq: do irq resolution inplatform_get_irq_byname) change the semantics ofplatform_get_irqandplatform_get_irq_bynameto 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_getfails, tryplatform_get_resourceas method of last resort. This restores the original functionality for drivers depending on platform resources to get irq information.Quoted 6 lines
Cc Russell King <[email protected]>Cc Rob Herring <[email protected]>Cc Tony Lindgren <[email protected]>Cc Grant Likely <[email protected]>Cc Grygorii Strashko <[email protected]>Signed-off-by Guenter Roeck <[email protected]>Acked-by Rob Herring <[email protected]>
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Greg should take this for 3.16.
Doesn't seem to go anywhere. Guess it's one more patch I'll have to carry locally :-(. If anyone has a better idea how to fix the problem, please let me know.
I can still queue this up, I was hoping that Grant would chime in...
Doesn't look like it.
Guenter