Skip to content

Commit

Permalink
tulip: Convert printks to netdev_<level>
Browse files Browse the repository at this point in the history
Use the current more descriptive logging styles.

Add pr_fmt and remove PFX where appropriate.
Use netif_<level>, netdev_<level>
Indent a few blocks in xircom_cb where appropriate.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Joe Perches authored and David S. Miller committed May 9, 2011
1 parent 54668b8 commit 163ef0b
Show file tree
Hide file tree
Showing 7 changed files with 170 additions and 180 deletions.
139 changes: 63 additions & 76 deletions drivers/net/tulip/de2104x.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
*/

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#define DRV_NAME "de2104x"
#define DRV_VERSION "0.7"
#define DRV_RELDATE "Mar 17, 2004"
Expand Down Expand Up @@ -73,8 +75,6 @@ static int rx_copybreak = 100;
module_param (rx_copybreak, int, 0);
MODULE_PARM_DESC (rx_copybreak, "de2104x Breakpoint at which Rx packets are copied");

#define PFX DRV_NAME ": "

#define DE_DEF_MSG_ENABLE (NETIF_MSG_DRV | \
NETIF_MSG_PROBE | \
NETIF_MSG_LINK | \
Expand Down Expand Up @@ -377,18 +377,16 @@ static u16 t21041_csr15[] = { 0x0008, 0x0006, 0x000E, 0x0008, 0x0008, };
static void de_rx_err_acct (struct de_private *de, unsigned rx_tail,
u32 status, u32 len)
{
if (netif_msg_rx_err (de))
printk (KERN_DEBUG
"%s: rx err, slot %d status 0x%x len %d\n",
de->dev->name, rx_tail, status, len);
netif_printk(de, rx_err, KERN_DEBUG, de->dev,
"rx err, slot %d status 0x%x len %d\n",
rx_tail, status, len);

if ((status & 0x38000300) != 0x0300) {
/* Ingore earlier buffers. */
if ((status & 0xffff) != 0x7fff) {
if (netif_msg_rx_err(de))
dev_warn(&de->dev->dev,
"Oversized Ethernet frame spanned multiple buffers, status %08x!\n",
status);
netif_warn(de, rx_err, de->dev,
"Oversized Ethernet frame spanned multiple buffers, status %08x!\n",
status);
de->net_stats.rx_length_errors++;
}
} else if (status & RxError) {
Expand Down Expand Up @@ -491,7 +489,7 @@ static void de_rx (struct de_private *de)
}

if (!rx_work)
dev_warn(&de->dev->dev, "rx work limit reached\n");
netdev_warn(de->dev, "rx work limit reached\n");

de->rx_tail = rx_tail;
}
Expand Down Expand Up @@ -534,9 +532,9 @@ static irqreturn_t de_interrupt (int irq, void *dev_instance)

pci_read_config_word(de->pdev, PCI_STATUS, &pci_status);
pci_write_config_word(de->pdev, PCI_STATUS, pci_status);
dev_err(&de->dev->dev,
"PCI bus error, status=%08x, PCI status=%04x\n",
status, pci_status);
netdev_err(de->dev,
"PCI bus error, status=%08x, PCI status=%04x\n",
status, pci_status);
}

return IRQ_HANDLED;
Expand Down Expand Up @@ -873,7 +871,7 @@ static void de_stop_rxtx (struct de_private *de)
udelay(100);
}

dev_warn(&de->dev->dev, "timeout expired stopping DMA\n");
netdev_warn(de->dev, "timeout expired, stopping DMA\n");
}

static inline void de_start_rxtx (struct de_private *de)
Expand Down Expand Up @@ -907,18 +905,16 @@ static void de_link_up(struct de_private *de)
{
if (!netif_carrier_ok(de->dev)) {
netif_carrier_on(de->dev);
if (netif_msg_link(de))
dev_info(&de->dev->dev, "link up, media %s\n",
media_name[de->media_type]);
netif_info(de, link, de->dev, "link up, media %s\n",
media_name[de->media_type]);
}
}

static void de_link_down(struct de_private *de)
{
if (netif_carrier_ok(de->dev)) {
netif_carrier_off(de->dev);
if (netif_msg_link(de))
dev_info(&de->dev->dev, "link down\n");
netif_info(de, link, de->dev, "link down\n");
}
}

Expand All @@ -928,8 +924,7 @@ static void de_set_media (struct de_private *de)
u32 macmode = dr32(MacMode);

if (de_is_running(de))
dev_warn(&de->dev->dev,
"chip is running while changing media!\n");
netdev_warn(de->dev, "chip is running while changing media!\n");

if (de->de21040)
dw32(CSR11, FULL_DUPLEX_MAGIC);
Expand All @@ -948,18 +943,13 @@ static void de_set_media (struct de_private *de)
else
macmode &= ~FullDuplex;

if (netif_msg_link(de))
dev_info(&de->dev->dev, "set link %s\n", media_name[media]);
if (netif_msg_hw(de)) {
dev_info(&de->dev->dev, "mode 0x%x, sia 0x%x,0x%x,0x%x,0x%x\n",
dr32(MacMode), dr32(SIAStatus),
dr32(CSR13), dr32(CSR14), dr32(CSR15));

dev_info(&de->dev->dev,
"set mode 0x%x, set sia 0x%x,0x%x,0x%x\n",
macmode, de->media[media].csr13,
de->media[media].csr14, de->media[media].csr15);
}
netif_info(de, link, de->dev, "set link %s\n", media_name[media]);
netif_info(de, hw, de->dev, "mode 0x%x, sia 0x%x,0x%x,0x%x,0x%x\n",
dr32(MacMode), dr32(SIAStatus),
dr32(CSR13), dr32(CSR14), dr32(CSR15));
netif_info(de, hw, de->dev, "set mode 0x%x, set sia 0x%x,0x%x,0x%x\n",
macmode, de->media[media].csr13,
de->media[media].csr14, de->media[media].csr15);
if (macmode != dr32(MacMode))
dw32(MacMode, macmode);
}
Expand Down Expand Up @@ -996,9 +986,8 @@ static void de21040_media_timer (unsigned long data)
if (!netif_carrier_ok(dev))
de_link_up(de);
else
if (netif_msg_timer(de))
dev_info(&dev->dev, "%s link ok, status %x\n",
media_name[de->media_type], status);
netif_info(de, timer, dev, "%s link ok, status %x\n",
media_name[de->media_type], status);
return;
}

Expand All @@ -1025,9 +1014,8 @@ static void de21040_media_timer (unsigned long data)
de->media_timer.expires = jiffies + DE_TIMER_NO_LINK;
add_timer(&de->media_timer);

if (netif_msg_timer(de))
dev_info(&dev->dev, "no link, trying media %s, status %x\n",
media_name[de->media_type], status);
netif_info(de, timer, dev, "no link, trying media %s, status %x\n",
media_name[de->media_type], status);
}

static unsigned int de_ok_to_advertise (struct de_private *de, u32 new_media)
Expand Down Expand Up @@ -1085,11 +1073,10 @@ static void de21041_media_timer (unsigned long data)
if (!netif_carrier_ok(dev))
de_link_up(de);
else
if (netif_msg_timer(de))
dev_info(&dev->dev,
"%s link ok, mode %x status %x\n",
media_name[de->media_type],
dr32(MacMode), status);
netif_info(de, timer, dev,
"%s link ok, mode %x status %x\n",
media_name[de->media_type],
dr32(MacMode), status);
return;
}

Expand Down Expand Up @@ -1163,9 +1150,8 @@ static void de21041_media_timer (unsigned long data)
de->media_timer.expires = jiffies + DE_TIMER_NO_LINK;
add_timer(&de->media_timer);

if (netif_msg_timer(de))
dev_info(&dev->dev, "no link, trying media %s, status %x\n",
media_name[de->media_type], status);
netif_info(de, timer, dev, "no link, trying media %s, status %x\n",
media_name[de->media_type], status);
}

static void de_media_interrupt (struct de_private *de, u32 status)
Expand Down Expand Up @@ -1401,29 +1387,28 @@ static int de_open (struct net_device *dev)
struct de_private *de = netdev_priv(dev);
int rc;

if (netif_msg_ifup(de))
printk(KERN_DEBUG "%s: enabling interface\n", dev->name);
netif_printk(de, ifup, KERN_DEBUG, dev, "enabling interface\n");

de->rx_buf_sz = (dev->mtu <= 1500 ? PKT_BUF_SZ : dev->mtu + 32);

rc = de_alloc_rings(de);
if (rc) {
dev_err(&dev->dev, "ring allocation failure, err=%d\n", rc);
netdev_err(dev, "ring allocation failure, err=%d\n", rc);
return rc;
}

dw32(IntrMask, 0);

rc = request_irq(dev->irq, de_interrupt, IRQF_SHARED, dev->name, dev);
if (rc) {
dev_err(&dev->dev, "IRQ %d request failure, err=%d\n",
dev->irq, rc);
netdev_err(dev, "IRQ %d request failure, err=%d\n",
dev->irq, rc);
goto err_out_free;
}

rc = de_init_hw(de);
if (rc) {
dev_err(&dev->dev, "h/w init failure, err=%d\n", rc);
netdev_err(dev, "h/w init failure, err=%d\n", rc);
goto err_out_free_irq;
}

Expand All @@ -1444,8 +1429,7 @@ static int de_close (struct net_device *dev)
struct de_private *de = netdev_priv(dev);
unsigned long flags;

if (netif_msg_ifdown(de))
printk(KERN_DEBUG "%s: disabling interface\n", dev->name);
netif_printk(de, ifdown, KERN_DEBUG, dev, "disabling interface\n");

del_timer_sync(&de->media_timer);

Expand All @@ -1466,9 +1450,10 @@ static void de_tx_timeout (struct net_device *dev)
{
struct de_private *de = netdev_priv(dev);

printk(KERN_DEBUG "%s: NIC status %08x mode %08x sia %08x desc %u/%u/%u\n",
dev->name, dr32(MacStatus), dr32(MacMode), dr32(SIAStatus),
de->rx_tail, de->tx_head, de->tx_tail);
netdev_printk(KERN_DEBUG, dev,
"NIC status %08x mode %08x sia %08x desc %u/%u/%u\n",
dr32(MacStatus), dr32(MacMode), dr32(SIAStatus),
de->rx_tail, de->tx_head, de->tx_tail);

del_timer_sync(&de->media_timer);

Expand Down Expand Up @@ -1693,9 +1678,8 @@ static int de_nway_reset(struct net_device *dev)

status = dr32(SIAStatus);
dw32(SIAStatus, (status & ~NWayState) | NWayRestart);
if (netif_msg_link(de))
dev_info(&de->dev->dev, "link nway restart, status %x,%x\n",
status, dr32(SIAStatus));
netif_info(de, link, dev, "link nway restart, status %x,%x\n",
status, dr32(SIAStatus));
return 0;
}

Expand Down Expand Up @@ -1740,7 +1724,8 @@ static void __devinit de21040_get_mac_address (struct de_private *de)
de->dev->dev_addr[i] = value;
udelay(1);
if (boguscnt <= 0)
pr_warning(PFX "timeout reading 21040 MAC address byte %u\n", i);
pr_warn("timeout reading 21040 MAC address byte %u\n",
i);
}
}

Expand Down Expand Up @@ -1926,8 +1911,10 @@ static void __devinit de21041_get_srom_info (struct de_private *de)
de->media[idx].csr14,
de->media[idx].csr15);

} else if (netif_msg_probe(de))
pr_cont("\n");
} else {
if (netif_msg_probe(de))
pr_cont("\n");
}

if (bufp > ((void *)&ee_data[DE_EEPROM_SIZE - 3]))
break;
Expand Down Expand Up @@ -2038,7 +2025,7 @@ static int __devinit de_init_one (struct pci_dev *pdev,
/* check for invalid IRQ value */
if (pdev->irq < 2) {
rc = -EIO;
pr_err(PFX "invalid irq (%d) for pci dev %s\n",
pr_err("invalid irq (%d) for pci dev %s\n",
pdev->irq, pci_name(pdev));
goto err_out_res;
}
Expand All @@ -2049,12 +2036,12 @@ static int __devinit de_init_one (struct pci_dev *pdev,
pciaddr = pci_resource_start(pdev, 1);
if (!pciaddr) {
rc = -EIO;
pr_err(PFX "no MMIO resource for pci dev %s\n", pci_name(pdev));
pr_err("no MMIO resource for pci dev %s\n", pci_name(pdev));
goto err_out_res;
}
if (pci_resource_len(pdev, 1) < DE_REGS_SIZE) {
rc = -EIO;
pr_err(PFX "MMIO resource (%llx) too small on pci dev %s\n",
pr_err("MMIO resource (%llx) too small on pci dev %s\n",
(unsigned long long)pci_resource_len(pdev, 1),
pci_name(pdev));
goto err_out_res;
Expand All @@ -2064,7 +2051,7 @@ static int __devinit de_init_one (struct pci_dev *pdev,
regs = ioremap_nocache(pciaddr, DE_REGS_SIZE);
if (!regs) {
rc = -EIO;
pr_err(PFX "Cannot map PCI MMIO (%llx@%lx) on pci dev %s\n",
pr_err("Cannot map PCI MMIO (%llx@%lx) on pci dev %s\n",
(unsigned long long)pci_resource_len(pdev, 1),
pciaddr, pci_name(pdev));
goto err_out_res;
Expand All @@ -2077,7 +2064,7 @@ static int __devinit de_init_one (struct pci_dev *pdev,
/* make sure hardware is not running */
rc = de_reset_mac(de);
if (rc) {
pr_err(PFX "Cannot reset MAC, pci dev %s\n", pci_name(pdev));
pr_err("Cannot reset MAC, pci dev %s\n", pci_name(pdev));
goto err_out_iomap;
}

Expand All @@ -2097,11 +2084,11 @@ static int __devinit de_init_one (struct pci_dev *pdev,
goto err_out_iomap;

/* print info about board and interface just registered */
dev_info(&dev->dev, "%s at 0x%lx, %pM, IRQ %d\n",
de->de21040 ? "21040" : "21041",
dev->base_addr,
dev->dev_addr,
dev->irq);
netdev_info(dev, "%s at 0x%lx, %pM, IRQ %d\n",
de->de21040 ? "21040" : "21041",
dev->base_addr,
dev->dev_addr,
dev->irq);

pci_set_drvdata(pdev, dev);

Expand Down Expand Up @@ -2189,7 +2176,7 @@ static int de_resume (struct pci_dev *pdev)
if (!netif_running(dev))
goto out_attach;
if ((retval = pci_enable_device(pdev))) {
dev_err(&dev->dev, "pci_enable_device failed in resume\n");
netdev_err(dev, "pci_enable_device failed in resume\n");
goto out;
}
pci_set_master(pdev);
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/tulip/dmfe.c
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ static int __devinit dmfe_init_one (struct pci_dev *pdev,
SET_NETDEV_DEV(dev, &pdev->dev);

if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) {
pr_warning("32-bit PCI DMA not available\n");
pr_warn("32-bit PCI DMA not available\n");
err = -ENODEV;
goto err_out_free;
}
Expand Down
4 changes: 2 additions & 2 deletions drivers/net/tulip/eeprom.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,8 @@ void __devinit tulip_parse_eeprom(struct net_device *dev)
/* there is no phy information, don't even try to build mtable */
if (count == 0) {
if (tulip_debug > 0)
pr_warning("%s: no phy info, aborting mtable build\n",
dev->name);
pr_warn("%s: no phy info, aborting mtable build\n",
dev->name);
return;
}

Expand Down
Loading

0 comments on commit 163ef0b

Please sign in to comment.