diff mbox

net/smsc911x: Fix deferred probe for interrupt

Message ID 1440787815-24655-1-git-send-email-tony@atomide.com (mailing list archive)
State New, archived
Headers show

Commit Message

Tony Lindgren Aug. 28, 2015, 6:50 p.m. UTC
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(-)

Comments

David Miller Aug. 29, 2015, 8:09 p.m. UTC | #1
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.
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sergei Shtylyov Aug. 29, 2015, 9:33 p.m. UTC | #2
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

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Grygorii Strashko Aug. 31, 2015, 2:03 p.m. UTC | #3
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.
Sergei Shtylyov Aug. 31, 2015, 5:05 p.m. UTC | #4
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

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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;