Skip to contentSkip to conversation

net/smsc911x: Fix deferred probe for interrupt

PATCH Applied Tony Lindgren 4 participants 5 messages Aug 28, 2015 – Aug 31, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/smsc911x: Fix deferred probe for interrupt

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 <[email protected]>
---
 drivers/net/ethernet/smsc/smsc911x.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/smsc/smsc911x.c +4 -1
index 959aeea..cb9f166f 100644
@@ -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;
Signature · 1 line
2.1.4
#2 lore raw
In reply to Tony Lindgren

Hello.

Quoted 15 lines · Tony Lindgren

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 <[email protected]>
---
  drivers/net/ethernet/smsc/smsc911x.c | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/smsc/smsc911x.c +0 -0
index 959aeea..cb9f166f 100644

drivers/net/ethernet/smsc/smsc911x.c static int smsc911x_drv_probe(struct platform_device *pdev) · line 2443

Quoted 10 lines
drivers/net/ethernet/smsc/smsc911x.c +4 -1
@@ -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

#3 lore raw
Quoted 23 lines · Sergei Shtylyov

Hello.

Quoted 19 lines · Tony Lindgren

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 <[email protected]>
---
  drivers/net/ethernet/smsc/smsc911x.c | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/smsc/smsc911x.c +0 -0
index 959aeea..cb9f166f 100644
@@ -2435,7 +2435,10 @@ static int smsc911x_drv_probe(struct 
 platform_device *pdev)
      res_size = resource_size(res);
 
Quoted 12 lines

drivers/net/ethernet/smsc/smsc911x.c static int smsc911x_drv_probe(struct platform_device *pdev) · line 2443

Quoted 8 lines
drivers/net/ethernet/smsc/smsc911x.c +4 -1
      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.

Signature · 2 lines
regards,
-grygorii
#4 lore raw

Hello.

Quoted 32 lines · Grygorii Strashko
Quoted 19 lines
Quoted 19 lines

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 <[email protected]>
---
   drivers/net/ethernet/smsc/smsc911x.c | 5 ++++-
   1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/smsc/smsc911x.c +0 -0
index 959aeea..cb9f166f 100644
@@ -2435,7 +2435,10 @@ static int smsc911x_drv_probe(struct
 platform_device *pdev)
       res_size = resource_size(res);
 
Quoted 12 lines

drivers/net/ethernet/smsc/smsc911x.c static int smsc911x_drv_probe(struct platform_device *pdev) · line 2443

Quoted 8 lines
drivers/net/ethernet/smsc/smsc911x.c +4 -1
       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).

Quoted 3 lines

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