Skip to content

Commit

Permalink
ethernet: amd: dynamic debug fixes
Browse files Browse the repository at this point in the history
This patch convert printk() to netdev_dbg/info/err or dev_info/err/dbg

Signed-off-by: Varka Bhadram <varkab@cdac.in>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Varka Bhadram authored and David S. Miller committed Jul 15, 2014
1 parent 711fec5 commit f7afbaa
Showing 1 changed file with 26 additions and 32 deletions.
58 changes: 26 additions & 32 deletions drivers/net/ethernet/amd/amd8111e.c
Original file line number Diff line number Diff line change
Expand Up @@ -501,8 +501,7 @@ static int amd8111e_restart(struct net_device *dev)

/* Enable interrupt coalesce */
if(lp->options & OPTION_INTR_COAL_ENABLE){
printk(KERN_INFO "%s: Interrupt Coalescing Enabled.\n",
dev->name);
netdev_info(dev, "Interrupt Coalescing Enabled.\n");
amd8111e_set_coalesce(dev,ENABLE_COAL);
}

Expand Down Expand Up @@ -860,16 +859,19 @@ static int amd8111e_link_change(struct net_device* dev)
else if(speed == PHY_SPEED_100)
lp->link_config.speed = SPEED_100;

printk(KERN_INFO "%s: Link is Up. Speed is %s Mbps %s Duplex\n", dev->name,
(lp->link_config.speed == SPEED_100) ? "100": "10",
(lp->link_config.duplex == DUPLEX_FULL)? "Full": "Half");
netdev_info(dev, "Link is Up. Speed is %s Mbps %s Duplex\n",
(lp->link_config.speed == SPEED_100) ?
"100" : "10",
(lp->link_config.duplex == DUPLEX_FULL) ?
"Full" : "Half");

netif_carrier_on(dev);
}
else{
lp->link_config.speed = SPEED_INVALID;
lp->link_config.duplex = DUPLEX_INVALID;
lp->link_config.autoneg = AUTONEG_INVALID;
printk(KERN_INFO "%s: Link is Down.\n",dev->name);
netdev_info(dev, "Link is Down.\n");
netif_carrier_off(dev);
}

Expand Down Expand Up @@ -1168,7 +1170,7 @@ static irqreturn_t amd8111e_interrupt(int irq, void *dev_id)
/* Schedule a polling routine */
__napi_schedule(&lp->napi);
} else if (intren0 & RINTEN0) {
printk("************Driver bug! interrupt while in poll\n");
netdev_dbg(dev, "************Driver bug! interrupt while in poll\n");
/* Fix by disable receive interrupts */
writel(RINTEN0, mmio + INTEN0);
}
Expand Down Expand Up @@ -1264,7 +1266,7 @@ static int amd8111e_open(struct net_device * dev )
/* Start ipg timer */
if(lp->options & OPTION_DYN_IPG_ENABLE){
add_timer(&lp->ipg_data.ipg_timer);
printk(KERN_INFO "%s: Dynamic IPG Enabled.\n",dev->name);
netdev_info(dev, "Dynamic IPG Enabled\n");
}

lp->opened = 1;
Expand Down Expand Up @@ -1623,8 +1625,8 @@ static void amd8111e_tx_timeout(struct net_device *dev)
struct amd8111e_priv* lp = netdev_priv(dev);
int err;

printk(KERN_ERR "%s: transmit timed out, resetting\n",
dev->name);
netdev_err(dev, "transmit timed out, resetting\n");

spin_lock_irq(&lp->lock);
err = amd8111e_restart(dev);
spin_unlock_irq(&lp->lock);
Expand Down Expand Up @@ -1807,39 +1809,34 @@ static int amd8111e_probe_one(struct pci_dev *pdev,

err = pci_enable_device(pdev);
if(err){
printk(KERN_ERR "amd8111e: Cannot enable new PCI device, "
"exiting.\n");
dev_err(&pdev->dev, "Cannot enable new PCI device\n");
return err;
}

if(!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM)){
printk(KERN_ERR "amd8111e: Cannot find PCI base address, "
"exiting.\n");
dev_err(&pdev->dev, "Cannot find PCI base address\n");
err = -ENODEV;
goto err_disable_pdev;
}

err = pci_request_regions(pdev, MODULE_NAME);
if(err){
printk(KERN_ERR "amd8111e: Cannot obtain PCI resources, "
"exiting.\n");
dev_err(&pdev->dev, "Cannot obtain PCI resources\n");
goto err_disable_pdev;
}

pci_set_master(pdev);

/* Find power-management capability. */
if (!pdev->pm_cap) {
printk(KERN_ERR "amd8111e: No Power Management capability, "
"exiting.\n");
dev_err(&pdev->dev, "No Power Management capability\n");
err = -ENODEV;
goto err_free_reg;
}

/* Initialize DMA */
if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) < 0) {
printk(KERN_ERR "amd8111e: DMA not supported,"
"exiting.\n");
dev_err(&pdev->dev, "DMA not supported\n");
err = -ENODEV;
goto err_free_reg;
}
Expand Down Expand Up @@ -1868,8 +1865,7 @@ static int amd8111e_probe_one(struct pci_dev *pdev,

lp->mmio = devm_ioremap(&pdev->dev, reg_addr, reg_len);
if (!lp->mmio) {
printk(KERN_ERR "amd8111e: Cannot map device registers, "
"exiting\n");
dev_err(&pdev->dev, "Cannot map device registers\n");
err = -ENOMEM;
goto err_free_dev;
}
Expand Down Expand Up @@ -1911,8 +1907,7 @@ static int amd8111e_probe_one(struct pci_dev *pdev,

err = register_netdev(dev);
if (err) {
printk(KERN_ERR "amd8111e: Cannot register net device, "
"exiting.\n");
dev_err(&pdev->dev, "Cannot register net device\n");
goto err_free_dev;
}

Expand All @@ -1932,16 +1927,15 @@ static int amd8111e_probe_one(struct pci_dev *pdev,
/* display driver and device information */

chip_version = (readl(lp->mmio + CHIPID) & 0xf0000000)>>28;
printk(KERN_INFO "%s: AMD-8111e Driver Version: %s\n",
dev->name,MODULE_VERS);
printk(KERN_INFO "%s: [ Rev %x ] PCI 10/100BaseT Ethernet %pM\n",
dev->name, chip_version, dev->dev_addr);
dev_info(&pdev->dev, "AMD-8111e Driver Version: %s\n", MODULE_VERS);
dev_info(&pdev->dev, "[ Rev %x ] PCI 10/100BaseT Ethernet %pM\n",
chip_version, dev->dev_addr);
if (lp->ext_phy_id)
printk(KERN_INFO "%s: Found MII PHY ID 0x%08x at address 0x%02x\n",
dev->name, lp->ext_phy_id, lp->ext_phy_addr);
dev_info(&pdev->dev, "Found MII PHY ID 0x%08x at address 0x%02x\n",
lp->ext_phy_id, lp->ext_phy_addr);
else
printk(KERN_INFO "%s: Couldn't detect MII PHY, assuming address 0x01\n",
dev->name);
dev_info(&pdev->dev, "Couldn't detect MII PHY, assuming address 0x01\n");

return 0;

err_free_dev:
Expand Down

0 comments on commit f7afbaa

Please sign in to comment.