All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] platform_get_irq: Revert to platform_get_resource if of_irq_get fails
@ 2014-06-17 22:51 Guenter Roeck
  2014-06-23 15:33 ` Guenter Roeck
  2014-06-23 15:48 ` Rob Herring
  0 siblings, 2 replies; 7+ messages in thread
From: Guenter Roeck @ 2014-06-17 22:51 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Guenter Roeck, Russell King, Rob Herring,
	Tony Lindgren, Grant Likely, Grygorii Strashko

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: Rob Herring <robh@kernel.org>
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>
---
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(-)

diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 9e9227e..eee48c4 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);
 
@@ -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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] platform_get_irq: Revert to platform_get_resource if of_irq_get fails
  2014-06-17 22:51 [PATCH v2] platform_get_irq: Revert to platform_get_resource if of_irq_get fails Guenter Roeck
@ 2014-06-23 15:33 ` Guenter Roeck
  2014-06-23 15:48 ` Rob Herring
  1 sibling, 0 replies; 7+ messages in thread
From: Guenter Roeck @ 2014-06-23 15:33 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Russell King, Rob Herring, Tony Lindgren,
	Grant Likely, Grygorii Strashko, Lee Jones, Samuel Ortiz

ping ... any comments ?

Guenter

On 06/17/2014 03:51 PM, Guenter Roeck wrote:
> 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: Rob Herring <robh@kernel.org>
> 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>
> ---
> 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(-)
>
> diff --git a/drivers/base/platform.c b/drivers/base/platform.c
> index 9e9227e..eee48c4 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);
>
> @@ -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;
>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] platform_get_irq: Revert to platform_get_resource if of_irq_get fails
  2014-06-17 22:51 [PATCH v2] platform_get_irq: Revert to platform_get_resource if of_irq_get fails Guenter Roeck
  2014-06-23 15:33 ` Guenter Roeck
@ 2014-06-23 15:48 ` Rob Herring
  2014-06-23 17:12   ` Guenter Roeck
  2014-06-30 16:18   ` Guenter Roeck
  1 sibling, 2 replies; 7+ messages in thread
From: Rob Herring @ 2014-06-23 15:48 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: linux-kernel, Greg Kroah-Hartman, Russell King, Tony Lindgren,
	Grant Likely, Grygorii Strashko

On Tue, Jun 17, 2014 at 5:51 PM, Guenter Roeck <linux@roeck-us.net> wrote:
> 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: Rob Herring <robh@kernel.org>
> 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>

Greg should take this for 3.16.

Rob

> ---
> 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(-)
>
> diff --git a/drivers/base/platform.c b/drivers/base/platform.c
> index 9e9227e..eee48c4 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);
>
> @@ -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
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] platform_get_irq: Revert to platform_get_resource if of_irq_get fails
  2014-06-23 15:48 ` Rob Herring
@ 2014-06-23 17:12   ` Guenter Roeck
  2014-06-30 16:18   ` Guenter Roeck
  1 sibling, 0 replies; 7+ messages in thread
From: Guenter Roeck @ 2014-06-23 17:12 UTC (permalink / raw)
  To: Rob Herring
  Cc: linux-kernel, Greg Kroah-Hartman, Russell King, Tony Lindgren,
	Grant Likely, Grygorii Strashko

On 06/23/2014 08:48 AM, Rob Herring wrote:
> On Tue, Jun 17, 2014 at 5:51 PM, Guenter Roeck <linux@roeck-us.net> wrote:
>> 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: Rob Herring <robh@kernel.org>
>> 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>
>
> 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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] platform_get_irq: Revert to platform_get_resource if of_irq_get fails
  2014-06-23 15:48 ` Rob Herring
  2014-06-23 17:12   ` Guenter Roeck
@ 2014-06-30 16:18   ` Guenter Roeck
  2014-06-30 16:22     ` Greg Kroah-Hartman
  1 sibling, 1 reply; 7+ messages in thread
From: Guenter Roeck @ 2014-06-30 16:18 UTC (permalink / raw)
  To: Rob Herring
  Cc: linux-kernel, Greg Kroah-Hartman, Russell King, Tony Lindgren,
	Grant Likely, Grygorii Strashko

On Mon, Jun 23, 2014 at 10:48:33AM -0500, Rob Herring wrote:
> On Tue, Jun 17, 2014 at 5:51 PM, Guenter Roeck <linux@roeck-us.net> wrote:
> > 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: Rob Herring <robh@kernel.org>
> > 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>
> 
> 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] platform_get_irq: Revert to platform_get_resource if of_irq_get fails
  2014-06-30 16:18   ` Guenter Roeck
@ 2014-06-30 16:22     ` Greg Kroah-Hartman
  2014-07-04 19:51       ` Guenter Roeck
  0 siblings, 1 reply; 7+ messages in thread
From: Greg Kroah-Hartman @ 2014-06-30 16:22 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Rob Herring, linux-kernel, Russell King, Tony Lindgren,
	Grant Likely, Grygorii Strashko

On Mon, Jun 30, 2014 at 09:18:35AM -0700, Guenter Roeck wrote:
> On Mon, Jun 23, 2014 at 10:48:33AM -0500, Rob Herring wrote:
> > On Tue, Jun 17, 2014 at 5:51 PM, Guenter Roeck <linux@roeck-us.net> wrote:
> > > 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: Rob Herring <robh@kernel.org>
> > > 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>
> > 
> > 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] platform_get_irq: Revert to platform_get_resource if of_irq_get fails
  2014-06-30 16:22     ` Greg Kroah-Hartman
@ 2014-07-04 19:51       ` Guenter Roeck
  0 siblings, 0 replies; 7+ messages in thread
From: Guenter Roeck @ 2014-07-04 19:51 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Rob Herring, linux-kernel, Russell King, Tony Lindgren,
	Grant Likely, Grygorii Strashko

On 06/30/2014 09:22 AM, Greg Kroah-Hartman wrote:
> On Mon, Jun 30, 2014 at 09:18:35AM -0700, Guenter Roeck wrote:
>> On Mon, Jun 23, 2014 at 10:48:33AM -0500, Rob Herring wrote:
>>> On Tue, Jun 17, 2014 at 5:51 PM, Guenter Roeck <linux@roeck-us.net> wrote:
>>>> 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: Rob Herring <robh@kernel.org>
>>>> 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>
>>>
>>> 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



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-07-04 19:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-17 22:51 [PATCH v2] platform_get_irq: Revert to platform_get_resource if of_irq_get fails Guenter Roeck
2014-06-23 15:33 ` Guenter Roeck
2014-06-23 15:48 ` Rob Herring
2014-06-23 17:12   ` Guenter Roeck
2014-06-30 16:18   ` Guenter Roeck
2014-06-30 16:22     ` Greg Kroah-Hartman
2014-07-04 19:51       ` Guenter Roeck

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.