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

drivers/net/8139cp.c: Use (pr|netdev|netif)_<level> macro helpers

Add #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
Remove #define PFX
Use pr_<level>
Use netdev_<level>
Use netif_<level>
Remove periods from formats
Coalesce long formats
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent be7ce530
...@@ -46,6 +46,8 @@ ...@@ -46,6 +46,8 @@
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#define DRV_NAME "8139cp" #define DRV_NAME "8139cp"
#define DRV_VERSION "1.3" #define DRV_VERSION "1.3"
#define DRV_RELDATE "Mar 22, 2004" #define DRV_RELDATE "Mar 22, 2004"
...@@ -104,8 +106,6 @@ static int multicast_filter_limit = 32; ...@@ -104,8 +106,6 @@ static int multicast_filter_limit = 32;
module_param(multicast_filter_limit, int, 0); module_param(multicast_filter_limit, int, 0);
MODULE_PARM_DESC (multicast_filter_limit, "8139cp: maximum number of filtered multicast addresses"); MODULE_PARM_DESC (multicast_filter_limit, "8139cp: maximum number of filtered multicast addresses");
#define PFX DRV_NAME ": "
#define CP_DEF_MSG_ENABLE (NETIF_MSG_DRV | \ #define CP_DEF_MSG_ENABLE (NETIF_MSG_DRV | \
NETIF_MSG_PROBE | \ NETIF_MSG_PROBE | \
NETIF_MSG_LINK) NETIF_MSG_LINK)
...@@ -470,9 +470,8 @@ static inline void cp_rx_skb (struct cp_private *cp, struct sk_buff *skb, ...@@ -470,9 +470,8 @@ static inline void cp_rx_skb (struct cp_private *cp, struct sk_buff *skb,
static void cp_rx_err_acct (struct cp_private *cp, unsigned rx_tail, static void cp_rx_err_acct (struct cp_private *cp, unsigned rx_tail,
u32 status, u32 len) u32 status, u32 len)
{ {
if (netif_msg_rx_err (cp)) netif_dbg(cp, rx_err, cp->dev, "rx err, slot %d status 0x%x len %d\n",
pr_debug("%s: rx err, slot %d status 0x%x len %d\n", rx_tail, status, len);
cp->dev->name, rx_tail, status, len);
cp->dev->stats.rx_errors++; cp->dev->stats.rx_errors++;
if (status & RxErrFrame) if (status & RxErrFrame)
cp->dev->stats.rx_frame_errors++; cp->dev->stats.rx_frame_errors++;
...@@ -545,9 +544,8 @@ static int cp_rx_poll(struct napi_struct *napi, int budget) ...@@ -545,9 +544,8 @@ static int cp_rx_poll(struct napi_struct *napi, int budget)
goto rx_next; goto rx_next;
} }
if (netif_msg_rx_status(cp)) netif_dbg(cp, rx_status, dev, "rx slot %d status 0x%x len %d\n",
pr_debug("%s: rx slot %d status 0x%x len %d\n", rx_tail, status, len);
dev->name, rx_tail, status, len);
new_skb = netdev_alloc_skb_ip_align(dev, buflen); new_skb = netdev_alloc_skb_ip_align(dev, buflen);
if (!new_skb) { if (!new_skb) {
...@@ -621,9 +619,8 @@ static irqreturn_t cp_interrupt (int irq, void *dev_instance) ...@@ -621,9 +619,8 @@ static irqreturn_t cp_interrupt (int irq, void *dev_instance)
if (!status || (status == 0xFFFF)) if (!status || (status == 0xFFFF))
return IRQ_NONE; return IRQ_NONE;
if (netif_msg_intr(cp)) netif_dbg(cp, intr, dev, "intr, status %04x cmd %02x cpcmd %04x\n",
pr_debug("%s: intr, status %04x cmd %02x cpcmd %04x\n", status, cpr8(Cmd), cpr16(CpCmd));
dev->name, status, cpr8(Cmd), cpr16(CpCmd));
cpw16(IntrStatus, status & ~cp_rx_intr_mask); cpw16(IntrStatus, status & ~cp_rx_intr_mask);
...@@ -654,8 +651,8 @@ static irqreturn_t cp_interrupt (int irq, void *dev_instance) ...@@ -654,8 +651,8 @@ static irqreturn_t cp_interrupt (int irq, void *dev_instance)
pci_read_config_word(cp->pdev, PCI_STATUS, &pci_status); pci_read_config_word(cp->pdev, PCI_STATUS, &pci_status);
pci_write_config_word(cp->pdev, PCI_STATUS, pci_status); pci_write_config_word(cp->pdev, PCI_STATUS, pci_status);
pr_err("%s: PCI bus error, status=%04x, PCI status=%04x\n", netdev_err(dev, "PCI bus error, status=%04x, PCI status=%04x\n",
dev->name, status, pci_status); status, pci_status);
/* TODO: reset hardware */ /* TODO: reset hardware */
} }
...@@ -700,9 +697,8 @@ static void cp_tx (struct cp_private *cp) ...@@ -700,9 +697,8 @@ static void cp_tx (struct cp_private *cp)
if (status & LastFrag) { if (status & LastFrag) {
if (status & (TxError | TxFIFOUnder)) { if (status & (TxError | TxFIFOUnder)) {
if (netif_msg_tx_err(cp)) netif_dbg(cp, tx_err, cp->dev,
pr_debug("%s: tx err, status 0x%x\n", "tx err, status 0x%x\n", status);
cp->dev->name, status);
cp->dev->stats.tx_errors++; cp->dev->stats.tx_errors++;
if (status & TxOWC) if (status & TxOWC)
cp->dev->stats.tx_window_errors++; cp->dev->stats.tx_window_errors++;
...@@ -717,8 +713,8 @@ static void cp_tx (struct cp_private *cp) ...@@ -717,8 +713,8 @@ static void cp_tx (struct cp_private *cp)
((status >> TxColCntShift) & TxColCntMask); ((status >> TxColCntShift) & TxColCntMask);
cp->dev->stats.tx_packets++; cp->dev->stats.tx_packets++;
cp->dev->stats.tx_bytes += skb->len; cp->dev->stats.tx_bytes += skb->len;
if (netif_msg_tx_done(cp)) netif_dbg(cp, tx_done, cp->dev,
pr_debug("%s: tx done, slot %d\n", cp->dev->name, tx_tail); "tx done, slot %d\n", tx_tail);
} }
dev_kfree_skb_irq(skb); dev_kfree_skb_irq(skb);
} }
...@@ -752,8 +748,7 @@ static netdev_tx_t cp_start_xmit (struct sk_buff *skb, ...@@ -752,8 +748,7 @@ static netdev_tx_t cp_start_xmit (struct sk_buff *skb,
if (TX_BUFFS_AVAIL(cp) <= (skb_shinfo(skb)->nr_frags + 1)) { if (TX_BUFFS_AVAIL(cp) <= (skb_shinfo(skb)->nr_frags + 1)) {
netif_stop_queue(dev); netif_stop_queue(dev);
spin_unlock_irqrestore(&cp->lock, intr_flags); spin_unlock_irqrestore(&cp->lock, intr_flags);
pr_err(PFX "%s: BUG! Tx Ring full when queue awake!\n", netdev_err(dev, "BUG! Tx Ring full when queue awake!\n");
dev->name);
return NETDEV_TX_BUSY; return NETDEV_TX_BUSY;
} }
...@@ -878,9 +873,8 @@ static netdev_tx_t cp_start_xmit (struct sk_buff *skb, ...@@ -878,9 +873,8 @@ static netdev_tx_t cp_start_xmit (struct sk_buff *skb,
wmb(); wmb();
} }
cp->tx_head = entry; cp->tx_head = entry;
if (netif_msg_tx_queued(cp)) netif_dbg(cp, tx_queued, cp->dev, "tx queued, slot %d, skblen %d\n",
pr_debug("%s: tx queued, slot %d, skblen %d\n", entry, skb->len);
dev->name, entry, skb->len);
if (TX_BUFFS_AVAIL(cp) <= (MAX_SKB_FRAGS + 1)) if (TX_BUFFS_AVAIL(cp) <= (MAX_SKB_FRAGS + 1))
netif_stop_queue(dev); netif_stop_queue(dev);
...@@ -992,7 +986,7 @@ static void cp_reset_hw (struct cp_private *cp) ...@@ -992,7 +986,7 @@ static void cp_reset_hw (struct cp_private *cp)
schedule_timeout_uninterruptible(10); schedule_timeout_uninterruptible(10);
} }
pr_err("%s: hardware reset timeout\n", cp->dev->name); netdev_err(cp->dev, "hardware reset timeout\n");
} }
static inline void cp_start_hw (struct cp_private *cp) static inline void cp_start_hw (struct cp_private *cp)
...@@ -1159,8 +1153,7 @@ static int cp_open (struct net_device *dev) ...@@ -1159,8 +1153,7 @@ static int cp_open (struct net_device *dev)
struct cp_private *cp = netdev_priv(dev); struct cp_private *cp = netdev_priv(dev);
int rc; int rc;
if (netif_msg_ifup(cp)) netif_dbg(cp, ifup, dev, "enabling interface\n");
pr_debug("%s: enabling interface\n", dev->name);
rc = cp_alloc_rings(cp); rc = cp_alloc_rings(cp);
if (rc) if (rc)
...@@ -1194,8 +1187,7 @@ static int cp_close (struct net_device *dev) ...@@ -1194,8 +1187,7 @@ static int cp_close (struct net_device *dev)
napi_disable(&cp->napi); napi_disable(&cp->napi);
if (netif_msg_ifdown(cp)) netif_dbg(cp, ifdown, dev, "disabling interface\n");
pr_debug("%s: disabling interface\n", dev->name);
spin_lock_irqsave(&cp->lock, flags); spin_lock_irqsave(&cp->lock, flags);
...@@ -1218,9 +1210,9 @@ static void cp_tx_timeout(struct net_device *dev) ...@@ -1218,9 +1210,9 @@ static void cp_tx_timeout(struct net_device *dev)
unsigned long flags; unsigned long flags;
int rc; int rc;
pr_warning("%s: Transmit timeout, status %2x %4x %4x %4x\n", netdev_warn(dev, "Transmit timeout, status %2x %4x %4x %4x\n",
dev->name, cpr8(Cmd), cpr16(CpCmd), cpr8(Cmd), cpr16(CpCmd),
cpr16(IntrStatus), cpr16(IntrMask)); cpr16(IntrStatus), cpr16(IntrMask));
spin_lock_irqsave(&cp->lock, flags); spin_lock_irqsave(&cp->lock, flags);
...@@ -1873,8 +1865,8 @@ static int cp_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -1873,8 +1865,8 @@ static int cp_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
if (pdev->vendor == PCI_VENDOR_ID_REALTEK && if (pdev->vendor == PCI_VENDOR_ID_REALTEK &&
pdev->device == PCI_DEVICE_ID_REALTEK_8139 && pdev->revision < 0x20) { pdev->device == PCI_DEVICE_ID_REALTEK_8139 && pdev->revision < 0x20) {
dev_info(&pdev->dev, dev_info(&pdev->dev,
"This (id %04x:%04x rev %02x) is not an 8139C+ compatible chip, use 8139too\n", "This (id %04x:%04x rev %02x) is not an 8139C+ compatible chip, use 8139too\n",
pdev->vendor, pdev->device, pdev->revision); pdev->vendor, pdev->device, pdev->revision);
return -ENODEV; return -ENODEV;
} }
...@@ -1932,14 +1924,13 @@ static int cp_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -1932,14 +1924,13 @@ static int cp_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
if (rc) { if (rc) {
dev_err(&pdev->dev, dev_err(&pdev->dev,
"No usable DMA configuration, aborting.\n"); "No usable DMA configuration, aborting\n");
goto err_out_res; goto err_out_res;
} }
rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
if (rc) { if (rc) {
dev_err(&pdev->dev, dev_err(&pdev->dev,
"No usable consistent DMA configuration, " "No usable consistent DMA configuration, aborting\n");
"aborting.\n");
goto err_out_res; goto err_out_res;
} }
} }
...@@ -1951,7 +1942,7 @@ static int cp_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -1951,7 +1942,7 @@ static int cp_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
if (!regs) { if (!regs) {
rc = -EIO; rc = -EIO;
dev_err(&pdev->dev, "Cannot map PCI MMIO (%Lx@%Lx)\n", dev_err(&pdev->dev, "Cannot map PCI MMIO (%Lx@%Lx)\n",
(unsigned long long)pci_resource_len(pdev, 1), (unsigned long long)pci_resource_len(pdev, 1),
(unsigned long long)pciaddr); (unsigned long long)pciaddr);
goto err_out_res; goto err_out_res;
} }
...@@ -1989,11 +1980,8 @@ static int cp_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -1989,11 +1980,8 @@ static int cp_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
if (rc) if (rc)
goto err_out_iomap; goto err_out_iomap;
pr_info("%s: RTL-8139C+ at 0x%lx, %pM, IRQ %d\n", netdev_info(dev, "RTL-8139C+ at 0x%lx, %pM, IRQ %d\n",
dev->name, dev->base_addr, dev->dev_addr, dev->irq);
dev->base_addr,
dev->dev_addr,
dev->irq);
pci_set_drvdata(pdev, dev); pci_set_drvdata(pdev, dev);
......
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