diff options
author | Joe Perches <joe@perches.com> | 2007-10-03 20:59:30 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:51:42 -0400 |
commit | 0795af5729b18218767fab27c44b1384f72dc9ad (patch) | |
tree | 67c16df84aa6ec219340b8ea1b5cfb0e8150a216 /drivers/net/tulip | |
parent | 95ea36275f3c9a1d3d04c217b4b576c657c4e70e (diff) |
[NET]: Introduce and use print_mac() and DECLARE_MAC_BUF()
This is nicer than the MAC_FMT stuff.
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tulip')
-rw-r--r-- | drivers/net/tulip/de2104x.c | 9 | ||||
-rw-r--r-- | drivers/net/tulip/de4x5.c | 33 | ||||
-rw-r--r-- | drivers/net/tulip/dmfe.c | 15 | ||||
-rw-r--r-- | drivers/net/tulip/tulip_core.c | 15 | ||||
-rw-r--r-- | drivers/net/tulip/uli526x.c | 9 | ||||
-rw-r--r-- | drivers/net/tulip/winbond-840.c | 29 | ||||
-rw-r--r-- | drivers/net/tulip/xircom_cb.c | 7 |
7 files changed, 47 insertions, 70 deletions
diff --git a/drivers/net/tulip/de2104x.c b/drivers/net/tulip/de2104x.c index ba3d0e5574a4..f12e33a17363 100644 --- a/drivers/net/tulip/de2104x.c +++ b/drivers/net/tulip/de2104x.c | |||
@@ -1929,6 +1929,7 @@ static int __devinit de_init_one (struct pci_dev *pdev, | |||
1929 | void __iomem *regs; | 1929 | void __iomem *regs; |
1930 | unsigned long pciaddr; | 1930 | unsigned long pciaddr; |
1931 | static int board_idx = -1; | 1931 | static int board_idx = -1; |
1932 | DECLARE_MAC_BUF(mac); | ||
1932 | 1933 | ||
1933 | board_idx++; | 1934 | board_idx++; |
1934 | 1935 | ||
@@ -2042,15 +2043,11 @@ static int __devinit de_init_one (struct pci_dev *pdev, | |||
2042 | goto err_out_iomap; | 2043 | goto err_out_iomap; |
2043 | 2044 | ||
2044 | /* print info about board and interface just registered */ | 2045 | /* print info about board and interface just registered */ |
2045 | printk (KERN_INFO "%s: %s at 0x%lx, " | 2046 | printk (KERN_INFO "%s: %s at 0x%lx, %s, IRQ %d\n", |
2046 | "%02x:%02x:%02x:%02x:%02x:%02x, " | ||
2047 | "IRQ %d\n", | ||
2048 | dev->name, | 2047 | dev->name, |
2049 | de->de21040 ? "21040" : "21041", | 2048 | de->de21040 ? "21040" : "21041", |
2050 | dev->base_addr, | 2049 | dev->base_addr, |
2051 | dev->dev_addr[0], dev->dev_addr[1], | 2050 | print_mac(mac, dev->dev_addr), |
2052 | dev->dev_addr[2], dev->dev_addr[3], | ||
2053 | dev->dev_addr[4], dev->dev_addr[5], | ||
2054 | dev->irq); | 2051 | dev->irq); |
2055 | 2052 | ||
2056 | pci_set_drvdata(pdev, dev); | 2053 | pci_set_drvdata(pdev, dev); |
diff --git a/drivers/net/tulip/de4x5.c b/drivers/net/tulip/de4x5.c index ee4215ca63f0..4633cc6dd412 100644 --- a/drivers/net/tulip/de4x5.c +++ b/drivers/net/tulip/de4x5.c | |||
@@ -1088,6 +1088,7 @@ de4x5_hw_init(struct net_device *dev, u_long iobase, struct device *gendev) | |||
1088 | struct de4x5_private *lp = netdev_priv(dev); | 1088 | struct de4x5_private *lp = netdev_priv(dev); |
1089 | struct pci_dev *pdev = NULL; | 1089 | struct pci_dev *pdev = NULL; |
1090 | int i, status=0; | 1090 | int i, status=0; |
1091 | DECLARE_MAC_BUF(mac); | ||
1091 | 1092 | ||
1092 | gendev->driver_data = dev; | 1093 | gendev->driver_data = dev; |
1093 | 1094 | ||
@@ -1123,12 +1124,8 @@ de4x5_hw_init(struct net_device *dev, u_long iobase, struct device *gendev) | |||
1123 | dev->base_addr = iobase; | 1124 | dev->base_addr = iobase; |
1124 | printk ("%s: %s at 0x%04lx", gendev->bus_id, name, iobase); | 1125 | printk ("%s: %s at 0x%04lx", gendev->bus_id, name, iobase); |
1125 | 1126 | ||
1126 | printk(", h/w address "); | ||
1127 | status = get_hw_addr(dev); | 1127 | status = get_hw_addr(dev); |
1128 | for (i = 0; i < ETH_ALEN - 1; i++) { /* get the ethernet addr. */ | 1128 | printk(", h/w address %s\n", print_mac(mac, dev->dev_addr)); |
1129 | printk("%2.2x:", dev->dev_addr[i]); | ||
1130 | } | ||
1131 | printk("%2.2x,\n", dev->dev_addr[i]); | ||
1132 | 1129 | ||
1133 | if (status != 0) { | 1130 | if (status != 0) { |
1134 | printk(" which has an Ethernet PROM CRC error.\n"); | 1131 | printk(" which has an Ethernet PROM CRC error.\n"); |
@@ -5468,19 +5465,16 @@ static void | |||
5468 | de4x5_dbg_srom(struct de4x5_srom *p) | 5465 | de4x5_dbg_srom(struct de4x5_srom *p) |
5469 | { | 5466 | { |
5470 | int i; | 5467 | int i; |
5468 | DECLARE_MAC_BUF(mac); | ||
5471 | 5469 | ||
5472 | if (de4x5_debug & DEBUG_SROM) { | 5470 | if (de4x5_debug & DEBUG_SROM) { |
5473 | printk("Sub-system Vendor ID: %04x\n", *((u_short *)p->sub_vendor_id)); | 5471 | printk("Sub-system Vendor ID: %04x\n", *((u_short *)p->sub_vendor_id)); |
5474 | printk("Sub-system ID: %04x\n", *((u_short *)p->sub_system_id)); | 5472 | printk("Sub-system ID: %04x\n", *((u_short *)p->sub_system_id)); |
5475 | printk("ID Block CRC: %02x\n", (u_char)(p->id_block_crc)); | 5473 | printk("ID Block CRC: %02x\n", (u_char)(p->id_block_crc)); |
5476 | printk("SROM version: %02x\n", (u_char)(p->version)); | 5474 | printk("SROM version: %02x\n", (u_char)(p->version)); |
5477 | printk("# controllers: %02x\n", (u_char)(p->num_controllers)); | 5475 | printk("# controllers: %02x\n", (u_char)(p->num_controllers)); |
5478 | 5476 | ||
5479 | printk("Hardware Address: "); | 5477 | printk("Hardware Address: %s\n", print_mac(mac, p->ieee_addr)); |
5480 | for (i=0;i<ETH_ALEN-1;i++) { | ||
5481 | printk("%02x:", (u_char)*(p->ieee_addr+i)); | ||
5482 | } | ||
5483 | printk("%02x\n", (u_char)*(p->ieee_addr+i)); | ||
5484 | printk("CRC checksum: %04x\n", (u_short)(p->chksum)); | 5478 | printk("CRC checksum: %04x\n", (u_short)(p->chksum)); |
5485 | for (i=0; i<64; i++) { | 5479 | for (i=0; i<64; i++) { |
5486 | printk("%3d %04x\n", i<<1, (u_short)*((u_short *)p+i)); | 5480 | printk("%3d %04x\n", i<<1, (u_short)*((u_short *)p+i)); |
@@ -5494,21 +5488,12 @@ static void | |||
5494 | de4x5_dbg_rx(struct sk_buff *skb, int len) | 5488 | de4x5_dbg_rx(struct sk_buff *skb, int len) |
5495 | { | 5489 | { |
5496 | int i, j; | 5490 | int i, j; |
5491 | DECLARE_MAC_BUF(mac); | ||
5492 | DECLARE_MAC_BUF(mac2); | ||
5497 | 5493 | ||
5498 | if (de4x5_debug & DEBUG_RX) { | 5494 | if (de4x5_debug & DEBUG_RX) { |
5499 | printk("R: %02x:%02x:%02x:%02x:%02x:%02x <- %02x:%02x:%02x:%02x:%02x:%02x len/SAP:%02x%02x [%d]\n", | 5495 | printk("R: %s <- %s len/SAP:%02x%02x [%d]\n", |
5500 | (u_char)skb->data[0], | 5496 | print_mac(mac, skb->data), print_mac(mac2, &skb->data[6]), |
5501 | (u_char)skb->data[1], | ||
5502 | (u_char)skb->data[2], | ||
5503 | (u_char)skb->data[3], | ||
5504 | (u_char)skb->data[4], | ||
5505 | (u_char)skb->data[5], | ||
5506 | (u_char)skb->data[6], | ||
5507 | (u_char)skb->data[7], | ||
5508 | (u_char)skb->data[8], | ||
5509 | (u_char)skb->data[9], | ||
5510 | (u_char)skb->data[10], | ||
5511 | (u_char)skb->data[11], | ||
5512 | (u_char)skb->data[12], | 5497 | (u_char)skb->data[12], |
5513 | (u_char)skb->data[13], | 5498 | (u_char)skb->data[13], |
5514 | len); | 5499 | len); |
diff --git a/drivers/net/tulip/dmfe.c b/drivers/net/tulip/dmfe.c index e2596e9ab1d7..ca90566d5bcd 100644 --- a/drivers/net/tulip/dmfe.c +++ b/drivers/net/tulip/dmfe.c | |||
@@ -362,6 +362,7 @@ static int __devinit dmfe_init_one (struct pci_dev *pdev, | |||
362 | struct net_device *dev; | 362 | struct net_device *dev; |
363 | u32 pci_pmr; | 363 | u32 pci_pmr; |
364 | int i, err; | 364 | int i, err; |
365 | DECLARE_MAC_BUF(mac); | ||
365 | 366 | ||
366 | DMFE_DBUG(0, "dmfe_init_one()", 0); | 367 | DMFE_DBUG(0, "dmfe_init_one()", 0); |
367 | 368 | ||
@@ -470,13 +471,13 @@ static int __devinit dmfe_init_one (struct pci_dev *pdev, | |||
470 | if (err) | 471 | if (err) |
471 | goto err_out_res; | 472 | goto err_out_res; |
472 | 473 | ||
473 | printk(KERN_INFO "%s: Davicom DM%04lx at pci%s,", | 474 | printk(KERN_INFO "%s: Davicom DM%04lx at pci%s, " |
474 | dev->name, | 475 | "%s, irq %d.\n", |
475 | ent->driver_data >> 16, | 476 | dev->name, |
476 | pci_name(pdev)); | 477 | ent->driver_data >> 16, |
477 | for (i = 0; i < 6; i++) | 478 | pci_name(pdev), |
478 | printk("%c%02x", i ? ':' : ' ', dev->dev_addr[i]); | 479 | print_mac(mac, dev->dev_addr), |
479 | printk(", irq %d.\n", dev->irq); | 480 | dev->irq); |
480 | 481 | ||
481 | pci_set_master(pdev); | 482 | pci_set_master(pdev); |
482 | 483 | ||
diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c index 66977aaa7176..80fee2292531 100644 --- a/drivers/net/tulip/tulip_core.c +++ b/drivers/net/tulip/tulip_core.c | |||
@@ -1051,12 +1051,11 @@ static void set_rx_mode(struct net_device *dev) | |||
1051 | filterbit &= 0x3f; | 1051 | filterbit &= 0x3f; |
1052 | mc_filter[filterbit >> 5] |= 1 << (filterbit & 31); | 1052 | mc_filter[filterbit >> 5] |= 1 << (filterbit & 31); |
1053 | if (tulip_debug > 2) { | 1053 | if (tulip_debug > 2) { |
1054 | printk(KERN_INFO "%s: Added filter for %2.2x:%2.2x:%2.2x:" | 1054 | DECLARE_MAC_BUF(mac); |
1055 | "%2.2x:%2.2x:%2.2x %8.8x bit %d.\n", dev->name, | 1055 | printk(KERN_INFO "%s: Added filter for %s" |
1056 | mclist->dmi_addr[0], mclist->dmi_addr[1], | 1056 | " %8.8x bit %d.\n", |
1057 | mclist->dmi_addr[2], mclist->dmi_addr[3], | 1057 | dev->name, print_mac(mac, mclist->dmi_addr), |
1058 | mclist->dmi_addr[4], mclist->dmi_addr[5], | 1058 | ether_crc(ETH_ALEN, mclist->dmi_addr), filterbit); |
1059 | ether_crc(ETH_ALEN, mclist->dmi_addr), filterbit); | ||
1060 | } | 1059 | } |
1061 | } | 1060 | } |
1062 | if (mc_filter[0] == tp->mc_filter[0] && | 1061 | if (mc_filter[0] == tp->mc_filter[0] && |
@@ -1256,6 +1255,7 @@ static int __devinit tulip_init_one (struct pci_dev *pdev, | |||
1256 | const char *chip_name = tulip_tbl[chip_idx].chip_name; | 1255 | const char *chip_name = tulip_tbl[chip_idx].chip_name; |
1257 | unsigned int eeprom_missing = 0; | 1256 | unsigned int eeprom_missing = 0; |
1258 | unsigned int force_csr0 = 0; | 1257 | unsigned int force_csr0 = 0; |
1258 | DECLARE_MAC_BUF(mac); | ||
1259 | 1259 | ||
1260 | #ifndef MODULE | 1260 | #ifndef MODULE |
1261 | static int did_version; /* Already printed version info. */ | 1261 | static int did_version; /* Already printed version info. */ |
@@ -1639,8 +1639,7 @@ static int __devinit tulip_init_one (struct pci_dev *pdev, | |||
1639 | 1639 | ||
1640 | if (eeprom_missing) | 1640 | if (eeprom_missing) |
1641 | printk(" EEPROM not present,"); | 1641 | printk(" EEPROM not present,"); |
1642 | for (i = 0; i < 6; i++) | 1642 | printk(" %s", print_mac(mac, dev->dev_addr)); |
1643 | printk("%c%2.2X", i ? ':' : ' ', dev->dev_addr[i]); | ||
1644 | printk(", IRQ %d.\n", irq); | 1643 | printk(", IRQ %d.\n", irq); |
1645 | 1644 | ||
1646 | if (tp->chip_id == PNIC2) | 1645 | if (tp->chip_id == PNIC2) |
diff --git a/drivers/net/tulip/uli526x.c b/drivers/net/tulip/uli526x.c index 2b7257d97c32..a4fd782bcd27 100644 --- a/drivers/net/tulip/uli526x.c +++ b/drivers/net/tulip/uli526x.c | |||
@@ -258,6 +258,7 @@ static int __devinit uli526x_init_one (struct pci_dev *pdev, | |||
258 | struct uli526x_board_info *db; /* board information structure */ | 258 | struct uli526x_board_info *db; /* board information structure */ |
259 | struct net_device *dev; | 259 | struct net_device *dev; |
260 | int i, err; | 260 | int i, err; |
261 | DECLARE_MAC_BUF(mac); | ||
261 | 262 | ||
262 | ULI526X_DBUG(0, "uli526x_init_one()", 0); | 263 | ULI526X_DBUG(0, "uli526x_init_one()", 0); |
263 | 264 | ||
@@ -372,11 +373,9 @@ static int __devinit uli526x_init_one (struct pci_dev *pdev, | |||
372 | if (err) | 373 | if (err) |
373 | goto err_out_res; | 374 | goto err_out_res; |
374 | 375 | ||
375 | printk(KERN_INFO "%s: ULi M%04lx at pci%s,",dev->name,ent->driver_data >> 16,pci_name(pdev)); | 376 | printk(KERN_INFO "%s: ULi M%04lx at pci%s, %s, irq %d.\n", |
376 | 377 | dev->name,ent->driver_data >> 16,pci_name(pdev), | |
377 | for (i = 0; i < 6; i++) | 378 | print_mac(mac, dev->dev_addr), dev->irq); |
378 | printk("%c%02x", i ? ':' : ' ', dev->dev_addr[i]); | ||
379 | printk(", irq %d.\n", dev->irq); | ||
380 | 379 | ||
381 | pci_set_master(pdev); | 380 | pci_set_master(pdev); |
382 | 381 | ||
diff --git a/drivers/net/tulip/winbond-840.c b/drivers/net/tulip/winbond-840.c index e00833fadc0b..3c40dd6e1a2f 100644 --- a/drivers/net/tulip/winbond-840.c +++ b/drivers/net/tulip/winbond-840.c | |||
@@ -354,6 +354,7 @@ static int __devinit w840_probe1 (struct pci_dev *pdev, | |||
354 | int irq; | 354 | int irq; |
355 | int i, option = find_cnt < MAX_UNITS ? options[find_cnt] : 0; | 355 | int i, option = find_cnt < MAX_UNITS ? options[find_cnt] : 0; |
356 | void __iomem *ioaddr; | 356 | void __iomem *ioaddr; |
357 | DECLARE_MAC_BUF(mac); | ||
357 | 358 | ||
358 | i = pci_enable_device(pdev); | 359 | i = pci_enable_device(pdev); |
359 | if (i) return i; | 360 | if (i) return i; |
@@ -433,11 +434,9 @@ static int __devinit w840_probe1 (struct pci_dev *pdev, | |||
433 | if (i) | 434 | if (i) |
434 | goto err_out_cleardev; | 435 | goto err_out_cleardev; |
435 | 436 | ||
436 | printk(KERN_INFO "%s: %s at %p, ", | 437 | printk(KERN_INFO "%s: %s at %p, %s, IRQ %d.\n", |
437 | dev->name, pci_id_tbl[chip_idx].name, ioaddr); | 438 | dev->name, pci_id_tbl[chip_idx].name, ioaddr, |
438 | for (i = 0; i < 5; i++) | 439 | print_mac(mac, dev->dev_addr), irq); |
439 | printk("%2.2x:", dev->dev_addr[i]); | ||
440 | printk("%2.2x, IRQ %d.\n", dev->dev_addr[i], irq); | ||
441 | 440 | ||
442 | if (np->drv_flags & CanHaveMII) { | 441 | if (np->drv_flags & CanHaveMII) { |
443 | int phy, phy_idx = 0; | 442 | int phy, phy_idx = 0; |
@@ -1245,16 +1244,16 @@ static int netdev_rx(struct net_device *dev) | |||
1245 | } | 1244 | } |
1246 | #ifndef final_version /* Remove after testing. */ | 1245 | #ifndef final_version /* Remove after testing. */ |
1247 | /* You will want this info for the initial debug. */ | 1246 | /* You will want this info for the initial debug. */ |
1248 | if (debug > 5) | 1247 | if (debug > 5) { |
1249 | printk(KERN_DEBUG " Rx data %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:" | 1248 | DECLARE_MAC_BUF(mac); |
1250 | "%2.2x %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x %2.2x%2.2x " | 1249 | DECLARE_MAC_BUF(mac2); |
1251 | "%d.%d.%d.%d.\n", | 1250 | |
1252 | skb->data[0], skb->data[1], skb->data[2], skb->data[3], | 1251 | printk(KERN_DEBUG " Rx data %s %s" |
1253 | skb->data[4], skb->data[5], skb->data[6], skb->data[7], | 1252 | " %2.2x%2.2x %d.%d.%d.%d.\n", |
1254 | skb->data[8], skb->data[9], skb->data[10], | 1253 | print_mac(mac, &skb->data[0]), print_mac(mac2, &skb->data[6]), |
1255 | skb->data[11], skb->data[12], skb->data[13], | 1254 | skb->data[12], skb->data[13], |
1256 | skb->data[14], skb->data[15], skb->data[16], | 1255 | skb->data[14], skb->data[15], skb->data[16], skb->data[17]); |
1257 | skb->data[17]); | 1256 | } |
1258 | #endif | 1257 | #endif |
1259 | skb->protocol = eth_type_trans(skb, dev); | 1258 | skb->protocol = eth_type_trans(skb, dev); |
1260 | netif_rx(skb); | 1259 | netif_rx(skb); |
diff --git a/drivers/net/tulip/xircom_cb.c b/drivers/net/tulip/xircom_cb.c index de8c92083e92..70befe33e454 100644 --- a/drivers/net/tulip/xircom_cb.c +++ b/drivers/net/tulip/xircom_cb.c | |||
@@ -1074,6 +1074,7 @@ static void read_mac_address(struct xircom_private *card) | |||
1074 | unsigned char j, tuple, link, data_id, data_count; | 1074 | unsigned char j, tuple, link, data_id, data_count; |
1075 | unsigned long flags; | 1075 | unsigned long flags; |
1076 | int i; | 1076 | int i; |
1077 | DECLARE_MAC_BUF(mac); | ||
1077 | 1078 | ||
1078 | enter("read_mac_address"); | 1079 | enter("read_mac_address"); |
1079 | 1080 | ||
@@ -1103,11 +1104,7 @@ static void read_mac_address(struct xircom_private *card) | |||
1103 | } | 1104 | } |
1104 | } | 1105 | } |
1105 | spin_unlock_irqrestore(&card->lock, flags); | 1106 | spin_unlock_irqrestore(&card->lock, flags); |
1106 | #ifdef DEBUG | 1107 | pr_debug(" %s\n", print_mac(mac, card->dev->dev_addr)); |
1107 | for (i = 0; i < 6; i++) | ||
1108 | printk("%c%2.2X", i ? ':' : ' ', card->dev->dev_addr[i]); | ||
1109 | printk("\n"); | ||
1110 | #endif | ||
1111 | leave("read_mac_address"); | 1108 | leave("read_mac_address"); |
1112 | } | 1109 | } |
1113 | 1110 | ||