[netdrvr] Use dev_printk() when ethernet interface isn't available
authorJeff Garzik <jeff@garzik.org>
Tue, 27 Jun 2006 14:47:51 +0000 (10:47 -0400)
committerJeff Garzik <jeff@garzik.org>
Wed, 5 Jul 2006 17:42:07 +0000 (13:42 -0400)
For messages prior to register_netdev(), prefer dev_printk() because
that prints out both our driver name and our [PCI | whatever] bus id.

Updates: 8139{cp,too}, b44, bnx2, cassini, {eepro,epic}100, fealnx,
 hamachi, ne2k-pci, ns83820, pci-skeleton, r8169.

Signed-off-by: Jeff Garzik <jeff@garzik.org>
13 files changed:
drivers/net/8139cp.c
drivers/net/8139too.c
drivers/net/b44.c
drivers/net/bnx2.c
drivers/net/cassini.c
drivers/net/eepro100.c
drivers/net/epic100.c
drivers/net/fealnx.c
drivers/net/hamachi.c
drivers/net/ne2k-pci.c
drivers/net/ns83820.c
drivers/net/pci-skeleton.c
drivers/net/r8169.c

index 1959654cbec8c06ee685f9a7b8fed7a3e61a2a59..93b7c904bba99fc6c0d96e0f0f73a74ba6aaee26 100644 (file)
@@ -1836,9 +1836,11 @@ static int cp_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
 
        if (pdev->vendor == PCI_VENDOR_ID_REALTEK &&
            pdev->device == PCI_DEVICE_ID_REALTEK_8139 && pci_rev < 0x20) {
-               printk(KERN_ERR PFX "pci dev %s (id %04x:%04x rev %02x) is not an 8139C+ compatible chip\n",
-                      pci_name(pdev), pdev->vendor, pdev->device, pci_rev);
-               printk(KERN_ERR PFX "Try the \"8139too\" driver instead.\n");
+               dev_printk(KERN_ERR, &pdev->dev,
+                          "This (id %04x:%04x rev %02x) is not an 8139C+ compatible chip\n",
+                          pdev->vendor, pdev->device, pci_rev);
+               dev_printk(KERN_ERR, &pdev->dev,
+                          "Try the \"8139too\" driver instead.\n");
                return -ENODEV;
        }
 
@@ -1876,14 +1878,14 @@ static int cp_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
        pciaddr = pci_resource_start(pdev, 1);
        if (!pciaddr) {
                rc = -EIO;
-               printk(KERN_ERR PFX "no MMIO resource for pci dev %s\n",
-                      pci_name(pdev));
+               dev_printk(KERN_ERR, &pdev->dev, "no MMIO resource\n");
                goto err_out_res;
        }
        if (pci_resource_len(pdev, 1) < CP_REGS_SIZE) {
                rc = -EIO;
-               printk(KERN_ERR PFX "MMIO resource (%llx) too small on pci dev %s\n",
-                      (unsigned long long)pci_resource_len(pdev, 1), pci_name(pdev));
+               dev_printk(KERN_ERR, &pdev->dev,
+                          "MMIO resource (%llx) too small\n",
+                      (unsigned long long)pci_resource_len(pdev, 1));
                goto err_out_res;
        }
 
@@ -1897,14 +1899,15 @@ static int cp_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
 
                rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
                if (rc) {
-                       printk(KERN_ERR PFX "No usable DMA configuration, "
-                              "aborting.\n");
+                       dev_printk(KERN_ERR, &pdev->dev,
+                                  "No usable DMA configuration, aborting.\n");
                        goto err_out_res;
                }
                rc = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK);
                if (rc) {
-                       printk(KERN_ERR PFX "No usable consistent DMA configuration, "
-                              "aborting.\n");
+                       dev_printk(KERN_ERR, &pdev->dev,
+                                  "No usable consistent DMA configuration, "
+                                  "aborting.\n");
                        goto err_out_res;
                }
        }
@@ -1915,9 +1918,10 @@ static int cp_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
        regs = ioremap(pciaddr, CP_REGS_SIZE);
        if (!regs) {
                rc = -EIO;
-               printk(KERN_ERR PFX "Cannot map PCI MMIO (%llx@%llx) on pci dev %s\n",
-                       (unsigned long long)pci_resource_len(pdev, 1),
-                       (unsigned long long)pciaddr, pci_name(pdev));
+               dev_printk(KERN_ERR, &pdev->dev,
+                          "Cannot map PCI MMIO (%llx@%llx)\n",
+                      (unsigned long long)pci_resource_len(pdev, 1),
+                      (unsigned long long)pciaddr);
                goto err_out_res;
        }
        dev->base_addr = (unsigned long) regs;
@@ -1986,7 +1990,8 @@ static int cp_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
        /* enable busmastering and memory-write-invalidate */
        pci_set_master(pdev);
 
-       if (cp->wol_enabled) cp_set_d3_state (cp);
+       if (cp->wol_enabled)
+               cp_set_d3_state (cp);
 
        return 0;
 
@@ -2011,7 +2016,8 @@ static void cp_remove_one (struct pci_dev *pdev)
        BUG_ON(!dev);
        unregister_netdev(dev);
        iounmap(cp->regs);
-       if (cp->wol_enabled) pci_set_power_state (pdev, PCI_D0);
+       if (cp->wol_enabled)
+               pci_set_power_state (pdev, PCI_D0);
        pci_release_regions(pdev);
        pci_clear_mwi(pdev);
        pci_disable_device(pdev);
index 717506b2b13a5ab41b056ced8d277a8cbc532650..5e9ef52a5ca93b6852ed740333c3bea15d9e9958 100644 (file)
@@ -768,7 +768,8 @@ static int __devinit rtl8139_init_board (struct pci_dev *pdev,
        /* dev and priv zeroed in alloc_etherdev */
        dev = alloc_etherdev (sizeof (*tp));
        if (dev == NULL) {
-               printk (KERN_ERR PFX "%s: Unable to alloc new net device\n", pci_name(pdev));
+               dev_printk (KERN_ERR, &pdev->dev,
+                           "Unable to alloc new net device\n");
                return -ENOMEM;
        }
        SET_MODULE_OWNER(dev);
@@ -800,31 +801,35 @@ static int __devinit rtl8139_init_board (struct pci_dev *pdev,
 #ifdef USE_IO_OPS
        /* make sure PCI base addr 0 is PIO */
        if (!(pio_flags & IORESOURCE_IO)) {
-               printk (KERN_ERR PFX "%s: region #0 not a PIO resource, aborting\n", pci_name(pdev));
+               dev_printk (KERN_ERR, &pdev->dev,
+                           "region #0 not a PIO resource, aborting\n");
                rc = -ENODEV;
                goto err_out;
        }
        /* check for weird/broken PCI region reporting */
        if (pio_len < RTL_MIN_IO_SIZE) {
-               printk (KERN_ERR PFX "%s: Invalid PCI I/O region size(s), aborting\n", pci_name(pdev));
+               dev_printk (KERN_ERR, &pdev->dev,
+                           "Invalid PCI I/O region size(s), aborting\n");
                rc = -ENODEV;
                goto err_out;
        }
 #else
        /* make sure PCI base addr 1 is MMIO */
        if (!(mmio_flags & IORESOURCE_MEM)) {
-               printk (KERN_ERR PFX "%s: region #1 not an MMIO resource, aborting\n", pci_name(pdev));
+               dev_printk (KERN_ERR, &pdev->dev,
+                           "region #1 not an MMIO resource, aborting\n");
                rc = -ENODEV;
                goto err_out;
        }
        if (mmio_len < RTL_MIN_IO_SIZE) {
-               printk (KERN_ERR PFX "%s: Invalid PCI mem region size(s), aborting\n", pci_name(pdev));
+               dev_printk (KERN_ERR, &pdev->dev,
+                           "Invalid PCI mem region size(s), aborting\n");
                rc = -ENODEV;
                goto err_out;
        }
 #endif
 
-       rc = pci_request_regions (pdev, "8139too");
+       rc = pci_request_regions (pdev, DRV_NAME);
        if (rc)
                goto err_out;
        disable_dev_on_err = 1;
@@ -835,7 +840,7 @@ static int __devinit rtl8139_init_board (struct pci_dev *pdev,
 #ifdef USE_IO_OPS
        ioaddr = ioport_map(pio_start, pio_len);
        if (!ioaddr) {
-               printk (KERN_ERR PFX "%s: cannot map PIO, aborting\n", pci_name(pdev));
+               dev_printk (KERN_ERR, &pdev->dev, "cannot map PIO, aborting\n");
                rc = -EIO;
                goto err_out;
        }
@@ -846,7 +851,8 @@ static int __devinit rtl8139_init_board (struct pci_dev *pdev,
        /* ioremap MMIO region */
        ioaddr = pci_iomap(pdev, 1, 0);
        if (ioaddr == NULL) {
-               printk (KERN_ERR PFX "%s: cannot remap MMIO, aborting\n", pci_name(pdev));
+               dev_printk (KERN_ERR, &pdev->dev,
+                           "cannot remap MMIO, aborting\n");
                rc = -EIO;
                goto err_out;
        }
@@ -860,8 +866,8 @@ static int __devinit rtl8139_init_board (struct pci_dev *pdev,
 
        /* check for missing/broken hardware */
        if (RTL_R32 (TxConfig) == 0xFFFFFFFF) {
-               printk (KERN_ERR PFX "%s: Chip not responding, ignoring board\n",
-                       pci_name(pdev));
+               dev_printk (KERN_ERR, &pdev->dev,
+                           "Chip not responding, ignoring board\n");
                rc = -EIO;
                goto err_out;
        }
@@ -875,9 +881,10 @@ static int __devinit rtl8139_init_board (struct pci_dev *pdev,
                }
 
        /* if unknown chip, assume array element #0, original RTL-8139 in this case */
-       printk (KERN_DEBUG PFX "%s: unknown chip version, assuming RTL-8139\n",
-               pci_name(pdev));
-       printk (KERN_DEBUG PFX "%s: TxConfig = 0x%lx\n", pci_name(pdev), RTL_R32 (TxConfig));
+       dev_printk (KERN_DEBUG, &pdev->dev,
+                   "unknown chip version, assuming RTL-8139\n");
+       dev_printk (KERN_DEBUG, &pdev->dev,
+                   "TxConfig = 0x%lx\n", RTL_R32 (TxConfig));
        tp->chipset = 0;
 
 match:
@@ -954,9 +961,11 @@ static int __devinit rtl8139_init_one (struct pci_dev *pdev,
 
        if (pdev->vendor == PCI_VENDOR_ID_REALTEK &&
            pdev->device == PCI_DEVICE_ID_REALTEK_8139 && pci_rev >= 0x20) {
-               printk(KERN_INFO PFX "pci dev %s (id %04x:%04x rev %02x) is an enhanced 8139C+ chip\n",
-                      pci_name(pdev), pdev->vendor, pdev->device, pci_rev);
-               printk(KERN_INFO PFX "Use the \"8139cp\" driver for improved performance and stability.\n");
+               dev_printk(KERN_INFO, &pdev->dev,
+                          "This (id %04x:%04x rev %02x) is an enhanced 8139C+ chip\n",
+                          pdev->vendor, pdev->device, pci_rev);
+               dev_printk(KERN_INFO, &pdev->dev,
+                          "Use the \"8139cp\" driver for improved performance and stability.\n");
        }
 
        i = rtl8139_init_board (pdev, &dev);
index cd98d31dee8c319ad9ad487d7ecce0e3767ddb73..5815e3dc125114ca493ee93a2fd4fdeef233fecf 100644 (file)
@@ -2120,13 +2120,14 @@ static int __devinit b44_init_one(struct pci_dev *pdev,
 
        err = pci_enable_device(pdev);
        if (err) {
-               printk(KERN_ERR PFX "Cannot enable PCI device, "
+               dev_printk(KERN_ERR, &pdev->dev, "Cannot enable PCI device, "
                       "aborting.\n");
                return err;
        }
 
        if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM)) {
-               printk(KERN_ERR PFX "Cannot find proper PCI device "
+               dev_printk(KERN_ERR, &pdev->dev,
+                       "Cannot find proper PCI device "
                       "base address, aborting.\n");
                err = -ENODEV;
                goto err_out_disable_pdev;
@@ -2134,8 +2135,8 @@ static int __devinit b44_init_one(struct pci_dev *pdev,
 
        err = pci_request_regions(pdev, DRV_MODULE_NAME);
        if (err) {
-               printk(KERN_ERR PFX "Cannot obtain PCI resources, "
-                      "aborting.\n");
+               dev_printk(KERN_ERR, &pdev->dev,
+                       "Cannot obtain PCI resources, aborting.\n");
                goto err_out_disable_pdev;
        }
 
@@ -2143,15 +2144,15 @@ static int __devinit b44_init_one(struct pci_dev *pdev,
 
        err = pci_set_dma_mask(pdev, (u64) B44_DMA_MASK);
        if (err) {
-               printk(KERN_ERR PFX "No usable DMA configuration, "
-                      "aborting.\n");
+               dev_printk(KERN_ERR, &pdev->dev,
+                       "No usable DMA configuration, aborting.\n");
                goto err_out_free_res;
        }
 
        err = pci_set_consistent_dma_mask(pdev, (u64) B44_DMA_MASK);
        if (err) {
-               printk(KERN_ERR PFX "No usable DMA configuration, "
-                      "aborting.\n");
+               dev_printk(KERN_ERR, &pdev->dev,
+                       "No usable DMA configuration, aborting.\n");
                goto err_out_free_res;
        }
 
@@ -2160,7 +2161,8 @@ static int __devinit b44_init_one(struct pci_dev *pdev,
 
        dev = alloc_etherdev(sizeof(*bp));
        if (!dev) {
-               printk(KERN_ERR PFX "Etherdev alloc failed, aborting.\n");
+               dev_printk(KERN_ERR, &pdev->dev,
+                       "Etherdev alloc failed, aborting.\n");
                err = -ENOMEM;
                goto err_out_free_res;
        }
@@ -2181,7 +2183,7 @@ static int __devinit b44_init_one(struct pci_dev *pdev,
 
        bp->regs = ioremap(b44reg_base, b44reg_len);
        if (bp->regs == 0UL) {
-               printk(KERN_ERR PFX "Cannot map device registers, "
+               dev_printk(KERN_ERR, &pdev->dev, "Cannot map device registers, "
                       "aborting.\n");
                err = -ENOMEM;
                goto err_out_free_dev;
@@ -2212,8 +2214,8 @@ static int __devinit b44_init_one(struct pci_dev *pdev,
 
        err = b44_get_invariants(bp);
        if (err) {
-               printk(KERN_ERR PFX "Problem fetching invariants of chip, "
-                      "aborting.\n");
+               dev_printk(KERN_ERR, &pdev->dev,
+                       "Problem fetching invariants of chip, aborting.\n");
                goto err_out_iounmap;
        }
 
@@ -2233,7 +2235,7 @@ static int __devinit b44_init_one(struct pci_dev *pdev,
 
        err = register_netdev(dev);
        if (err) {
-               printk(KERN_ERR PFX "Cannot register net device, "
+               dev_printk(KERN_ERR, &pdev->dev, "Cannot register net device, "
                       "aborting.\n");
                goto err_out_iounmap;
        }
index 4f4db5ae503b35a27fac24c4a5da51e4b966bc4e..5502b9aeda53756f04523afcd53f33bc206ad07d 100644 (file)
@@ -5575,20 +5575,22 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
        /* enable device (incl. PCI PM wakeup), and bus-mastering */
        rc = pci_enable_device(pdev);
        if (rc) {
-               printk(KERN_ERR PFX "Cannot enable PCI device, aborting.");
+               dev_printk(KERN_ERR, &pdev->dev,
+                       "Cannot enable PCI device, aborting.");
                goto err_out;
        }
 
        if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM)) {
-               printk(KERN_ERR PFX "Cannot find PCI device base address, "
-                      "aborting.\n");
+               dev_printk(KERN_ERR, &pdev->dev,
+                       "Cannot find PCI device base address, aborting.\n");
                rc = -ENODEV;
                goto err_out_disable;
        }
 
        rc = pci_request_regions(pdev, DRV_MODULE_NAME);
        if (rc) {
-               printk(KERN_ERR PFX "Cannot obtain PCI resources, aborting.\n");
+               dev_printk(KERN_ERR, &pdev->dev,
+                       "Cannot obtain PCI resources, aborting.\n");
                goto err_out_disable;
        }
 
@@ -5596,15 +5598,16 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
 
        bp->pm_cap = pci_find_capability(pdev, PCI_CAP_ID_PM);
        if (bp->pm_cap == 0) {
-               printk(KERN_ERR PFX "Cannot find power management capability, "
-                              "aborting.\n");
+               dev_printk(KERN_ERR, &pdev->dev,
+                       "Cannot find power management capability, aborting.\n");
                rc = -EIO;
                goto err_out_release;
        }
 
        bp->pcix_cap = pci_find_capability(pdev, PCI_CAP_ID_PCIX);
        if (bp->pcix_cap == 0) {
-               printk(KERN_ERR PFX "Cannot find PCIX capability, aborting.\n");
+               dev_printk(KERN_ERR, &pdev->dev,
+                       "Cannot find PCIX capability, aborting.\n");
                rc = -EIO;
                goto err_out_release;
        }
@@ -5612,14 +5615,15 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
        if (pci_set_dma_mask(pdev, DMA_64BIT_MASK) == 0) {
                bp->flags |= USING_DAC_FLAG;
                if (pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK) != 0) {
-                       printk(KERN_ERR PFX "pci_set_consistent_dma_mask "
-                              "failed, aborting.\n");
+                       dev_printk(KERN_ERR, &pdev->dev,
+                               "pci_set_consistent_dma_mask failed, aborting.\n");
                        rc = -EIO;
                        goto err_out_release;
                }
        }
        else if (pci_set_dma_mask(pdev, DMA_32BIT_MASK) != 0) {
-               printk(KERN_ERR PFX "System does not support DMA, aborting.\n");
+               dev_printk(KERN_ERR, &pdev->dev,
+                       "System does not support DMA, aborting.\n");
                rc = -EIO;
                goto err_out_release;
        }
@@ -5639,7 +5643,8 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
        bp->regview = ioremap_nocache(dev->base_addr, mem_len);
 
        if (!bp->regview) {
-               printk(KERN_ERR PFX "Cannot map register space, aborting.\n");
+               dev_printk(KERN_ERR, &pdev->dev,
+                       "Cannot map register space, aborting.\n");
                rc = -ENOMEM;
                goto err_out_release;
        }
@@ -5711,8 +5716,8 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
        else if ((CHIP_ID(bp) == CHIP_ID_5706_A1) &&
                !(bp->flags & PCIX_FLAG)) {
 
-               printk(KERN_ERR PFX "5706 A1 can only be used in a PCIX bus, "
-                      "aborting.\n");
+               dev_printk(KERN_ERR, &pdev->dev,
+                       "5706 A1 can only be used in a PCIX bus, aborting.\n");
                goto err_out_unmap;
        }
 
@@ -5733,7 +5738,8 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
 
        if ((reg & BNX2_DEV_INFO_SIGNATURE_MAGIC_MASK) !=
            BNX2_DEV_INFO_SIGNATURE_MAGIC) {
-               printk(KERN_ERR PFX "Firmware not running, aborting.\n");
+               dev_printk(KERN_ERR, &pdev->dev,
+                       "Firmware not running, aborting.\n");
                rc = -ENODEV;
                goto err_out_unmap;
        }
@@ -5895,7 +5901,8 @@ bnx2_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 #endif
 
        if ((rc = register_netdev(dev))) {
-               printk(KERN_ERR PFX "Cannot register net device\n");
+               dev_printk(KERN_ERR, &pdev->dev,
+                       "Cannot register net device\n");
                if (bp->regview)
                        iounmap(bp->regview);
                pci_release_regions(pdev);
index d33130f647000d7f50c030df89d875feb7ff35f8..428e2067738c50abf6612806411bb23c8dae9fa9 100644 (file)
@@ -4887,13 +4887,13 @@ static int __devinit cas_init_one(struct pci_dev *pdev,
 
        err = pci_enable_device(pdev);
        if (err) {
-               printk(KERN_ERR PFX "Cannot enable PCI device, "
+               dev_printk(KERN_ERR, &pdev->dev, "Cannot enable PCI device, "
                       "aborting.\n");
                return err;
        }
 
        if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM)) {
-               printk(KERN_ERR PFX "Cannot find proper PCI device "
+               dev_printk(KERN_ERR, &pdev->dev, "Cannot find proper PCI device "
                       "base address, aborting.\n");
                err = -ENODEV;
                goto err_out_disable_pdev;
@@ -4901,7 +4901,7 @@ static int __devinit cas_init_one(struct pci_dev *pdev,
 
        dev = alloc_etherdev(sizeof(*cp));
        if (!dev) {
-               printk(KERN_ERR PFX "Etherdev alloc failed, aborting.\n");
+               dev_printk(KERN_ERR, &pdev->dev, "Etherdev alloc failed, aborting.\n");
                err = -ENOMEM;
                goto err_out_disable_pdev;
        }
@@ -4910,7 +4910,7 @@ static int __devinit cas_init_one(struct pci_dev *pdev,
 
        err = pci_request_regions(pdev, dev->name);
        if (err) {
-               printk(KERN_ERR PFX "Cannot obtain PCI resources, "
+               dev_printk(KERN_ERR, &pdev->dev, "Cannot obtain PCI resources, "
                       "aborting.\n");
                goto err_out_free_netdev;
        }
@@ -4941,7 +4941,7 @@ static int __devinit cas_init_one(struct pci_dev *pdev,
                if (pci_write_config_byte(pdev, 
                                          PCI_CACHE_LINE_SIZE, 
                                          cas_cacheline_size)) {
-                       printk(KERN_ERR PFX "Could not set PCI cache "
+                       dev_printk(KERN_ERR, &pdev->dev, "Could not set PCI cache "
                               "line size\n");
                        goto err_write_cacheline;
                }
@@ -4955,7 +4955,7 @@ static int __devinit cas_init_one(struct pci_dev *pdev,
                err = pci_set_consistent_dma_mask(pdev,
                                                  DMA_64BIT_MASK);
                if (err < 0) {
-                       printk(KERN_ERR PFX "Unable to obtain 64-bit DMA "
+                       dev_printk(KERN_ERR, &pdev->dev, "Unable to obtain 64-bit DMA "
                               "for consistent allocations\n");
                        goto err_out_free_res;
                }
@@ -4963,7 +4963,7 @@ static int __devinit cas_init_one(struct pci_dev *pdev,
        } else {
                err = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
                if (err) {
-                       printk(KERN_ERR PFX "No usable DMA configuration, "
+                       dev_printk(KERN_ERR, &pdev->dev, "No usable DMA configuration, "
                               "aborting.\n");
                        goto err_out_free_res;
                }
@@ -5023,7 +5023,7 @@ static int __devinit cas_init_one(struct pci_dev *pdev,
        /* give us access to cassini registers */
        cp->regs = pci_iomap(pdev, 0, casreg_len);
        if (cp->regs == 0UL) {
-               printk(KERN_ERR PFX "Cannot map device registers, "
+               dev_printk(KERN_ERR, &pdev->dev, "Cannot map device registers, "
                       "aborting.\n");
                goto err_out_free_res;
        }
@@ -5040,7 +5040,7 @@ static int __devinit cas_init_one(struct pci_dev *pdev,
                pci_alloc_consistent(pdev, sizeof(struct cas_init_block),
                                     &cp->block_dvma);
        if (!cp->init_block) {
-               printk(KERN_ERR PFX "Cannot allocate init block, "
+               dev_printk(KERN_ERR, &pdev->dev, "Cannot allocate init block, "
                       "aborting.\n");
                goto err_out_iounmap;
        }
@@ -5085,7 +5085,7 @@ static int __devinit cas_init_one(struct pci_dev *pdev,
                dev->features |= NETIF_F_HIGHDMA;
 
        if (register_netdev(dev)) {
-               printk(KERN_ERR PFX "Cannot register net device, "
+               dev_printk(KERN_ERR, &pdev->dev, "Cannot register net device, "
                       "aborting.\n");
                goto err_out_free_consistent;
        }
index 2ad327542927246ff70530be1653e6364e45089a..bccb12e03c2df33c511b2d59ad6bf7d22abab094 100644 (file)
@@ -555,12 +555,14 @@ static int __devinit eepro100_init_one (struct pci_dev *pdev,
 
        if (!request_region(pci_resource_start(pdev, 1),
                        pci_resource_len(pdev, 1), "eepro100")) {
-               printk (KERN_ERR "eepro100: cannot reserve I/O ports\n");
+               dev_printk (KERN_ERR, &pdev->dev,
+                       "eepro100: cannot reserve I/O ports\n");
                goto err_out_none;
        }
        if (!request_mem_region(pci_resource_start(pdev, 0),
                        pci_resource_len(pdev, 0), "eepro100")) {
-               printk (KERN_ERR "eepro100: cannot reserve MMIO region\n");
+               dev_printk (KERN_ERR, &pdev->dev,
+                       "eepro100: cannot reserve MMIO region\n");
                goto err_out_free_pio_region;
        }
 
@@ -573,7 +575,7 @@ static int __devinit eepro100_init_one (struct pci_dev *pdev,
 
        ioaddr = pci_iomap(pdev, pci_bar, 0);
        if (!ioaddr) {
-               printk (KERN_ERR "eepro100: cannot remap IO\n");
+               dev_printk (KERN_ERR, &pdev->dev, "eepro100: cannot remap IO\n");
                goto err_out_free_mmio_region;
        }
 
index 05c9a26a74e29b9a850af4d09f32e76a91b86c0c..6dd0e9d159dee80ba21e560ff01498b0f427a761 100644 (file)
@@ -422,8 +422,7 @@ static int __devinit epic_init_one (struct pci_dev *pdev,
                ((u16 *)dev->dev_addr)[i] = le16_to_cpu(inw(ioaddr + LAN0 + i*4));
 
        if (debug > 2) {
-               printk(KERN_DEBUG DRV_NAME "(%s): EEPROM contents\n",
-                      pci_name(pdev));
+               dev_printk(KERN_DEBUG, &pdev->dev, "EEPROM contents:\n");
                for (i = 0; i < 64; i++)
                        printk(" %4.4x%s", read_eeprom(ioaddr, i),
                                   i % 16 == 15 ? "\n" : "");
@@ -445,21 +444,23 @@ static int __devinit epic_init_one (struct pci_dev *pdev,
                        int mii_status = mdio_read(dev, phy, MII_BMSR);
                        if (mii_status != 0xffff  &&  mii_status != 0x0000) {
                                ep->phys[phy_idx++] = phy;
-                               printk(KERN_INFO DRV_NAME "(%s): MII transceiver #%d control "
-                                          "%4.4x status %4.4x.\n",
-                                          pci_name(pdev), phy, mdio_read(dev, phy, 0), mii_status);
+                               dev_printk(KERN_INFO, &pdev->dev,
+                                       "MII transceiver #%d control "
+                                       "%4.4x status %4.4x.\n",
+                                       phy, mdio_read(dev, phy, 0), mii_status);
                        }
                }
                ep->mii_phy_cnt = phy_idx;
                if (phy_idx != 0) {
                        phy = ep->phys[0];
                        ep->mii.advertising = mdio_read(dev, phy, MII_ADVERTISE);
-                       printk(KERN_INFO DRV_NAME "(%s): Autonegotiation advertising %4.4x link "
+                       dev_printk(KERN_INFO, &pdev->dev,
+                               "Autonegotiation advertising %4.4x link "
                                   "partner %4.4x.\n",
-                                  pci_name(pdev), ep->mii.advertising, mdio_read(dev, phy, 5));
+                                  ep->mii.advertising, mdio_read(dev, phy, 5));
                } else if ( ! (ep->chip_flags & NO_MII)) {
-                       printk(KERN_WARNING DRV_NAME "(%s): ***WARNING***: No MII transceiver found!\n",
-                              pci_name(pdev));
+                       dev_printk(KERN_WARNING, &pdev->dev,
+                               "***WARNING***: No MII transceiver found!\n");
                        /* Use the known PHY address of the EPII. */
                        ep->phys[0] = 3;
                }
@@ -474,8 +475,8 @@ static int __devinit epic_init_one (struct pci_dev *pdev,
        /* The lower four bits are the media type. */
        if (duplex) {
                ep->mii.force_media = ep->mii.full_duplex = 1;
-               printk(KERN_INFO DRV_NAME "(%s):  Forced full duplex operation requested.\n",
-                      pci_name(pdev));
+               dev_printk(KERN_INFO, &pdev->dev,
+                       "Forced full duplex operation requested.\n");
        }
        dev->if_port = ep->default_port = option;
 
index aaf136658765b4f84fb9c19d1216f36b6cd00fc5..d26140ad36e9f639521fad68ef43baebfe72e0f8 100644 (file)
@@ -578,9 +578,9 @@ static int __devinit fealnx_init_one(struct pci_dev *pdev,
 
                        if (mii_status != 0xffff && mii_status != 0x0000) {
                                np->phys[phy_idx++] = phy;
-                               printk(KERN_INFO
-                                      "%s: MII PHY found at address %d, status "
-                                      "0x%4.4x.\n", dev->name, phy, mii_status);
+                               dev_printk(KERN_INFO, &pdev->dev,
+                                      "MII PHY found at address %d, status "
+                                      "0x%4.4x.\n", phy, mii_status);
                                /* get phy type */
                                {
                                        unsigned int data;
@@ -603,10 +603,10 @@ static int __devinit fealnx_init_one(struct pci_dev *pdev,
                }
 
                np->mii_cnt = phy_idx;
-               if (phy_idx == 0) {
-                       printk(KERN_WARNING "%s: MII PHY not found -- this device may "
-                              "not operate correctly.\n", dev->name);
-               }
+               if (phy_idx == 0)
+                       dev_printk(KERN_WARNING, &pdev->dev,
+                               "MII PHY not found -- this device may "
+                              "not operate correctly.\n");
        } else {
                np->phys[0] = 32;
 /* 89/6/23 add, (begin) */
@@ -632,7 +632,8 @@ static int __devinit fealnx_init_one(struct pci_dev *pdev,
                np->mii.full_duplex = full_duplex[card_idx];
 
        if (np->mii.full_duplex) {
-               printk(KERN_INFO "%s: Media type forced to Full Duplex.\n", dev->name);
+               dev_printk(KERN_INFO, &pdev->dev,
+                       "Media type forced to Full Duplex.\n");
 /* 89/6/13 add, (begin) */
 //      if (np->PHYType==MarvellPHY)
                if ((np->PHYType == MarvellPHY) || (np->PHYType == LevelOnePHY)) {
index 1b212a56933cb4038ac3cc6862eda4ff9229600c..409c6aab0411c510431ce16d562eeb02943d62bb 100644 (file)
@@ -601,7 +601,8 @@ static int __devinit hamachi_init_one (struct pci_dev *pdev,
        pci_set_master(pdev);
 
        i = pci_request_regions(pdev, DRV_NAME);
-       if (i) return i;
+       if (i)
+               return i;
 
        irq = pdev->irq;
        ioaddr = ioremap(base, 0x400);
index fa50eb8894089dea2d47bb87fe3f7ca819862b71..4f226064d55e982b2c86f178cb918619275eedcf 100644 (file)
@@ -231,12 +231,14 @@ static int __devinit ne2k_pci_init_one (struct pci_dev *pdev,
        irq = pdev->irq;
 
        if (!ioaddr || ((pci_resource_flags (pdev, 0) & IORESOURCE_IO) == 0)) {
-               printk (KERN_ERR PFX "no I/O resource at PCI BAR #0\n");
+               dev_printk (KERN_ERR, &pdev->dev,
+                       "no I/O resource at PCI BAR #0\n");
                return -ENODEV;
        }
 
        if (request_region (ioaddr, NE_IO_EXTENT, DRV_NAME) == NULL) {
-               printk (KERN_ERR PFX "I/O resource 0x%x @ 0x%lx busy\n",
+               dev_printk (KERN_ERR, &pdev->dev,
+                       "I/O resource 0x%x @ 0x%lx busy\n",
                        NE_IO_EXTENT, ioaddr);
                return -EBUSY;
        }
@@ -263,7 +265,8 @@ static int __devinit ne2k_pci_init_one (struct pci_dev *pdev,
        /* Allocate net_device, dev->priv; fill in 8390 specific dev fields. */
        dev = alloc_ei_netdev();
        if (!dev) {
-               printk (KERN_ERR PFX "cannot allocate ethernet device\n");
+               dev_printk (KERN_ERR, &pdev->dev,
+                       "cannot allocate ethernet device\n");
                goto err_out_free_res;
        }
        SET_MODULE_OWNER(dev);
@@ -281,7 +284,8 @@ static int __devinit ne2k_pci_init_one (struct pci_dev *pdev,
                while ((inb(ioaddr + EN0_ISR) & ENISR_RESET) == 0)
                        /* Limit wait: '2' avoids jiffy roll-over. */
                        if (jiffies - reset_start_time > 2) {
-                               printk(KERN_ERR PFX "Card failure (no reset ack).\n");
+                               dev_printk(KERN_ERR, &pdev->dev,
+                                       "Card failure (no reset ack).\n");
                                goto err_out_free_netdev;
                        }
 
index 70429108c40d30e83f16c7d8fadb4e6a026480ea..d6e7ac2d0c94e906c0cd276ce2413e4c685ed0fc 100644 (file)
@@ -1832,7 +1832,8 @@ static int __devinit ns83820_init_one(struct pci_dev *pci_dev, const struct pci_
        } else if (!pci_set_dma_mask(pci_dev, DMA_32BIT_MASK)) {
                using_dac = 0;
        } else {
-               printk(KERN_WARNING "ns83820.c: pci_set_dma_mask failed!\n");
+               dev_printk(KERN_WARNING, &pci_dev->dev,
+                       "pci_set_dma_mask failed!\n");
                return -ENODEV;
        }
 
@@ -1855,7 +1856,8 @@ static int __devinit ns83820_init_one(struct pci_dev *pci_dev, const struct pci_
 
        err = pci_enable_device(pci_dev);
        if (err) {
-               printk(KERN_INFO "ns83820: pci_enable_dev failed: %d\n", err);
+               dev_printk(KERN_INFO, &pci_dev->dev,
+                       "pci_enable_dev failed: %d\n", err);
                goto out_free;
        }
 
@@ -1884,8 +1886,9 @@ static int __devinit ns83820_init_one(struct pci_dev *pci_dev, const struct pci_
        err = request_irq(pci_dev->irq, ns83820_irq, IRQF_SHARED,
                          DRV_NAME, ndev);
        if (err) {
-               printk(KERN_INFO "ns83820: unable to register irq %d\n",
-                       pci_dev->irq);
+               dev_printk(KERN_INFO, &pci_dev->dev,
+                       "unable to register irq %d, err %d\n",
+                       pci_dev->irq, err);
                goto out_disable;
        }
 
@@ -1899,7 +1902,8 @@ static int __devinit ns83820_init_one(struct pci_dev *pci_dev, const struct pci_
        rtnl_lock();
        err = dev_alloc_name(ndev, ndev->name);
        if (err < 0) {
-               printk(KERN_INFO "ns83820: unable to get netdev name: %d\n", err);
+               dev_printk(KERN_INFO, &pci_dev->dev,
+                       "unable to get netdev name: %d\n", err);
                goto out_free_irq;
        }
 
index 3388ee1313ea33dc952bf8cefc2bb085b1f7ed09..9c1ce318b077b58432339cdbbdcd3480221ede82 100644 (file)
@@ -601,7 +601,8 @@ static int __devinit netdrv_init_board (struct pci_dev *pdev,
        /* dev zeroed in alloc_etherdev */
        dev = alloc_etherdev (sizeof (*tp));
        if (dev == NULL) {
-               printk (KERN_ERR PFX "unable to alloc new ethernet\n");
+               dev_printk (KERN_ERR, &pdev->dev,
+                           "unable to alloc new ethernet\n");
                DPRINTK ("EXIT, returning -ENOMEM\n");
                return -ENOMEM;
        }
@@ -631,14 +632,16 @@ static int __devinit netdrv_init_board (struct pci_dev *pdev,
 
        /* make sure PCI base addr 0 is PIO */
        if (!(pio_flags & IORESOURCE_IO)) {
-               printk (KERN_ERR PFX "region #0 not a PIO resource, aborting\n");
+               dev_printk (KERN_ERR, &pdev->dev,
+                       "region #0 not a PIO resource, aborting\n");
                rc = -ENODEV;
                goto err_out;
        }
 
        /* make sure PCI base addr 1 is MMIO */
        if (!(mmio_flags & IORESOURCE_MEM)) {
-               printk (KERN_ERR PFX "region #1 not an MMIO resource, aborting\n");
+               dev_printk (KERN_ERR, &pdev->dev,
+                       "region #1 not an MMIO resource, aborting\n");
                rc = -ENODEV;
                goto err_out;
        }
@@ -646,12 +649,13 @@ static int __devinit netdrv_init_board (struct pci_dev *pdev,
        /* check for weird/broken PCI region reporting */
        if ((pio_len < NETDRV_MIN_IO_SIZE) ||
            (mmio_len < NETDRV_MIN_IO_SIZE)) {
-               printk (KERN_ERR PFX "Invalid PCI region size(s), aborting\n");
+               dev_printk (KERN_ERR, &pdev->dev,
+                       "Invalid PCI region size(s), aborting\n");
                rc = -ENODEV;
                goto err_out;
        }
 
-       rc = pci_request_regions (pdev, "pci-skeleton");
+       rc = pci_request_regions (pdev, MODNAME);
        if (rc)
                goto err_out;
 
@@ -663,7 +667,8 @@ static int __devinit netdrv_init_board (struct pci_dev *pdev,
        /* ioremap MMIO region */
        ioaddr = ioremap (mmio_start, mmio_len);
        if (ioaddr == NULL) {
-               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;
        }
@@ -699,9 +704,10 @@ static int __devinit netdrv_init_board (struct pci_dev *pdev,
                }
 
        /* if unknown chip, assume array element #0, original RTL-8139 in this case */
-       printk (KERN_DEBUG PFX "PCI device %s: unknown chip version, assuming RTL-8139\n",
-               pci_name(pdev));
-       printk (KERN_DEBUG PFX "PCI device %s: TxConfig = 0x%lx\n", pci_name(pdev), NETDRV_R32 (TxConfig));
+       dev_printk (KERN_DEBUG, &pdev->dev,
+               "unknown chip version, assuming RTL-8139\n");
+       dev_printk (KERN_DEBUG, &pdev->dev, "TxConfig = 0x%lx\n",
+               NETDRV_R32 (TxConfig));
        tp->chipset = 0;
 
 match:
index 16a0ef1b1369cd27cad05af34fca13dcc7886b0a..ae2a1f8f1454b85ea55e47b6dde10f5297ed878d 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++;
        }