netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm driver net macb
@ 2010-09-02 20:40 Paul Chavent
  2010-09-03 13:41 ` Nicolas Ferre
  0 siblings, 1 reply; 2+ messages in thread
From: Paul Chavent @ 2010-09-02 20:40 UTC (permalink / raw)
  Cc: linux-kernel, netdev, eric.dumazet, jkosina, richard.cochran,
	jpirko, davem, nicolas.ferre

[-- Attachment #1: Type: text/plain, Size: 292 bytes --]

When listing processes on a system with SOFT/HARD_IRQ enabled, the name of the ethernet device is [irq/eth%d] (instead of [irq/eth0] for example).

This patch call the request_irq function after having initialized the name of the device.

Signed-off-by: Paul Chavent <paul.chavent@fnac.net>


[-- Attachment #2: linux-2.6.35.4-arm_at91_ethname.patch --]
[-- Type: text/plain, Size: 1907 bytes --]

diff -abBruN linux-2.6.35.4.orig/drivers/net/macb.c linux-2.6.35.4.mod/drivers/net/macb.c
--- linux-2.6.35.4.orig/drivers/net/macb.c	2010-09-02 17:35:18.422000143 +0200
+++ linux-2.6.35.4.mod/drivers/net/macb.c	2010-09-02 18:02:37.078000147 +0200
@@ -1165,16 +1242,6 @@
 		goto err_out_disable_clocks;
 	}
 
-	dev->irq = platform_get_irq(pdev, 0);
-	err = request_irq(dev->irq, macb_interrupt, IRQF_SAMPLE_RANDOM,
-			  dev->name, dev);
-	if (err) {
-		printk(KERN_ERR
-		       "%s: Unable to request IRQ %d (error %d)\n",
-		       dev->name, dev->irq, err);
-		goto err_out_iounmap;
-	}
-
 	dev->netdev_ops = &macb_netdev_ops;
 	netif_napi_add(dev, &bp->napi, macb_poll, 64);
 	dev->ethtool_ops = &macb_ethtool_ops;
@@ -1214,13 +1281,23 @@
 	err = register_netdev(dev);
 	if (err) {
 		dev_err(&pdev->dev, "Cannot register net device, aborting.\n");
-		goto err_out_free_irq;
+		goto err_out_iounmap;
 	}
 
 	if (macb_mii_init(bp) != 0) {
 		goto err_out_unregister_netdev;
 	}
 
+	dev->irq = platform_get_irq(pdev, 0);
+	err = request_irq(dev->irq, macb_interrupt, IRQF_SAMPLE_RANDOM,
+			  dev->name, dev);
+	if (err) {
+		printk(KERN_ERR
+		       "%s: Unable to request IRQ %d (error %d)\n",
+		       dev->name, dev->irq, err);
+		goto err_out_unregister_netdev;
+	}
+
 	platform_set_drvdata(pdev, dev);
 
 	printk(KERN_INFO "%s: Atmel MACB at 0x%08lx irq %d (%pM)\n",
@@ -1233,10 +1310,10 @@
 
 	return 0;
 
-err_out_unregister_netdev:
-	unregister_netdev(dev);
 err_out_free_irq:
 	free_irq(dev->irq, dev);
+err_out_unregister_netdev:
+	unregister_netdev(dev);
 err_out_iounmap:
 	iounmap(bp->regs);
 err_out_disable_clocks:
@@ -1270,8 +1347,8 @@
 		mdiobus_unregister(bp->mii_bus);
 		kfree(bp->mii_bus->irq);
 		mdiobus_free(bp->mii_bus);
-		unregister_netdev(dev);
 		free_irq(dev->irq, dev);
+		unregister_netdev(dev);
 		iounmap(bp->regs);
 #ifndef CONFIG_ARCH_AT91
 		clk_disable(bp->hclk);

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

* Re: [PATCH] arm driver net macb
  2010-09-02 20:40 [PATCH] arm driver net macb Paul Chavent
@ 2010-09-03 13:41 ` Nicolas Ferre
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Ferre @ 2010-09-03 13:41 UTC (permalink / raw)
  To: Paul Chavent
  Cc: linux-kernel, netdev, eric.dumazet, jkosina, richard.cochran,
	jpirko, davem

Le 02/09/2010 22:40, Paul Chavent :
> When listing processes on a system with SOFT/HARD_IRQ enabled, the name
> of the ethernet device is [irq/eth%d] (instead of [irq/eth0] for example).
> 
> This patch call the request_irq function after having initialized the
> name of the device.
> 
> Signed-off-by: Paul Chavent <paul.chavent@fnac.net>

[..]

> @@ -1214,13 +1281,23 @@
>  	err = register_netdev(dev);
>  	if (err) {
>  		dev_err(&pdev->dev, "Cannot register net device, aborting.\n");
> -		goto err_out_free_irq;
> +		goto err_out_iounmap;
>  	}
>  
>  	if (macb_mii_init(bp) != 0) {
>  		goto err_out_unregister_netdev;
>  	}
>  
> +	dev->irq = platform_get_irq(pdev, 0);
> +	err = request_irq(dev->irq, macb_interrupt, IRQF_SAMPLE_RANDOM,
> +			  dev->name, dev);
> +	if (err) {
> +		printk(KERN_ERR
> +		       "%s: Unable to request IRQ %d (error %d)\n",
> +		       dev->name, dev->irq, err);
> +		goto err_out_unregister_netdev;
> +	}
> +

The string is modified in register_netdev() so why don't you deal 
with IRQ just after it? I would have placed the code snippet 
before macb_mii_init(): what do you think about this?

Best regards,
-- 
Nicolas Ferre

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

end of thread, other threads:[~2010-09-03 13:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-02 20:40 [PATCH] arm driver net macb Paul Chavent
2010-09-03 13:41 ` Nicolas Ferre

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).