netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net/smsc911x: Fix deferred probe for interrupt
@ 2015-08-28 18:50 Tony Lindgren
  2015-08-29 20:09 ` David Miller
  2015-08-29 21:33 ` Sergei Shtylyov
  0 siblings, 2 replies; 5+ messages in thread
From: Tony Lindgren @ 2015-08-28 18:50 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, linux-omap, Steve Glendinning

The interrupt handler may not be available when smsc911x probes if the
interrupt handler is a GPIO controller for example. Let's fix that
by adding handling for -EPROBE_DEFER.

Cc: Steve Glendinning <steve.glendinning@shawell.net>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 drivers/net/ethernet/smsc/smsc911x.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c
index 959aeea..cb9f166f 100644
--- a/drivers/net/ethernet/smsc/smsc911x.c
+++ b/drivers/net/ethernet/smsc/smsc911x.c
@@ -2435,7 +2435,10 @@ static int smsc911x_drv_probe(struct platform_device *pdev)
 	res_size = resource_size(res);
 
 	irq = platform_get_irq(pdev, 0);
-	if (irq <= 0) {
+	if (irq == -EPROBE_DEFER) {
+		retval = -EPROBE_DEFER;
+		goto out_0;
+	} else if (irq <= 0) {
 		pr_warn("Could not allocate irq resource\n");
 		retval = -ENODEV;
 		goto out_0;
-- 
2.1.4

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

* Re: [PATCH] net/smsc911x: Fix deferred probe for interrupt
  2015-08-28 18:50 [PATCH] net/smsc911x: Fix deferred probe for interrupt Tony Lindgren
@ 2015-08-29 20:09 ` David Miller
  2015-08-29 21:33 ` Sergei Shtylyov
  1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2015-08-29 20:09 UTC (permalink / raw)
  To: tony; +Cc: netdev, linux-omap, steve.glendinning

From: Tony Lindgren <tony@atomide.com>
Date: Fri, 28 Aug 2015 11:50:15 -0700

> The interrupt handler may not be available when smsc911x probes if the
> interrupt handler is a GPIO controller for example. Let's fix that
> by adding handling for -EPROBE_DEFER.
> 
> Cc: Steve Glendinning <steve.glendinning@shawell.net>
> Signed-off-by: Tony Lindgren <tony@atomide.com>

Applied, thanks.

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

* Re: [PATCH] net/smsc911x: Fix deferred probe for interrupt
  2015-08-28 18:50 [PATCH] net/smsc911x: Fix deferred probe for interrupt Tony Lindgren
  2015-08-29 20:09 ` David Miller
@ 2015-08-29 21:33 ` Sergei Shtylyov
  2015-08-31 14:03   ` Grygorii Strashko
  1 sibling, 1 reply; 5+ messages in thread
From: Sergei Shtylyov @ 2015-08-29 21:33 UTC (permalink / raw)
  To: Tony Lindgren, David Miller; +Cc: netdev, linux-omap, Steve Glendinning

Hello.

On 8/28/2015 9:50 PM, Tony Lindgren wrote:

> The interrupt handler may not be available when smsc911x probes if the
> interrupt handler is a GPIO controller for example. Let's fix that
> by adding handling for -EPROBE_DEFER.

> Cc: Steve Glendinning <steve.glendinning@shawell.net>
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---
>   drivers/net/ethernet/smsc/smsc911x.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c
> index 959aeea..cb9f166f 100644
> --- a/drivers/net/ethernet/smsc/smsc911x.c
> +++ b/drivers/net/ethernet/smsc/smsc911x.c
> @@ -2435,7 +2435,10 @@ static int smsc911x_drv_probe(struct platform_device *pdev)
>   	res_size = resource_size(res);
>
>   	irq = platform_get_irq(pdev, 0);
> -	if (irq <= 0) {
> +	if (irq == -EPROBE_DEFER) {
> +		retval = -EPROBE_DEFER;
> +		goto out_0;
> +	} else if (irq <= 0) {
>   		pr_warn("Could not allocate irq resource\n");
>   		retval = -ENODEV;

    I'd propagate the error code from platfrom_get_irq() instead (in fact, 
I've submitted a couple of such patches yesterday and they have been already 
merged).

[...]

NBR, Sergei

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

* Re: [PATCH] net/smsc911x: Fix deferred probe for interrupt
  2015-08-29 21:33 ` Sergei Shtylyov
@ 2015-08-31 14:03   ` Grygorii Strashko
  2015-08-31 17:05     ` Sergei Shtylyov
  0 siblings, 1 reply; 5+ messages in thread
From: Grygorii Strashko @ 2015-08-31 14:03 UTC (permalink / raw)
  To: Sergei Shtylyov, Tony Lindgren, David Miller, Geert Uytterhoeven
  Cc: netdev, linux-omap, Steve Glendinning

On 08/30/2015 12:33 AM, Sergei Shtylyov wrote:
> Hello.
> 
> On 8/28/2015 9:50 PM, Tony Lindgren wrote:
> 
>> The interrupt handler may not be available when smsc911x probes if the
>> interrupt handler is a GPIO controller for example. Let's fix that
>> by adding handling for -EPROBE_DEFER.
> 
>> Cc: Steve Glendinning <steve.glendinning@shawell.net>
>> Signed-off-by: Tony Lindgren <tony@atomide.com>
>> ---
>>   drivers/net/ethernet/smsc/smsc911x.c | 5 ++++-
>>   1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/ethernet/smsc/smsc911x.c 
>> b/drivers/net/ethernet/smsc/smsc911x.c
>> index 959aeea..cb9f166f 100644
>> --- a/drivers/net/ethernet/smsc/smsc911x.c
>> +++ b/drivers/net/ethernet/smsc/smsc911x.c
>> @@ -2435,7 +2435,10 @@ static int smsc911x_drv_probe(struct 
>> platform_device *pdev)
>>       res_size = resource_size(res);
>>
>>       irq = platform_get_irq(pdev, 0);
>> -    if (irq <= 0) {
>> +    if (irq == -EPROBE_DEFER) {
>> +        retval = -EPROBE_DEFER;
>> +        goto out_0;
>> +    } else if (irq <= 0) {
>>           pr_warn("Could not allocate irq resource\n");
>>           retval = -ENODEV;
> 
>     I'd propagate the error code from platfrom_get_irq() instead (in 
> fact, I've submitted a couple of such patches yesterday and they have 
> been already merged).

Have you paid some attention on current platform_get_irq_() implementation?

The platform_get_irq() can return 0 in case of DT-boot.


-- 
regards,
-grygorii

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

* Re: [PATCH] net/smsc911x: Fix deferred probe for interrupt
  2015-08-31 14:03   ` Grygorii Strashko
@ 2015-08-31 17:05     ` Sergei Shtylyov
  0 siblings, 0 replies; 5+ messages in thread
From: Sergei Shtylyov @ 2015-08-31 17:05 UTC (permalink / raw)
  To: Grygorii Strashko, Tony Lindgren, David Miller,
	Geert Uytterhoeven
  Cc: netdev, linux-omap, Steve Glendinning

Hello.

On 08/31/2015 05:03 PM, Grygorii Strashko wrote:

>>> The interrupt handler may not be available when smsc911x probes if the
>>> interrupt handler is a GPIO controller for example. Let's fix that
>>> by adding handling for -EPROBE_DEFER.
>>
>>> Cc: Steve Glendinning <steve.glendinning@shawell.net>
>>> Signed-off-by: Tony Lindgren <tony@atomide.com>
>>> ---
>>>    drivers/net/ethernet/smsc/smsc911x.c | 5 ++++-
>>>    1 file changed, 4 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/net/ethernet/smsc/smsc911x.c
>>> b/drivers/net/ethernet/smsc/smsc911x.c
>>> index 959aeea..cb9f166f 100644
>>> --- a/drivers/net/ethernet/smsc/smsc911x.c
>>> +++ b/drivers/net/ethernet/smsc/smsc911x.c
>>> @@ -2435,7 +2435,10 @@ static int smsc911x_drv_probe(struct
>>> platform_device *pdev)
>>>        res_size = resource_size(res);
>>>
>>>        irq = platform_get_irq(pdev, 0);
>>> -    if (irq <= 0) {
>>> +    if (irq == -EPROBE_DEFER) {
>>> +        retval = -EPROBE_DEFER;
>>> +        goto out_0;
>>> +    } else if (irq <= 0) {
>>>            pr_warn("Could not allocate irq resource\n");
>>>            retval = -ENODEV;
>>
>>      I'd propagate the error code from platfrom_get_irq() instead (in
>> fact, I've submitted a couple of such patches yesterday and they have
>> been already merged).

> Have you paid some attention on current platform_get_irq_() implementation?

> The platform_get_irq() can return 0 in case of DT-boot.

    This is what's indeed worth filtering out and converting to -ENODEV. ;-)
But my patches just ignored this possibility. I'm not at all fond of Linus' 
idea about IRQ0 being invalid, BTW...

WBR, Sergei

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

end of thread, other threads:[~2015-08-31 17:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-28 18:50 [PATCH] net/smsc911x: Fix deferred probe for interrupt Tony Lindgren
2015-08-29 20:09 ` David Miller
2015-08-29 21:33 ` Sergei Shtylyov
2015-08-31 14:03   ` Grygorii Strashko
2015-08-31 17:05     ` Sergei Shtylyov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).