diff options
author | Joe Perches <joe@perches.com> | 2010-03-13 15:26:15 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-03-13 15:26:15 -0500 |
commit | c251c7f738cd94eb3a1febda318078c661eccb4d (patch) | |
tree | 289938bee0931996df4c195f5ea459444bfcf5e6 /drivers/net/tulip/eeprom.c | |
parent | 2a40018984c5c9647df1c18489449a3a227d9136 (diff) |
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: Joe Perches <joe@perches.com>
Tested-by: Mikael Pettersson <mikpe@it.uu.se>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tulip/eeprom.c')
-rw-r--r-- | drivers/net/tulip/eeprom.c | 54 |
1 files changed, 30 insertions, 24 deletions
diff --git a/drivers/net/tulip/eeprom.c b/drivers/net/tulip/eeprom.c index 93f4e8309f81..49f05d1431f5 100644 --- a/drivers/net/tulip/eeprom.c +++ b/drivers/net/tulip/eeprom.c | |||
@@ -143,6 +143,12 @@ static void __devinit tulip_build_fake_mediatable(struct tulip_private *tp) | |||
143 | 143 | ||
144 | void __devinit tulip_parse_eeprom(struct net_device *dev) | 144 | void __devinit tulip_parse_eeprom(struct net_device *dev) |
145 | { | 145 | { |
146 | /* | ||
147 | dev is not registered at this point, so logging messages can't | ||
148 | use dev_<level> or netdev_<level> but dev->name is good via a | ||
149 | hack in the caller | ||
150 | */ | ||
151 | |||
146 | /* The last media info list parsed, for multiport boards. */ | 152 | /* The last media info list parsed, for multiport boards. */ |
147 | static struct mediatable *last_mediatable; | 153 | static struct mediatable *last_mediatable; |
148 | static unsigned char *last_ee_data; | 154 | static unsigned char *last_ee_data; |
@@ -161,15 +167,14 @@ void __devinit tulip_parse_eeprom(struct net_device *dev) | |||
161 | if (ee_data[0] == 0xff) { | 167 | if (ee_data[0] == 0xff) { |
162 | if (last_mediatable) { | 168 | if (last_mediatable) { |
163 | controller_index++; | 169 | controller_index++; |
164 | dev_info(&dev->dev, | 170 | pr_info("%s: Controller %d of multiport board\n", |
165 | "Controller %d of multiport board\n", | 171 | dev->name, controller_index); |
166 | controller_index); | ||
167 | tp->mtable = last_mediatable; | 172 | tp->mtable = last_mediatable; |
168 | ee_data = last_ee_data; | 173 | ee_data = last_ee_data; |
169 | goto subsequent_board; | 174 | goto subsequent_board; |
170 | } else | 175 | } else |
171 | dev_info(&dev->dev, | 176 | pr_info("%s: Missing EEPROM, this interface may not work correctly!\n", |
172 | "Missing EEPROM, this interface may not work correctly!\n"); | 177 | dev->name); |
173 | return; | 178 | return; |
174 | } | 179 | } |
175 | /* Do a fix-up based on the vendor half of the station address prefix. */ | 180 | /* 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 | i++; /* An Accton EN1207, not an outlaw Maxtech. */ | 186 | i++; /* An Accton EN1207, not an outlaw Maxtech. */ |
182 | memcpy(ee_data + 26, eeprom_fixups[i].newtable, | 187 | memcpy(ee_data + 26, eeprom_fixups[i].newtable, |
183 | sizeof(eeprom_fixups[i].newtable)); | 188 | sizeof(eeprom_fixups[i].newtable)); |
184 | dev_info(&dev->dev, | 189 | pr_info("%s: Old format EEPROM on '%s' board. Using substitute media control info\n", |
185 | "Old format EEPROM on '%s' board. Using substitute media control info\n", | 190 | dev->name, eeprom_fixups[i].name); |
186 | eeprom_fixups[i].name); | ||
187 | break; | 191 | break; |
188 | } | 192 | } |
189 | } | 193 | } |
190 | if (eeprom_fixups[i].name == NULL) { /* No fixup found. */ | 194 | if (eeprom_fixups[i].name == NULL) { /* No fixup found. */ |
191 | dev_info(&dev->dev, | 195 | pr_info("%s: Old style EEPROM with no media selection information\n", |
192 | "Old style EEPROM with no media selection information\n"); | 196 | dev->name); |
193 | return; | 197 | return; |
194 | } | 198 | } |
195 | } | 199 | } |
@@ -217,8 +221,8 @@ subsequent_board: | |||
217 | /* there is no phy information, don't even try to build mtable */ | 221 | /* there is no phy information, don't even try to build mtable */ |
218 | if (count == 0) { | 222 | if (count == 0) { |
219 | if (tulip_debug > 0) | 223 | if (tulip_debug > 0) |
220 | dev_warn(&dev->dev, | 224 | pr_warning("%s: no phy info, aborting mtable build\n", |
221 | "no phy info, aborting mtable build\n"); | 225 | dev->name); |
222 | return; | 226 | return; |
223 | } | 227 | } |
224 | 228 | ||
@@ -234,8 +238,10 @@ subsequent_board: | |||
234 | mtable->has_nonmii = mtable->has_mii = mtable->has_reset = 0; | 238 | mtable->has_nonmii = mtable->has_mii = mtable->has_reset = 0; |
235 | mtable->csr15dir = mtable->csr15val = 0; | 239 | mtable->csr15dir = mtable->csr15val = 0; |
236 | 240 | ||
237 | dev_info(&dev->dev, "EEPROM default media type %s\n", | 241 | pr_info("%s: EEPROM default media type %s\n", |
238 | media & 0x0800 ? "Autosense" : medianame[media & MEDIA_MASK]); | 242 | dev->name, |
243 | media & 0x0800 ? "Autosense" | ||
244 | : medianame[media & MEDIA_MASK]); | ||
239 | for (i = 0; i < count; i++) { | 245 | for (i = 0; i < count; i++) { |
240 | struct medialeaf *leaf = &mtable->mleaf[i]; | 246 | struct medialeaf *leaf = &mtable->mleaf[i]; |
241 | 247 | ||
@@ -298,17 +304,17 @@ subsequent_board: | |||
298 | } | 304 | } |
299 | if (tulip_debug > 1 && leaf->media == 11) { | 305 | if (tulip_debug > 1 && leaf->media == 11) { |
300 | unsigned char *bp = leaf->leafdata; | 306 | unsigned char *bp = leaf->leafdata; |
301 | dev_info(&dev->dev, | 307 | pr_info("%s: MII interface PHY %d, setup/reset sequences %d/%d long, capabilities %02x %02x\n", |
302 | "MII interface PHY %d, setup/reset sequences %d/%d long, capabilities %02x %02x\n", | 308 | dev->name, |
303 | bp[0], bp[1], bp[2 + bp[1]*2], | 309 | bp[0], bp[1], bp[2 + bp[1]*2], |
304 | bp[5 + bp[2 + bp[1]*2]*2], | 310 | bp[5 + bp[2 + bp[1]*2]*2], |
305 | bp[4 + bp[2 + bp[1]*2]*2]); | 311 | bp[4 + bp[2 + bp[1]*2]*2]); |
306 | } | 312 | } |
307 | dev_info(&dev->dev, | 313 | pr_info("%s: Index #%d - Media %s (#%d) described by a %s (%d) block\n", |
308 | "Index #%d - Media %s (#%d) described by a %s (%d) block\n", | 314 | dev->name, |
309 | i, medianame[leaf->media & 15], leaf->media, | 315 | i, medianame[leaf->media & 15], leaf->media, |
310 | leaf->type < ARRAY_SIZE(block_name) ? block_name[leaf->type] : "<unknown>", | 316 | leaf->type < ARRAY_SIZE(block_name) ? block_name[leaf->type] : "<unknown>", |
311 | leaf->type); | 317 | leaf->type); |
312 | } | 318 | } |
313 | if (new_advertise) | 319 | if (new_advertise) |
314 | tp->sym_advertise = new_advertise; | 320 | tp->sym_advertise = new_advertise; |