Patchwork smc-ultra: get rid of "eth%d" message

login
register
mail settings
Submitter Németh Márton
Date Jan. 11, 2009, 10:54 a.m.
Message ID <4969CFF2.9020202@freemail.hu>
Download mbox | patch
Permalink /patch/17793/
State Changes Requested
Delegated to: David Miller
Headers show

Comments

Németh Márton - Jan. 11, 2009, 10:54 a.m.
From: Márton Németh <nm127@freemail.hu>

Print out the dev->name only after register_netdev().  If the dev->name is
printk()ed out before calling register_netdev() the result will be "eth%d"
in the dmesg instead of "eth0".

Signed-off-by: Márton Németh <nm127@freemail.hu>
---
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
stephen hemminger - Jan. 12, 2009, 4:24 p.m.
On Sun, 11 Jan 2009 11:54:42 +0100
Németh Márton <nm127@freemail.hu> wrote:

> From: Márton Németh <nm127@freemail.hu>
> 
> Print out the dev->name only after register_netdev().  If the dev->name is
> printk()ed out before calling register_netdev() the result will be "eth%d"
> in the dmesg instead of "eth0".
> 
> Signed-off-by: Márton Németh <nm127@freemail.hu>
> ---
> --- linux-2.6.28/drivers/net/smc-ultra.c.orig	2009-01-10 20:57:36.000000000 +0100
> +++ linux-2.6.28/drivers/net/smc-ultra.c	2009-01-10 20:59:48.000000000 +0100
> @@ -228,9 +228,6 @@ static int __init ultra_probe1(struct ne
>  	for (i = 0; i < 6; i++)
>  		dev->dev_addr[i] = inb(ioaddr + 8 + i);
> 
> -	printk("%s: %s at %#3x, %s", dev->name, model_name,
> -	       ioaddr, print_mac(mac, dev->dev_addr));
> -
>  	/* Switch from the station address to the alternate register set and
>  	   read the useful registers there. */
>  	outb(0x80 | reg4, ioaddr + 4);
> @@ -253,8 +250,10 @@ static int __init ultra_probe1(struct ne
>  		irq = irqmap[((irqreg & 0x40) >> 4) + ((irqreg & 0x0c) >> 2)];
> 
>  		if (irq == 0) {
> -			printk(", failed to detect IRQ line.\n");
> -			retval =  -EAGAIN;
> +			printk(KERN_ERR "%s at %#3x, %s, "
> +			       "failed to detect IRQ line.\n", model_name,
> +			       ioaddr, print_mac(mac, dev->dev_addr));
> +			retval = -EAGAIN;
>  			goto out;
>  		}
>  		dev->irq = irq;
> @@ -280,22 +279,19 @@ static int __init ultra_probe1(struct ne
> 
>  	ei_status.mem = ioremap(dev->mem_start, (ei_status.stop_page - START_PG)*256);
>  	if (!ei_status.mem) {
> -		printk(", failed to ioremap.\n");
> -		retval =  -ENOMEM;
> +		printk(KERN_ERR "%s at %#3x, %s, failed to ioremap.\n",
> +		       model_name, ioaddr, print_mac(mac, dev->dev_addr));

Use dev_err() instead, it gives useful PCI information.

> +		retval = -ENOMEM;
>  		goto out;
>  	}
> 
>  	dev->mem_end = dev->mem_start + (ei_status.stop_page - START_PG)*256;
> 
>  	if (piomode) {
> -		printk(",%s IRQ %d programmed-I/O mode.\n",
> -			   eeprom_irq ? "EEPROM" : "assigned ", dev->irq);
>  		ei_status.block_input = &ultra_pio_input;
>  		ei_status.block_output = &ultra_pio_output;
>  		ei_status.get_8390_hdr = &ultra_pio_get_hdr;
>  	} else {
> -		printk(",%s IRQ %d memory %#lx-%#lx.\n", eeprom_irq ? "" : "assigned ",
> -			   dev->irq, dev->mem_start, dev->mem_end-1);
>  		ei_status.block_input = &ultra_block_input;
>  		ei_status.block_output = &ultra_block_output;
>  		ei_status.get_8390_hdr = &ultra_get_8390_hdr;
> @@ -311,6 +307,21 @@ static int __init ultra_probe1(struct ne
>  	retval = register_netdev(dev);
>  	if (retval)
>  		goto out;
> +
> +	if (piomode) {
> +		printk(KERN_INFO "%s: %s at %#3x, %s,"
> +			"%s IRQ %d programmed-I/O mode.\n",
> +			dev->name, model_name, ioaddr,
> +			print_mac(mac, dev->dev_addr),
> +			eeprom_irq ? " EEPROM" : " assigned", dev->irq);
> +	} else {
> +		printk(KERN_INFO "%s: %s at %#3x, %s,"
> +			"%s IRQ %d memory %#lx-%#lx.\n",
> +			dev->name, model_name, ioaddr,
> +			print_mac(mac, dev->dev_addr),
> +			eeprom_irq ? "" : " assigned",
> +			dev->irq, dev->mem_start, dev->mem_end-1);
> +	}
>
dev_info?
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

--- linux-2.6.28/drivers/net/smc-ultra.c.orig	2009-01-10 20:57:36.000000000 +0100
+++ linux-2.6.28/drivers/net/smc-ultra.c	2009-01-10 20:59:48.000000000 +0100
@@ -228,9 +228,6 @@  static int __init ultra_probe1(struct ne
 	for (i = 0; i < 6; i++)
 		dev->dev_addr[i] = inb(ioaddr + 8 + i);

-	printk("%s: %s at %#3x, %s", dev->name, model_name,
-	       ioaddr, print_mac(mac, dev->dev_addr));
-
 	/* Switch from the station address to the alternate register set and
 	   read the useful registers there. */
 	outb(0x80 | reg4, ioaddr + 4);
@@ -253,8 +250,10 @@  static int __init ultra_probe1(struct ne
 		irq = irqmap[((irqreg & 0x40) >> 4) + ((irqreg & 0x0c) >> 2)];

 		if (irq == 0) {
-			printk(", failed to detect IRQ line.\n");
-			retval =  -EAGAIN;
+			printk(KERN_ERR "%s at %#3x, %s, "
+			       "failed to detect IRQ line.\n", model_name,
+			       ioaddr, print_mac(mac, dev->dev_addr));
+			retval = -EAGAIN;
 			goto out;
 		}
 		dev->irq = irq;
@@ -280,22 +279,19 @@  static int __init ultra_probe1(struct ne

 	ei_status.mem = ioremap(dev->mem_start, (ei_status.stop_page - START_PG)*256);
 	if (!ei_status.mem) {
-		printk(", failed to ioremap.\n");
-		retval =  -ENOMEM;
+		printk(KERN_ERR "%s at %#3x, %s, failed to ioremap.\n",
+		       model_name, ioaddr, print_mac(mac, dev->dev_addr));
+		retval = -ENOMEM;
 		goto out;
 	}

 	dev->mem_end = dev->mem_start + (ei_status.stop_page - START_PG)*256;

 	if (piomode) {
-		printk(",%s IRQ %d programmed-I/O mode.\n",
-			   eeprom_irq ? "EEPROM" : "assigned ", dev->irq);
 		ei_status.block_input = &ultra_pio_input;
 		ei_status.block_output = &ultra_pio_output;
 		ei_status.get_8390_hdr = &ultra_pio_get_hdr;
 	} else {
-		printk(",%s IRQ %d memory %#lx-%#lx.\n", eeprom_irq ? "" : "assigned ",
-			   dev->irq, dev->mem_start, dev->mem_end-1);
 		ei_status.block_input = &ultra_block_input;
 		ei_status.block_output = &ultra_block_output;
 		ei_status.get_8390_hdr = &ultra_get_8390_hdr;
@@ -311,6 +307,21 @@  static int __init ultra_probe1(struct ne
 	retval = register_netdev(dev);
 	if (retval)
 		goto out;
+
+	if (piomode) {
+		printk(KERN_INFO "%s: %s at %#3x, %s,"
+			"%s IRQ %d programmed-I/O mode.\n",
+			dev->name, model_name, ioaddr,
+			print_mac(mac, dev->dev_addr),
+			eeprom_irq ? " EEPROM" : " assigned", dev->irq);
+	} else {
+		printk(KERN_INFO "%s: %s at %#3x, %s,"
+			"%s IRQ %d memory %#lx-%#lx.\n",
+			dev->name, model_name, ioaddr,
+			print_mac(mac, dev->dev_addr),
+			eeprom_irq ? "" : " assigned",
+			dev->irq, dev->mem_start, dev->mem_end-1);
+	}
 	return 0;
 out:
 	release_region(ioaddr, ULTRA_IO_EXTENT);