aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sky2.c
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2010-02-17 10:01:59 -0500
committerDavid S. Miller <davem@davemloft.net>2010-02-17 20:45:29 -0500
commitada1db5c6fac4d400ec284729af19b47488b332d (patch)
tree2addd7b493a25400bc231dd1a3694d53e9c62acd /drivers/net/sky2.c
parent67777f9bf255d7561375500a4e117bdb08a883db (diff)
drivers/net/sky2.c: Use (pr|netdev)_<level> macro helpers
Add #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt Remove #define PFX Use pr_<level> Use netdev_<level> Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/sky2.c')
-rw-r--r--drivers/net/sky2.c63
1 files changed, 27 insertions, 36 deletions
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index a1198f141996..d1e98e2170ce 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -22,6 +22,8 @@
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 */ 23 */
24 24
25#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
26
25#include <linux/crc32.h> 27#include <linux/crc32.h>
26#include <linux/kernel.h> 28#include <linux/kernel.h>
27#include <linux/module.h> 29#include <linux/module.h>
@@ -51,7 +53,6 @@
51 53
52#define DRV_NAME "sky2" 54#define DRV_NAME "sky2"
53#define DRV_VERSION "1.27" 55#define DRV_VERSION "1.27"
54#define PFX DRV_NAME " "
55 56
56/* 57/*
57 * The Yukon II chipset takes 64 bit command blocks (called list elements) 58 * The Yukon II chipset takes 64 bit command blocks (called list elements)
@@ -1212,8 +1213,7 @@ static void sky2_rx_stop(struct sky2_port *sky2)
1212 == sky2_read8(hw, RB_ADDR(rxq, Q_RL))) 1213 == sky2_read8(hw, RB_ADDR(rxq, Q_RL)))
1213 goto stopped; 1214 goto stopped;
1214 1215
1215 printk(KERN_WARNING PFX "%s: receiver stop failed\n", 1216 netdev_warn(sky2->netdev, "receiver stop failed\n");
1216 sky2->netdev->name);
1217stopped: 1217stopped:
1218 sky2_write32(hw, Q_ADDR(rxq, Q_CSR), BMU_RST_SET | BMU_FIFO_RST); 1218 sky2_write32(hw, Q_ADDR(rxq, Q_CSR), BMU_RST_SET | BMU_FIFO_RST);
1219 1219
@@ -1555,7 +1555,7 @@ static void sky2_hw_up(struct sky2_port *sky2)
1555 if (ramsize > 0) { 1555 if (ramsize > 0) {
1556 u32 rxspace; 1556 u32 rxspace;
1557 1557
1558 pr_debug(PFX "%s: ram buffer %dK\n", sky2->netdev->name, ramsize); 1558 netdev_dbg(sky2->netdev, "ram buffer %dK\n", ramsize);
1559 if (ramsize < 16) 1559 if (ramsize < 16)
1560 rxspace = ramsize / 2; 1560 rxspace = ramsize / 2;
1561 else 1561 else
@@ -2070,13 +2070,12 @@ static int sky2_autoneg_done(struct sky2_port *sky2, u16 aux)
2070 advert = gm_phy_read(hw, port, PHY_MARV_AUNE_ADV); 2070 advert = gm_phy_read(hw, port, PHY_MARV_AUNE_ADV);
2071 lpa = gm_phy_read(hw, port, PHY_MARV_AUNE_LP); 2071 lpa = gm_phy_read(hw, port, PHY_MARV_AUNE_LP);
2072 if (lpa & PHY_M_AN_RF) { 2072 if (lpa & PHY_M_AN_RF) {
2073 printk(KERN_ERR PFX "%s: remote fault", sky2->netdev->name); 2073 netdev_err(sky2->netdev, "remote fault\n");
2074 return -1; 2074 return -1;
2075 } 2075 }
2076 2076
2077 if (!(aux & PHY_M_PS_SPDUP_RES)) { 2077 if (!(aux & PHY_M_PS_SPDUP_RES)) {
2078 printk(KERN_ERR PFX "%s: speed/duplex mismatch", 2078 netdev_err(sky2->netdev, "speed/duplex mismatch\n");
2079 sky2->netdev->name);
2080 return -1; 2079 return -1;
2081 } 2080 }
2082 2081
@@ -2195,10 +2194,10 @@ static void sky2_tx_timeout(struct net_device *dev)
2195 2194
2196 netif_err(sky2, timer, dev, "tx timeout\n"); 2195 netif_err(sky2, timer, dev, "tx timeout\n");
2197 2196
2198 printk(KERN_DEBUG PFX "%s: transmit ring %u .. %u report=%u done=%u\n", 2197 netdev_printk(KERN_DEBUG, dev, "transmit ring %u .. %u report=%u done=%u\n",
2199 dev->name, sky2->tx_cons, sky2->tx_prod, 2198 sky2->tx_cons, sky2->tx_prod,
2200 sky2_read16(hw, sky2->port == 0 ? STAT_TXA1_RIDX : STAT_TXA2_RIDX), 2199 sky2_read16(hw, sky2->port == 0 ? STAT_TXA1_RIDX : STAT_TXA2_RIDX),
2201 sky2_read16(hw, Q_ADDR(txqaddr[sky2->port], Q_DONE))); 2200 sky2_read16(hw, Q_ADDR(txqaddr[sky2->port], Q_DONE)));
2202 2201
2203 /* can't restart safely under softirq */ 2202 /* can't restart safely under softirq */
2204 schedule_work(&hw->restart_work); 2203 schedule_work(&hw->restart_work);
@@ -2614,8 +2613,7 @@ static int sky2_status_intr(struct sky2_hw *hw, int to_do, u16 idx)
2614 2613
2615 default: 2614 default:
2616 if (net_ratelimit()) 2615 if (net_ratelimit())
2617 printk(KERN_WARNING PFX 2616 pr_warning("unknown status opcode 0x%x\n", opcode);
2618 "unknown status opcode 0x%x\n", opcode);
2619 } 2617 }
2620 } while (hw->st_idx != idx); 2618 } while (hw->st_idx != idx);
2621 2619
@@ -2634,41 +2632,37 @@ static void sky2_hw_error(struct sky2_hw *hw, unsigned port, u32 status)
2634 struct net_device *dev = hw->dev[port]; 2632 struct net_device *dev = hw->dev[port];
2635 2633
2636 if (net_ratelimit()) 2634 if (net_ratelimit())
2637 printk(KERN_INFO PFX "%s: hw error interrupt status 0x%x\n", 2635 netdev_info(dev, "hw error interrupt status 0x%x\n", status);
2638 dev->name, status);
2639 2636
2640 if (status & Y2_IS_PAR_RD1) { 2637 if (status & Y2_IS_PAR_RD1) {
2641 if (net_ratelimit()) 2638 if (net_ratelimit())
2642 printk(KERN_ERR PFX "%s: ram data read parity error\n", 2639 netdev_err(dev, "ram data read parity error\n");
2643 dev->name);
2644 /* Clear IRQ */ 2640 /* Clear IRQ */
2645 sky2_write16(hw, RAM_BUFFER(port, B3_RI_CTRL), RI_CLR_RD_PERR); 2641 sky2_write16(hw, RAM_BUFFER(port, B3_RI_CTRL), RI_CLR_RD_PERR);
2646 } 2642 }
2647 2643
2648 if (status & Y2_IS_PAR_WR1) { 2644 if (status & Y2_IS_PAR_WR1) {
2649 if (net_ratelimit()) 2645 if (net_ratelimit())
2650 printk(KERN_ERR PFX "%s: ram data write parity error\n", 2646 netdev_err(dev, "ram data write parity error\n");
2651 dev->name);
2652 2647
2653 sky2_write16(hw, RAM_BUFFER(port, B3_RI_CTRL), RI_CLR_WR_PERR); 2648 sky2_write16(hw, RAM_BUFFER(port, B3_RI_CTRL), RI_CLR_WR_PERR);
2654 } 2649 }
2655 2650
2656 if (status & Y2_IS_PAR_MAC1) { 2651 if (status & Y2_IS_PAR_MAC1) {
2657 if (net_ratelimit()) 2652 if (net_ratelimit())
2658 printk(KERN_ERR PFX "%s: MAC parity error\n", dev->name); 2653 netdev_err(dev, "MAC parity error\n");
2659 sky2_write8(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_CLI_TX_PE); 2654 sky2_write8(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_CLI_TX_PE);
2660 } 2655 }
2661 2656
2662 if (status & Y2_IS_PAR_RX1) { 2657 if (status & Y2_IS_PAR_RX1) {
2663 if (net_ratelimit()) 2658 if (net_ratelimit())
2664 printk(KERN_ERR PFX "%s: RX parity error\n", dev->name); 2659 netdev_err(dev, "RX parity error\n");
2665 sky2_write32(hw, Q_ADDR(rxqaddr[port], Q_CSR), BMU_CLR_IRQ_PAR); 2660 sky2_write32(hw, Q_ADDR(rxqaddr[port], Q_CSR), BMU_CLR_IRQ_PAR);
2666 } 2661 }
2667 2662
2668 if (status & Y2_IS_TCP_TXA1) { 2663 if (status & Y2_IS_TCP_TXA1) {
2669 if (net_ratelimit()) 2664 if (net_ratelimit())
2670 printk(KERN_ERR PFX "%s: TCP segmentation error\n", 2665 netdev_err(dev, "TCP segmentation error\n");
2671 dev->name);
2672 sky2_write32(hw, Q_ADDR(txqaddr[port], Q_CSR), BMU_CLR_IRQ_TCP); 2666 sky2_write32(hw, Q_ADDR(txqaddr[port], Q_CSR), BMU_CLR_IRQ_TCP);
2673 } 2667 }
2674} 2668}
@@ -2751,8 +2745,7 @@ static void sky2_le_error(struct sky2_hw *hw, unsigned port, u16 q)
2751 struct net_device *dev = hw->dev[port]; 2745 struct net_device *dev = hw->dev[port];
2752 u16 idx = sky2_read16(hw, Y2_QADDR(q, PREF_UNIT_GET_IDX)); 2746 u16 idx = sky2_read16(hw, Y2_QADDR(q, PREF_UNIT_GET_IDX));
2753 2747
2754 dev_err(&hw->pdev->dev, PFX 2748 dev_err(&hw->pdev->dev, "%s: descriptor error q=%#x get=%u put=%u\n",
2755 "%s: descriptor error q=%#x get=%u put=%u\n",
2756 dev->name, (unsigned) q, (unsigned) idx, 2749 dev->name, (unsigned) q, (unsigned) idx,
2757 (unsigned) sky2_read16(hw, Y2_QADDR(q, PREF_UNIT_PUT_IDX))); 2750 (unsigned) sky2_read16(hw, Y2_QADDR(q, PREF_UNIT_PUT_IDX)));
2758 2751
@@ -2777,9 +2770,10 @@ static int sky2_rx_hung(struct net_device *dev)
2777 /* Check if the PCI RX hang */ 2770 /* Check if the PCI RX hang */
2778 (fifo_rp == sky2->check.fifo_rp && 2771 (fifo_rp == sky2->check.fifo_rp &&
2779 fifo_lev != 0 && fifo_lev >= sky2->check.fifo_lev))) { 2772 fifo_lev != 0 && fifo_lev >= sky2->check.fifo_lev))) {
2780 printk(KERN_DEBUG PFX "%s: hung mac %d:%d fifo %d (%d:%d)\n", 2773 netdev_printk(KERN_DEBUG, dev,
2781 dev->name, mac_lev, mac_rp, fifo_lev, fifo_rp, 2774 "hung mac %d:%d fifo %d (%d:%d)\n",
2782 sky2_read8(hw, Q_ADDR(rxq, Q_WP))); 2775 mac_lev, mac_rp, fifo_lev,
2776 fifo_rp, sky2_read8(hw, Q_ADDR(rxq, Q_WP)));
2783 return 1; 2777 return 1;
2784 } else { 2778 } else {
2785 sky2->check.last = dev->last_rx; 2779 sky2->check.last = dev->last_rx;
@@ -2810,8 +2804,7 @@ static void sky2_watchdog(unsigned long arg)
2810 /* For chips with Rx FIFO, check if stuck */ 2804 /* For chips with Rx FIFO, check if stuck */
2811 if ((hw->flags & SKY2_HW_RAM_BUFFER) && 2805 if ((hw->flags & SKY2_HW_RAM_BUFFER) &&
2812 sky2_rx_hung(dev)) { 2806 sky2_rx_hung(dev)) {
2813 pr_info(PFX "%s: receiver hang detected\n", 2807 netdev_info(dev, "receiver hang detected\n");
2814 dev->name);
2815 schedule_work(&hw->restart_work); 2808 schedule_work(&hw->restart_work);
2816 return; 2809 return;
2817 } 2810 }
@@ -3253,8 +3246,7 @@ static int sky2_reattach(struct net_device *dev)
3253 if (netif_running(dev)) { 3246 if (netif_running(dev)) {
3254 err = sky2_up(dev); 3247 err = sky2_up(dev);
3255 if (err) { 3248 if (err) {
3256 printk(KERN_INFO PFX "%s: could not restart %d\n", 3249 netdev_info(dev, "could not restart %d\n", err);
3257 dev->name, err);
3258 dev_close(dev); 3250 dev_close(dev);
3259 } else { 3251 } else {
3260 netif_device_attach(dev); 3252 netif_device_attach(dev);
@@ -4032,7 +4024,7 @@ static int sky2_vpd_wait(const struct sky2_hw *hw, int cap, u16 busy)
4032 while ( (sky2_pci_read16(hw, cap + PCI_VPD_ADDR) & PCI_VPD_ADDR_F) == busy) { 4024 while ( (sky2_pci_read16(hw, cap + PCI_VPD_ADDR) & PCI_VPD_ADDR_F) == busy) {
4033 /* Can take up to 10.6 ms for write */ 4025 /* Can take up to 10.6 ms for write */
4034 if (time_after(jiffies, start + HZ/4)) { 4026 if (time_after(jiffies, start + HZ/4)) {
4035 dev_err(&hw->pdev->dev, PFX "VPD cycle timed out"); 4027 dev_err(&hw->pdev->dev, "VPD cycle timed out\n");
4036 return -ETIMEDOUT; 4028 return -ETIMEDOUT;
4037 } 4029 }
4038 mdelay(1); 4030 mdelay(1);
@@ -4366,8 +4358,7 @@ static int sky2_device_event(struct notifier_block *unused,
4366 4358
4367 case NETDEV_GOING_DOWN: 4359 case NETDEV_GOING_DOWN:
4368 if (sky2->debugfs) { 4360 if (sky2->debugfs) {
4369 printk(KERN_DEBUG PFX "%s: remove debugfs\n", 4361 netdev_printk(KERN_DEBUG, dev, "remove debugfs\n");
4370 dev->name);
4371 debugfs_remove(sky2->debugfs); 4362 debugfs_remove(sky2->debugfs);
4372 sky2->debugfs = NULL; 4363 sky2->debugfs = NULL;
4373 } 4364 }
@@ -4931,7 +4922,7 @@ static struct pci_driver sky2_driver = {
4931 4922
4932static int __init sky2_init_module(void) 4923static int __init sky2_init_module(void)
4933{ 4924{
4934 pr_info(PFX "driver version " DRV_VERSION "\n"); 4925 pr_info("driver version " DRV_VERSION "\n");
4935 4926
4936 sky2_debug_init(); 4927 sky2_debug_init();
4937 return pci_register_driver(&sky2_driver); 4928 return pci_register_driver(&sky2_driver);