[netdrvr] Use dev_printk() when ethernet interface isn't available
[linux-2.6.git] / drivers / net / r8169.c
index 16a0ef1..ae2a1f8 100644 (file)
@@ -1406,7 +1406,8 @@ rtl8169_init_board(struct pci_dev *pdev, struct net_device **dev_out,
        dev = alloc_etherdev(sizeof (*tp));
        if (dev == NULL) {
                if (netif_msg_drv(&debug))
-                       printk(KERN_ERR PFX "unable to alloc new ethernet\n");
+                       dev_printk(KERN_ERR, &pdev->dev,
+                               "unable to alloc new ethernet\n");
                goto err_out;
        }
 
@@ -1418,10 +1419,8 @@ rtl8169_init_board(struct pci_dev *pdev, struct net_device **dev_out,
        /* enable device (incl. PCI PM wakeup and hotplug setup) */
        rc = pci_enable_device(pdev);
        if (rc < 0) {
-               if (netif_msg_probe(tp)) {
-                       printk(KERN_ERR PFX "%s: enable failure\n",
-                              pci_name(pdev));
-               }
+               if (netif_msg_probe(tp))
+                       dev_printk(KERN_ERR, &pdev->dev, "enable failure\n");
                goto err_out_free_dev;
        }
 
@@ -1437,37 +1436,33 @@ rtl8169_init_board(struct pci_dev *pdev, struct net_device **dev_out,
                pci_read_config_word(pdev, pm_cap + PCI_PM_CTRL, &pwr_command);
                acpi_idle_state = pwr_command & PCI_PM_CTRL_STATE_MASK;
        } else {
-               if (netif_msg_probe(tp)) {
-                       printk(KERN_ERR PFX
+               if (netif_msg_probe(tp))
+                       dev_printk(KERN_ERR, &pdev->dev,
                               "PowerManagement capability not found.\n");
-               }
        }
 
        /* make sure PCI base addr 1 is MMIO */
        if (!(pci_resource_flags(pdev, 1) & IORESOURCE_MEM)) {
-               if (netif_msg_probe(tp)) {
-                       printk(KERN_ERR PFX
+               if (netif_msg_probe(tp))
+                       dev_printk(KERN_ERR, &pdev->dev,
                               "region #1 not an MMIO resource, aborting\n");
-               }
                rc = -ENODEV;
                goto err_out_mwi;
        }
        /* check for weird/broken PCI region reporting */
        if (pci_resource_len(pdev, 1) < R8169_REGS_SIZE) {
-               if (netif_msg_probe(tp)) {
-                       printk(KERN_ERR PFX
+               if (netif_msg_probe(tp))
+                       dev_printk(KERN_ERR, &pdev->dev,
                               "Invalid PCI region size(s), aborting\n");
-               }
                rc = -ENODEV;
                goto err_out_mwi;
        }
 
        rc = pci_request_regions(pdev, MODULENAME);
        if (rc < 0) {
-               if (netif_msg_probe(tp)) {
-                       printk(KERN_ERR PFX "%s: could not request regions.\n",
-                              pci_name(pdev));
-               }
+               if (netif_msg_probe(tp))
+                       dev_printk(KERN_ERR, &pdev->dev,
+                               "could not request regions.\n");
                goto err_out_mwi;
        }
 
@@ -1480,10 +1475,9 @@ rtl8169_init_board(struct pci_dev *pdev, struct net_device **dev_out,
        } else {
                rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
                if (rc < 0) {
-                       if (netif_msg_probe(tp)) {
-                               printk(KERN_ERR PFX
+                       if (netif_msg_probe(tp))
+                               dev_printk(KERN_ERR, &pdev->dev,
                                       "DMA configuration failed.\n");
-                       }
                        goto err_out_free_res;
                }
        }
@@ -1494,7 +1488,8 @@ rtl8169_init_board(struct pci_dev *pdev, struct net_device **dev_out,
        ioaddr = ioremap(pci_resource_start(pdev, 1), R8169_REGS_SIZE);
        if (ioaddr == NULL) {
                if (netif_msg_probe(tp))
-                       printk(KERN_ERR PFX "cannot remap MMIO, aborting\n");
+                       dev_printk(KERN_ERR, &pdev->dev,
+                               "cannot remap MMIO, aborting\n");
                rc = -EIO;
                goto err_out_free_res;
        }
@@ -1526,9 +1521,9 @@ rtl8169_init_board(struct pci_dev *pdev, struct net_device **dev_out,
        if (i < 0) {
                /* Unknown chip: assume array element #0, original RTL-8169 */
                if (netif_msg_probe(tp)) {
-                       printk(KERN_DEBUG PFX "PCI device %s: "
+                       dev_printk(KERN_DEBUG, &pdev->dev,
                               "unknown chip version, assuming %s\n",
-                              pci_name(pdev), rtl_chip_info[0].name);
+                              rtl_chip_info[0].name);
                }
                i++;
        }