Commit c251c7f7 authored by Joe Perches's avatar Joe Perches Committed by David S. Miller

drivers/net/tulip/eeprom.c: fix bogus "(null)" in tulip init messages

On Wed, 2010-03-10 at 08:41 -0800, David Miller wrote:
> From: Mikael Pettersson <mikpe@it.uu.se>
> Date: Wed, 10 Mar 2010 16:33:28 +0100
> > Booting 2.6.34-rc1 on a machine with a tulip nic I see
> > a number of kernel messages that include "(null)" where
> > previous kernels included the string "tulip0":
> CC:'ing the guilty party :-)  It's one of the following
> commits:

Thanks Mikael.

Anonymity has some good attributes.
Blame avoidance is one of them.

I've broad shoulders.  It's me, then Dwight Howard...

There might be another few of these where ->name or ->dev
was used before struct device or net_device was registered.
I'll go back and check.

tulip_core has:

	if (tp->flags & HAS_MEDIA_TABLE) {
		sprintf(dev->name, DRV_NAME "%d", board_idx);	/* hack */
		tulip_parse_eeprom(dev);
		strcpy(dev->name, "eth%d");			/* un-hack */
	}

So I don't feel _too_ bad.

tulip_parse_eeprom is done before register_netdev so the logging
there can not use netdev_<level> or dev_<level>(&dev->dev
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Tested-by: default avatarMikael Pettersson <mikpe@it.uu.se>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2a400189
...@@ -143,6 +143,12 @@ static void __devinit tulip_build_fake_mediatable(struct tulip_private *tp) ...@@ -143,6 +143,12 @@ static void __devinit tulip_build_fake_mediatable(struct tulip_private *tp)
void __devinit tulip_parse_eeprom(struct net_device *dev) void __devinit tulip_parse_eeprom(struct net_device *dev)
{ {
/*
dev is not registered at this point, so logging messages can't
use dev_<level> or netdev_<level> but dev->name is good via a
hack in the caller
*/
/* The last media info list parsed, for multiport boards. */ /* The last media info list parsed, for multiport boards. */
static struct mediatable *last_mediatable; static struct mediatable *last_mediatable;
static unsigned char *last_ee_data; static unsigned char *last_ee_data;
...@@ -161,15 +167,14 @@ void __devinit tulip_parse_eeprom(struct net_device *dev) ...@@ -161,15 +167,14 @@ void __devinit tulip_parse_eeprom(struct net_device *dev)
if (ee_data[0] == 0xff) { if (ee_data[0] == 0xff) {
if (last_mediatable) { if (last_mediatable) {
controller_index++; controller_index++;
dev_info(&dev->dev, pr_info("%s: Controller %d of multiport board\n",
"Controller %d of multiport board\n", dev->name, controller_index);
controller_index);
tp->mtable = last_mediatable; tp->mtable = last_mediatable;
ee_data = last_ee_data; ee_data = last_ee_data;
goto subsequent_board; goto subsequent_board;
} else } else
dev_info(&dev->dev, pr_info("%s: Missing EEPROM, this interface may not work correctly!\n",
"Missing EEPROM, this interface may not work correctly!\n"); dev->name);
return; return;
} }
/* Do a fix-up based on the vendor half of the station address prefix. */ /* Do a fix-up based on the vendor half of the station address prefix. */
...@@ -181,15 +186,14 @@ void __devinit tulip_parse_eeprom(struct net_device *dev) ...@@ -181,15 +186,14 @@ void __devinit tulip_parse_eeprom(struct net_device *dev)
i++; /* An Accton EN1207, not an outlaw Maxtech. */ i++; /* An Accton EN1207, not an outlaw Maxtech. */
memcpy(ee_data + 26, eeprom_fixups[i].newtable, memcpy(ee_data + 26, eeprom_fixups[i].newtable,
sizeof(eeprom_fixups[i].newtable)); sizeof(eeprom_fixups[i].newtable));
dev_info(&dev->dev, pr_info("%s: Old format EEPROM on '%s' board. Using substitute media control info\n",
"Old format EEPROM on '%s' board. Using substitute media control info\n", dev->name, eeprom_fixups[i].name);
eeprom_fixups[i].name);
break; break;
} }
} }
if (eeprom_fixups[i].name == NULL) { /* No fixup found. */ if (eeprom_fixups[i].name == NULL) { /* No fixup found. */
dev_info(&dev->dev, pr_info("%s: Old style EEPROM with no media selection information\n",
"Old style EEPROM with no media selection information\n"); dev->name);
return; return;
} }
} }
...@@ -217,8 +221,8 @@ void __devinit tulip_parse_eeprom(struct net_device *dev) ...@@ -217,8 +221,8 @@ void __devinit tulip_parse_eeprom(struct net_device *dev)
/* there is no phy information, don't even try to build mtable */ /* there is no phy information, don't even try to build mtable */
if (count == 0) { if (count == 0) {
if (tulip_debug > 0) if (tulip_debug > 0)
dev_warn(&dev->dev, pr_warning("%s: no phy info, aborting mtable build\n",
"no phy info, aborting mtable build\n"); dev->name);
return; return;
} }
...@@ -234,8 +238,10 @@ void __devinit tulip_parse_eeprom(struct net_device *dev) ...@@ -234,8 +238,10 @@ void __devinit tulip_parse_eeprom(struct net_device *dev)
mtable->has_nonmii = mtable->has_mii = mtable->has_reset = 0; mtable->has_nonmii = mtable->has_mii = mtable->has_reset = 0;
mtable->csr15dir = mtable->csr15val = 0; mtable->csr15dir = mtable->csr15val = 0;
dev_info(&dev->dev, "EEPROM default media type %s\n", pr_info("%s: EEPROM default media type %s\n",
media & 0x0800 ? "Autosense" : medianame[media & MEDIA_MASK]); dev->name,
media & 0x0800 ? "Autosense"
: medianame[media & MEDIA_MASK]);
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
struct medialeaf *leaf = &mtable->mleaf[i]; struct medialeaf *leaf = &mtable->mleaf[i];
...@@ -298,14 +304,14 @@ void __devinit tulip_parse_eeprom(struct net_device *dev) ...@@ -298,14 +304,14 @@ void __devinit tulip_parse_eeprom(struct net_device *dev)
} }
if (tulip_debug > 1 && leaf->media == 11) { if (tulip_debug > 1 && leaf->media == 11) {
unsigned char *bp = leaf->leafdata; unsigned char *bp = leaf->leafdata;
dev_info(&dev->dev, pr_info("%s: MII interface PHY %d, setup/reset sequences %d/%d long, capabilities %02x %02x\n",
"MII interface PHY %d, setup/reset sequences %d/%d long, capabilities %02x %02x\n", dev->name,
bp[0], bp[1], bp[2 + bp[1]*2], bp[0], bp[1], bp[2 + bp[1]*2],
bp[5 + bp[2 + bp[1]*2]*2], bp[5 + bp[2 + bp[1]*2]*2],
bp[4 + bp[2 + bp[1]*2]*2]); bp[4 + bp[2 + bp[1]*2]*2]);
} }
dev_info(&dev->dev, pr_info("%s: Index #%d - Media %s (#%d) described by a %s (%d) block\n",
"Index #%d - Media %s (#%d) described by a %s (%d) block\n", dev->name,
i, medianame[leaf->media & 15], leaf->media, i, medianame[leaf->media & 15], leaf->media,
leaf->type < ARRAY_SIZE(block_name) ? block_name[leaf->type] : "<unknown>", leaf->type < ARRAY_SIZE(block_name) ? block_name[leaf->type] : "<unknown>",
leaf->type); leaf->type);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment