diff options
-rw-r--r-- | drivers/net/tulip/uli526x.c | 46 |
1 files changed, 27 insertions, 19 deletions
diff --git a/drivers/net/tulip/uli526x.c b/drivers/net/tulip/uli526x.c index d549042a01df..dc3335d906f6 100644 --- a/drivers/net/tulip/uli526x.c +++ b/drivers/net/tulip/uli526x.c | |||
@@ -12,6 +12,8 @@ | |||
12 | 12 | ||
13 | */ | 13 | */ |
14 | 14 | ||
15 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
16 | |||
15 | #define DRV_NAME "uli526x" | 17 | #define DRV_NAME "uli526x" |
16 | #define DRV_VERSION "0.9.3" | 18 | #define DRV_VERSION "0.9.3" |
17 | #define DRV_RELDATE "2005-7-29" | 19 | #define DRV_RELDATE "2005-7-29" |
@@ -82,9 +84,16 @@ | |||
82 | #define ULI526X_TX_TIMEOUT ((16*HZ)/2) /* tx packet time-out time 8 s" */ | 84 | #define ULI526X_TX_TIMEOUT ((16*HZ)/2) /* tx packet time-out time 8 s" */ |
83 | #define ULI526X_TX_KICK (4*HZ/2) /* tx packet Kick-out time 2 s" */ | 85 | #define ULI526X_TX_KICK (4*HZ/2) /* tx packet Kick-out time 2 s" */ |
84 | 86 | ||
85 | #define ULI526X_DBUG(dbug_now, msg, value) if (uli526x_debug || (dbug_now)) printk(KERN_ERR DRV_NAME ": %s %lx\n", (msg), (long) (value)) | 87 | #define ULI526X_DBUG(dbug_now, msg, value) \ |
88 | do { \ | ||
89 | if (uli526x_debug || (dbug_now)) \ | ||
90 | pr_err("%s %lx\n", (msg), (long) (value)); \ | ||
91 | } while (0) | ||
86 | 92 | ||
87 | #define SHOW_MEDIA_TYPE(mode) printk(KERN_ERR DRV_NAME ": Change Speed to %sMhz %s duplex\n",mode & 1 ?"100":"10", mode & 4 ? "full":"half"); | 93 | #define SHOW_MEDIA_TYPE(mode) \ |
94 | pr_err("Change Speed to %sMhz %s duplex\n", \ | ||
95 | mode & 1 ? "100" : "10", \ | ||
96 | mode & 4 ? "full" : "half"); | ||
88 | 97 | ||
89 | 98 | ||
90 | /* CR9 definition: SROM/MII */ | 99 | /* CR9 definition: SROM/MII */ |
@@ -284,7 +293,7 @@ static int __devinit uli526x_init_one (struct pci_dev *pdev, | |||
284 | SET_NETDEV_DEV(dev, &pdev->dev); | 293 | SET_NETDEV_DEV(dev, &pdev->dev); |
285 | 294 | ||
286 | if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { | 295 | if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { |
287 | printk(KERN_WARNING DRV_NAME ": 32-bit PCI DMA not available.\n"); | 296 | pr_warning("32-bit PCI DMA not available\n"); |
288 | err = -ENODEV; | 297 | err = -ENODEV; |
289 | goto err_out_free; | 298 | goto err_out_free; |
290 | } | 299 | } |
@@ -295,19 +304,19 @@ static int __devinit uli526x_init_one (struct pci_dev *pdev, | |||
295 | goto err_out_free; | 304 | goto err_out_free; |
296 | 305 | ||
297 | if (!pci_resource_start(pdev, 0)) { | 306 | if (!pci_resource_start(pdev, 0)) { |
298 | printk(KERN_ERR DRV_NAME ": I/O base is zero\n"); | 307 | pr_err("I/O base is zero\n"); |
299 | err = -ENODEV; | 308 | err = -ENODEV; |
300 | goto err_out_disable; | 309 | goto err_out_disable; |
301 | } | 310 | } |
302 | 311 | ||
303 | if (pci_resource_len(pdev, 0) < (ULI526X_IO_SIZE) ) { | 312 | if (pci_resource_len(pdev, 0) < (ULI526X_IO_SIZE) ) { |
304 | printk(KERN_ERR DRV_NAME ": Allocated I/O size too small\n"); | 313 | pr_err("Allocated I/O size too small\n"); |
305 | err = -ENODEV; | 314 | err = -ENODEV; |
306 | goto err_out_disable; | 315 | goto err_out_disable; |
307 | } | 316 | } |
308 | 317 | ||
309 | if (pci_request_regions(pdev, DRV_NAME)) { | 318 | if (pci_request_regions(pdev, DRV_NAME)) { |
310 | printk(KERN_ERR DRV_NAME ": Failed to request PCI regions\n"); | 319 | pr_err("Failed to request PCI regions\n"); |
311 | err = -ENODEV; | 320 | err = -ENODEV; |
312 | goto err_out_disable; | 321 | goto err_out_disable; |
313 | } | 322 | } |
@@ -382,9 +391,9 @@ static int __devinit uli526x_init_one (struct pci_dev *pdev, | |||
382 | if (err) | 391 | if (err) |
383 | goto err_out_res; | 392 | goto err_out_res; |
384 | 393 | ||
385 | printk(KERN_INFO "%s: ULi M%04lx at pci%s, %pM, irq %d.\n", | 394 | dev_info(&dev->dev, "ULi M%04lx at pci%s, %pM, irq %d\n", |
386 | dev->name,ent->driver_data >> 16,pci_name(pdev), | 395 | ent->driver_data >> 16, pci_name(pdev), |
387 | dev->dev_addr, dev->irq); | 396 | dev->dev_addr, dev->irq); |
388 | 397 | ||
389 | pci_set_master(pdev); | 398 | pci_set_master(pdev); |
390 | 399 | ||
@@ -516,7 +525,7 @@ static void uli526x_init(struct net_device *dev) | |||
516 | } | 525 | } |
517 | } | 526 | } |
518 | if(phy_tmp == 32) | 527 | if(phy_tmp == 32) |
519 | printk(KERN_WARNING "Can not find the phy address!!!"); | 528 | pr_warning("Can not find the phy address!!!"); |
520 | /* Parser SROM and media mode */ | 529 | /* Parser SROM and media mode */ |
521 | db->media_mode = uli526x_media_mode; | 530 | db->media_mode = uli526x_media_mode; |
522 | 531 | ||
@@ -582,7 +591,7 @@ static netdev_tx_t uli526x_start_xmit(struct sk_buff *skb, | |||
582 | 591 | ||
583 | /* Too large packet check */ | 592 | /* Too large packet check */ |
584 | if (skb->len > MAX_PACKET_SIZE) { | 593 | if (skb->len > MAX_PACKET_SIZE) { |
585 | printk(KERN_ERR DRV_NAME ": big packet = %d\n", (u16)skb->len); | 594 | pr_err("big packet = %d\n", (u16)skb->len); |
586 | dev_kfree_skb(skb); | 595 | dev_kfree_skb(skb); |
587 | return NETDEV_TX_OK; | 596 | return NETDEV_TX_OK; |
588 | } | 597 | } |
@@ -592,7 +601,7 @@ static netdev_tx_t uli526x_start_xmit(struct sk_buff *skb, | |||
592 | /* No Tx resource check, it never happen nromally */ | 601 | /* No Tx resource check, it never happen nromally */ |
593 | if (db->tx_packet_cnt >= TX_FREE_DESC_CNT) { | 602 | if (db->tx_packet_cnt >= TX_FREE_DESC_CNT) { |
594 | spin_unlock_irqrestore(&db->lock, flags); | 603 | spin_unlock_irqrestore(&db->lock, flags); |
595 | printk(KERN_ERR DRV_NAME ": No Tx resource %ld\n", db->tx_packet_cnt); | 604 | pr_err("No Tx resource %ld\n", db->tx_packet_cnt); |
596 | return NETDEV_TX_BUSY; | 605 | return NETDEV_TX_BUSY; |
597 | } | 606 | } |
598 | 607 | ||
@@ -1058,7 +1067,7 @@ static void uli526x_timer(unsigned long data) | |||
1058 | /* Link Failed */ | 1067 | /* Link Failed */ |
1059 | ULI526X_DBUG(0, "Link Failed", tmp_cr12); | 1068 | ULI526X_DBUG(0, "Link Failed", tmp_cr12); |
1060 | netif_carrier_off(dev); | 1069 | netif_carrier_off(dev); |
1061 | printk(KERN_INFO "uli526x: %s NIC Link is Down\n",dev->name); | 1070 | pr_info("%s NIC Link is Down\n",dev->name); |
1062 | db->link_failed = 1; | 1071 | db->link_failed = 1; |
1063 | 1072 | ||
1064 | /* For Force 10/100M Half/Full mode: Enable Auto-Nego mode */ | 1073 | /* For Force 10/100M Half/Full mode: Enable Auto-Nego mode */ |
@@ -1090,11 +1099,11 @@ static void uli526x_timer(unsigned long data) | |||
1090 | } | 1099 | } |
1091 | if(db->op_mode==ULI526X_10MFD || db->op_mode==ULI526X_100MFD) | 1100 | if(db->op_mode==ULI526X_10MFD || db->op_mode==ULI526X_100MFD) |
1092 | { | 1101 | { |
1093 | printk(KERN_INFO "uli526x: %s NIC Link is Up %d Mbps Full duplex\n",dev->name,TmpSpeed); | 1102 | pr_info("%s NIC Link is Up %d Mbps Full duplex\n",dev->name,TmpSpeed); |
1094 | } | 1103 | } |
1095 | else | 1104 | else |
1096 | { | 1105 | { |
1097 | printk(KERN_INFO "uli526x: %s NIC Link is Up %d Mbps Half duplex\n",dev->name,TmpSpeed); | 1106 | pr_info("%s NIC Link is Up %d Mbps Half duplex\n",dev->name,TmpSpeed); |
1098 | } | 1107 | } |
1099 | netif_carrier_on(dev); | 1108 | netif_carrier_on(dev); |
1100 | } | 1109 | } |
@@ -1104,7 +1113,7 @@ static void uli526x_timer(unsigned long data) | |||
1104 | { | 1113 | { |
1105 | if(db->init==1) | 1114 | if(db->init==1) |
1106 | { | 1115 | { |
1107 | printk(KERN_INFO "uli526x: %s NIC Link is Down\n",dev->name); | 1116 | pr_info("%s NIC Link is Down\n",dev->name); |
1108 | netif_carrier_off(dev); | 1117 | netif_carrier_off(dev); |
1109 | } | 1118 | } |
1110 | } | 1119 | } |
@@ -1230,8 +1239,7 @@ static int uli526x_resume(struct pci_dev *pdev) | |||
1230 | 1239 | ||
1231 | err = pci_set_power_state(pdev, PCI_D0); | 1240 | err = pci_set_power_state(pdev, PCI_D0); |
1232 | if (err) { | 1241 | if (err) { |
1233 | printk(KERN_WARNING "%s: Could not put device into D0\n", | 1242 | dev_warn(&dev->dev, "Could not put device into D0\n"); |
1234 | dev->name); | ||
1235 | return err; | 1243 | return err; |
1236 | } | 1244 | } |
1237 | 1245 | ||
@@ -1432,7 +1440,7 @@ static void send_filter_frame(struct net_device *dev, int mc_cnt) | |||
1432 | update_cr6(db->cr6_data, dev->base_addr); | 1440 | update_cr6(db->cr6_data, dev->base_addr); |
1433 | dev->trans_start = jiffies; | 1441 | dev->trans_start = jiffies; |
1434 | } else | 1442 | } else |
1435 | printk(KERN_ERR DRV_NAME ": No Tx resource - Send_filter_frame!\n"); | 1443 | pr_err("No Tx resource - Send_filter_frame!\n"); |
1436 | } | 1444 | } |
1437 | 1445 | ||
1438 | 1446 | ||