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

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: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 67777f9b
...@@ -22,6 +22,8 @@ ...@@ -22,6 +22,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/crc32.h> #include <linux/crc32.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -51,7 +53,6 @@ ...@@ -51,7 +53,6 @@
#define DRV_NAME "sky2" #define DRV_NAME "sky2"
#define DRV_VERSION "1.27" #define DRV_VERSION "1.27"
#define PFX DRV_NAME " "
/* /*
* The Yukon II chipset takes 64 bit command blocks (called list elements) * 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,8 +1213,7 @@ static void sky2_rx_stop(struct sky2_port *sky2)
== sky2_read8(hw, RB_ADDR(rxq, Q_RL))) == sky2_read8(hw, RB_ADDR(rxq, Q_RL)))
goto stopped; goto stopped;
printk(KERN_WARNING PFX "%s: receiver stop failed\n", netdev_warn(sky2->netdev, "receiver stop failed\n");
sky2->netdev->name);
stopped: stopped:
sky2_write32(hw, Q_ADDR(rxq, Q_CSR), BMU_RST_SET | BMU_FIFO_RST); sky2_write32(hw, Q_ADDR(rxq, Q_CSR), BMU_RST_SET | BMU_FIFO_RST);
...@@ -1555,7 +1555,7 @@ static void sky2_hw_up(struct sky2_port *sky2) ...@@ -1555,7 +1555,7 @@ static void sky2_hw_up(struct sky2_port *sky2)
if (ramsize > 0) { if (ramsize > 0) {
u32 rxspace; u32 rxspace;
pr_debug(PFX "%s: ram buffer %dK\n", sky2->netdev->name, ramsize); netdev_dbg(sky2->netdev, "ram buffer %dK\n", ramsize);
if (ramsize < 16) if (ramsize < 16)
rxspace = ramsize / 2; rxspace = ramsize / 2;
else else
...@@ -2070,13 +2070,12 @@ static int sky2_autoneg_done(struct sky2_port *sky2, u16 aux) ...@@ -2070,13 +2070,12 @@ static int sky2_autoneg_done(struct sky2_port *sky2, u16 aux)
advert = gm_phy_read(hw, port, PHY_MARV_AUNE_ADV); advert = gm_phy_read(hw, port, PHY_MARV_AUNE_ADV);
lpa = gm_phy_read(hw, port, PHY_MARV_AUNE_LP); lpa = gm_phy_read(hw, port, PHY_MARV_AUNE_LP);
if (lpa & PHY_M_AN_RF) { if (lpa & PHY_M_AN_RF) {
printk(KERN_ERR PFX "%s: remote fault", sky2->netdev->name); netdev_err(sky2->netdev, "remote fault\n");
return -1; return -1;
} }
if (!(aux & PHY_M_PS_SPDUP_RES)) { if (!(aux & PHY_M_PS_SPDUP_RES)) {
printk(KERN_ERR PFX "%s: speed/duplex mismatch", netdev_err(sky2->netdev, "speed/duplex mismatch\n");
sky2->netdev->name);
return -1; return -1;
} }
...@@ -2195,10 +2194,10 @@ static void sky2_tx_timeout(struct net_device *dev) ...@@ -2195,10 +2194,10 @@ static void sky2_tx_timeout(struct net_device *dev)
netif_err(sky2, timer, dev, "tx timeout\n"); netif_err(sky2, timer, dev, "tx timeout\n");
printk(KERN_DEBUG PFX "%s: transmit ring %u .. %u report=%u done=%u\n", netdev_printk(KERN_DEBUG, dev, "transmit ring %u .. %u report=%u done=%u\n",
dev->name, sky2->tx_cons, sky2->tx_prod, sky2->tx_cons, sky2->tx_prod,
sky2_read16(hw, sky2->port == 0 ? STAT_TXA1_RIDX : STAT_TXA2_RIDX), sky2_read16(hw, sky2->port == 0 ? STAT_TXA1_RIDX : STAT_TXA2_RIDX),
sky2_read16(hw, Q_ADDR(txqaddr[sky2->port], Q_DONE))); sky2_read16(hw, Q_ADDR(txqaddr[sky2->port], Q_DONE)));
/* can't restart safely under softirq */ /* can't restart safely under softirq */
schedule_work(&hw->restart_work); schedule_work(&hw->restart_work);
...@@ -2614,8 +2613,7 @@ static int sky2_status_intr(struct sky2_hw *hw, int to_do, u16 idx) ...@@ -2614,8 +2613,7 @@ static int sky2_status_intr(struct sky2_hw *hw, int to_do, u16 idx)
default: default:
if (net_ratelimit()) if (net_ratelimit())
printk(KERN_WARNING PFX pr_warning("unknown status opcode 0x%x\n", opcode);
"unknown status opcode 0x%x\n", opcode);
} }
} while (hw->st_idx != idx); } while (hw->st_idx != idx);
...@@ -2634,41 +2632,37 @@ static void sky2_hw_error(struct sky2_hw *hw, unsigned port, u32 status) ...@@ -2634,41 +2632,37 @@ static void sky2_hw_error(struct sky2_hw *hw, unsigned port, u32 status)
struct net_device *dev = hw->dev[port]; struct net_device *dev = hw->dev[port];
if (net_ratelimit()) if (net_ratelimit())
printk(KERN_INFO PFX "%s: hw error interrupt status 0x%x\n", netdev_info(dev, "hw error interrupt status 0x%x\n", status);
dev->name, status);
if (status & Y2_IS_PAR_RD1) { if (status & Y2_IS_PAR_RD1) {
if (net_ratelimit()) if (net_ratelimit())
printk(KERN_ERR PFX "%s: ram data read parity error\n", netdev_err(dev, "ram data read parity error\n");
dev->name);
/* Clear IRQ */ /* Clear IRQ */
sky2_write16(hw, RAM_BUFFER(port, B3_RI_CTRL), RI_CLR_RD_PERR); sky2_write16(hw, RAM_BUFFER(port, B3_RI_CTRL), RI_CLR_RD_PERR);
} }
if (status & Y2_IS_PAR_WR1) { if (status & Y2_IS_PAR_WR1) {
if (net_ratelimit()) if (net_ratelimit())
printk(KERN_ERR PFX "%s: ram data write parity error\n", netdev_err(dev, "ram data write parity error\n");
dev->name);
sky2_write16(hw, RAM_BUFFER(port, B3_RI_CTRL), RI_CLR_WR_PERR); sky2_write16(hw, RAM_BUFFER(port, B3_RI_CTRL), RI_CLR_WR_PERR);
} }
if (status & Y2_IS_PAR_MAC1) { if (status & Y2_IS_PAR_MAC1) {
if (net_ratelimit()) if (net_ratelimit())
printk(KERN_ERR PFX "%s: MAC parity error\n", dev->name); netdev_err(dev, "MAC parity error\n");
sky2_write8(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_CLI_TX_PE); sky2_write8(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_CLI_TX_PE);
} }
if (status & Y2_IS_PAR_RX1) { if (status & Y2_IS_PAR_RX1) {
if (net_ratelimit()) if (net_ratelimit())
printk(KERN_ERR PFX "%s: RX parity error\n", dev->name); netdev_err(dev, "RX parity error\n");
sky2_write32(hw, Q_ADDR(rxqaddr[port], Q_CSR), BMU_CLR_IRQ_PAR); sky2_write32(hw, Q_ADDR(rxqaddr[port], Q_CSR), BMU_CLR_IRQ_PAR);
} }
if (status & Y2_IS_TCP_TXA1) { if (status & Y2_IS_TCP_TXA1) {
if (net_ratelimit()) if (net_ratelimit())
printk(KERN_ERR PFX "%s: TCP segmentation error\n", netdev_err(dev, "TCP segmentation error\n");
dev->name);
sky2_write32(hw, Q_ADDR(txqaddr[port], Q_CSR), BMU_CLR_IRQ_TCP); sky2_write32(hw, Q_ADDR(txqaddr[port], Q_CSR), BMU_CLR_IRQ_TCP);
} }
} }
...@@ -2751,8 +2745,7 @@ static void sky2_le_error(struct sky2_hw *hw, unsigned port, u16 q) ...@@ -2751,8 +2745,7 @@ static void sky2_le_error(struct sky2_hw *hw, unsigned port, u16 q)
struct net_device *dev = hw->dev[port]; struct net_device *dev = hw->dev[port];
u16 idx = sky2_read16(hw, Y2_QADDR(q, PREF_UNIT_GET_IDX)); u16 idx = sky2_read16(hw, Y2_QADDR(q, PREF_UNIT_GET_IDX));
dev_err(&hw->pdev->dev, PFX dev_err(&hw->pdev->dev, "%s: descriptor error q=%#x get=%u put=%u\n",
"%s: descriptor error q=%#x get=%u put=%u\n",
dev->name, (unsigned) q, (unsigned) idx, dev->name, (unsigned) q, (unsigned) idx,
(unsigned) sky2_read16(hw, Y2_QADDR(q, PREF_UNIT_PUT_IDX))); (unsigned) sky2_read16(hw, Y2_QADDR(q, PREF_UNIT_PUT_IDX)));
...@@ -2777,9 +2770,10 @@ static int sky2_rx_hung(struct net_device *dev) ...@@ -2777,9 +2770,10 @@ static int sky2_rx_hung(struct net_device *dev)
/* Check if the PCI RX hang */ /* Check if the PCI RX hang */
(fifo_rp == sky2->check.fifo_rp && (fifo_rp == sky2->check.fifo_rp &&
fifo_lev != 0 && fifo_lev >= sky2->check.fifo_lev))) { fifo_lev != 0 && fifo_lev >= sky2->check.fifo_lev))) {
printk(KERN_DEBUG PFX "%s: hung mac %d:%d fifo %d (%d:%d)\n", netdev_printk(KERN_DEBUG, dev,
dev->name, mac_lev, mac_rp, fifo_lev, fifo_rp, "hung mac %d:%d fifo %d (%d:%d)\n",
sky2_read8(hw, Q_ADDR(rxq, Q_WP))); mac_lev, mac_rp, fifo_lev,
fifo_rp, sky2_read8(hw, Q_ADDR(rxq, Q_WP)));
return 1; return 1;
} else { } else {
sky2->check.last = dev->last_rx; sky2->check.last = dev->last_rx;
...@@ -2810,8 +2804,7 @@ static void sky2_watchdog(unsigned long arg) ...@@ -2810,8 +2804,7 @@ static void sky2_watchdog(unsigned long arg)
/* For chips with Rx FIFO, check if stuck */ /* For chips with Rx FIFO, check if stuck */
if ((hw->flags & SKY2_HW_RAM_BUFFER) && if ((hw->flags & SKY2_HW_RAM_BUFFER) &&
sky2_rx_hung(dev)) { sky2_rx_hung(dev)) {
pr_info(PFX "%s: receiver hang detected\n", netdev_info(dev, "receiver hang detected\n");
dev->name);
schedule_work(&hw->restart_work); schedule_work(&hw->restart_work);
return; return;
} }
...@@ -3253,8 +3246,7 @@ static int sky2_reattach(struct net_device *dev) ...@@ -3253,8 +3246,7 @@ static int sky2_reattach(struct net_device *dev)
if (netif_running(dev)) { if (netif_running(dev)) {
err = sky2_up(dev); err = sky2_up(dev);
if (err) { if (err) {
printk(KERN_INFO PFX "%s: could not restart %d\n", netdev_info(dev, "could not restart %d\n", err);
dev->name, err);
dev_close(dev); dev_close(dev);
} else { } else {
netif_device_attach(dev); netif_device_attach(dev);
...@@ -4032,7 +4024,7 @@ static int sky2_vpd_wait(const struct sky2_hw *hw, int cap, u16 busy) ...@@ -4032,7 +4024,7 @@ static int sky2_vpd_wait(const struct sky2_hw *hw, int cap, u16 busy)
while ( (sky2_pci_read16(hw, cap + PCI_VPD_ADDR) & PCI_VPD_ADDR_F) == busy) { while ( (sky2_pci_read16(hw, cap + PCI_VPD_ADDR) & PCI_VPD_ADDR_F) == busy) {
/* Can take up to 10.6 ms for write */ /* Can take up to 10.6 ms for write */
if (time_after(jiffies, start + HZ/4)) { if (time_after(jiffies, start + HZ/4)) {
dev_err(&hw->pdev->dev, PFX "VPD cycle timed out"); dev_err(&hw->pdev->dev, "VPD cycle timed out\n");
return -ETIMEDOUT; return -ETIMEDOUT;
} }
mdelay(1); mdelay(1);
...@@ -4366,8 +4358,7 @@ static int sky2_device_event(struct notifier_block *unused, ...@@ -4366,8 +4358,7 @@ static int sky2_device_event(struct notifier_block *unused,
case NETDEV_GOING_DOWN: case NETDEV_GOING_DOWN:
if (sky2->debugfs) { if (sky2->debugfs) {
printk(KERN_DEBUG PFX "%s: remove debugfs\n", netdev_printk(KERN_DEBUG, dev, "remove debugfs\n");
dev->name);
debugfs_remove(sky2->debugfs); debugfs_remove(sky2->debugfs);
sky2->debugfs = NULL; sky2->debugfs = NULL;
} }
...@@ -4931,7 +4922,7 @@ static struct pci_driver sky2_driver = { ...@@ -4931,7 +4922,7 @@ static struct pci_driver sky2_driver = {
static int __init sky2_init_module(void) static int __init sky2_init_module(void)
{ {
pr_info(PFX "driver version " DRV_VERSION "\n"); pr_info("driver version " DRV_VERSION "\n");
sky2_debug_init(); sky2_debug_init();
return pci_register_driver(&sky2_driver); return pci_register_driver(&sky2_driver);
......
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