Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[netdrvr] Use dev_printk() when ethernet interface isn't available

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>

+173 -135
+22 -16
drivers/net/8139cp.c
··· 1836 1836 1837 1837 if (pdev->vendor == PCI_VENDOR_ID_REALTEK && 1838 1838 pdev->device == PCI_DEVICE_ID_REALTEK_8139 && pci_rev < 0x20) { 1839 - printk(KERN_ERR PFX "pci dev %s (id %04x:%04x rev %02x) is not an 8139C+ compatible chip\n", 1840 - pci_name(pdev), pdev->vendor, pdev->device, pci_rev); 1841 - printk(KERN_ERR PFX "Try the \"8139too\" driver instead.\n"); 1839 + dev_printk(KERN_ERR, &pdev->dev, 1840 + "This (id %04x:%04x rev %02x) is not an 8139C+ compatible chip\n", 1841 + pdev->vendor, pdev->device, pci_rev); 1842 + dev_printk(KERN_ERR, &pdev->dev, 1843 + "Try the \"8139too\" driver instead.\n"); 1842 1844 return -ENODEV; 1843 1845 } 1844 1846 ··· 1878 1876 pciaddr = pci_resource_start(pdev, 1); 1879 1877 if (!pciaddr) { 1880 1878 rc = -EIO; 1881 - printk(KERN_ERR PFX "no MMIO resource for pci dev %s\n", 1882 - pci_name(pdev)); 1879 + dev_printk(KERN_ERR, &pdev->dev, "no MMIO resource\n"); 1883 1880 goto err_out_res; 1884 1881 } 1885 1882 if (pci_resource_len(pdev, 1) < CP_REGS_SIZE) { 1886 1883 rc = -EIO; 1887 - printk(KERN_ERR PFX "MMIO resource (%llx) too small on pci dev %s\n", 1888 - (unsigned long long)pci_resource_len(pdev, 1), pci_name(pdev)); 1884 + dev_printk(KERN_ERR, &pdev->dev, 1885 + "MMIO resource (%llx) too small\n", 1886 + (unsigned long long)pci_resource_len(pdev, 1)); 1889 1887 goto err_out_res; 1890 1888 } 1891 1889 ··· 1899 1897 1900 1898 rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK); 1901 1899 if (rc) { 1902 - printk(KERN_ERR PFX "No usable DMA configuration, " 1903 - "aborting.\n"); 1900 + dev_printk(KERN_ERR, &pdev->dev, 1901 + "No usable DMA configuration, aborting.\n"); 1904 1902 goto err_out_res; 1905 1903 } 1906 1904 rc = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); 1907 1905 if (rc) { 1908 - printk(KERN_ERR PFX "No usable consistent DMA configuration, " 1909 - "aborting.\n"); 1906 + dev_printk(KERN_ERR, &pdev->dev, 1907 + "No usable consistent DMA configuration, " 1908 + "aborting.\n"); 1910 1909 goto err_out_res; 1911 1910 } 1912 1911 } ··· 1918 1915 regs = ioremap(pciaddr, CP_REGS_SIZE); 1919 1916 if (!regs) { 1920 1917 rc = -EIO; 1921 - printk(KERN_ERR PFX "Cannot map PCI MMIO (%llx@%llx) on pci dev %s\n", 1922 - (unsigned long long)pci_resource_len(pdev, 1), 1923 - (unsigned long long)pciaddr, pci_name(pdev)); 1918 + dev_printk(KERN_ERR, &pdev->dev, 1919 + "Cannot map PCI MMIO (%llx@%llx)\n", 1920 + (unsigned long long)pci_resource_len(pdev, 1), 1921 + (unsigned long long)pciaddr); 1924 1922 goto err_out_res; 1925 1923 } 1926 1924 dev->base_addr = (unsigned long) regs; ··· 1990 1986 /* enable busmastering and memory-write-invalidate */ 1991 1987 pci_set_master(pdev); 1992 1988 1993 - if (cp->wol_enabled) cp_set_d3_state (cp); 1989 + if (cp->wol_enabled) 1990 + cp_set_d3_state (cp); 1994 1991 1995 1992 return 0; 1996 1993 ··· 2016 2011 BUG_ON(!dev); 2017 2012 unregister_netdev(dev); 2018 2013 iounmap(cp->regs); 2019 - if (cp->wol_enabled) pci_set_power_state (pdev, PCI_D0); 2014 + if (cp->wol_enabled) 2015 + pci_set_power_state (pdev, PCI_D0); 2020 2016 pci_release_regions(pdev); 2021 2017 pci_clear_mwi(pdev); 2022 2018 pci_disable_device(pdev);
+25 -16
drivers/net/8139too.c
··· 768 768 /* dev and priv zeroed in alloc_etherdev */ 769 769 dev = alloc_etherdev (sizeof (*tp)); 770 770 if (dev == NULL) { 771 - printk (KERN_ERR PFX "%s: Unable to alloc new net device\n", pci_name(pdev)); 771 + dev_printk (KERN_ERR, &pdev->dev, 772 + "Unable to alloc new net device\n"); 772 773 return -ENOMEM; 773 774 } 774 775 SET_MODULE_OWNER(dev); ··· 801 800 #ifdef USE_IO_OPS 802 801 /* make sure PCI base addr 0 is PIO */ 803 802 if (!(pio_flags & IORESOURCE_IO)) { 804 - printk (KERN_ERR PFX "%s: region #0 not a PIO resource, aborting\n", pci_name(pdev)); 803 + dev_printk (KERN_ERR, &pdev->dev, 804 + "region #0 not a PIO resource, aborting\n"); 805 805 rc = -ENODEV; 806 806 goto err_out; 807 807 } 808 808 /* check for weird/broken PCI region reporting */ 809 809 if (pio_len < RTL_MIN_IO_SIZE) { 810 - printk (KERN_ERR PFX "%s: Invalid PCI I/O region size(s), aborting\n", pci_name(pdev)); 810 + dev_printk (KERN_ERR, &pdev->dev, 811 + "Invalid PCI I/O region size(s), aborting\n"); 811 812 rc = -ENODEV; 812 813 goto err_out; 813 814 } 814 815 #else 815 816 /* make sure PCI base addr 1 is MMIO */ 816 817 if (!(mmio_flags & IORESOURCE_MEM)) { 817 - printk (KERN_ERR PFX "%s: region #1 not an MMIO resource, aborting\n", pci_name(pdev)); 818 + dev_printk (KERN_ERR, &pdev->dev, 819 + "region #1 not an MMIO resource, aborting\n"); 818 820 rc = -ENODEV; 819 821 goto err_out; 820 822 } 821 823 if (mmio_len < RTL_MIN_IO_SIZE) { 822 - printk (KERN_ERR PFX "%s: Invalid PCI mem region size(s), aborting\n", pci_name(pdev)); 824 + dev_printk (KERN_ERR, &pdev->dev, 825 + "Invalid PCI mem region size(s), aborting\n"); 823 826 rc = -ENODEV; 824 827 goto err_out; 825 828 } 826 829 #endif 827 830 828 - rc = pci_request_regions (pdev, "8139too"); 831 + rc = pci_request_regions (pdev, DRV_NAME); 829 832 if (rc) 830 833 goto err_out; 831 834 disable_dev_on_err = 1; ··· 840 835 #ifdef USE_IO_OPS 841 836 ioaddr = ioport_map(pio_start, pio_len); 842 837 if (!ioaddr) { 843 - printk (KERN_ERR PFX "%s: cannot map PIO, aborting\n", pci_name(pdev)); 838 + dev_printk (KERN_ERR, &pdev->dev, "cannot map PIO, aborting\n"); 844 839 rc = -EIO; 845 840 goto err_out; 846 841 } ··· 851 846 /* ioremap MMIO region */ 852 847 ioaddr = pci_iomap(pdev, 1, 0); 853 848 if (ioaddr == NULL) { 854 - printk (KERN_ERR PFX "%s: cannot remap MMIO, aborting\n", pci_name(pdev)); 849 + dev_printk (KERN_ERR, &pdev->dev, 850 + "cannot remap MMIO, aborting\n"); 855 851 rc = -EIO; 856 852 goto err_out; 857 853 } ··· 866 860 867 861 /* check for missing/broken hardware */ 868 862 if (RTL_R32 (TxConfig) == 0xFFFFFFFF) { 869 - printk (KERN_ERR PFX "%s: Chip not responding, ignoring board\n", 870 - pci_name(pdev)); 863 + dev_printk (KERN_ERR, &pdev->dev, 864 + "Chip not responding, ignoring board\n"); 871 865 rc = -EIO; 872 866 goto err_out; 873 867 } ··· 881 875 } 882 876 883 877 /* if unknown chip, assume array element #0, original RTL-8139 in this case */ 884 - printk (KERN_DEBUG PFX "%s: unknown chip version, assuming RTL-8139\n", 885 - pci_name(pdev)); 886 - printk (KERN_DEBUG PFX "%s: TxConfig = 0x%lx\n", pci_name(pdev), RTL_R32 (TxConfig)); 878 + dev_printk (KERN_DEBUG, &pdev->dev, 879 + "unknown chip version, assuming RTL-8139\n"); 880 + dev_printk (KERN_DEBUG, &pdev->dev, 881 + "TxConfig = 0x%lx\n", RTL_R32 (TxConfig)); 887 882 tp->chipset = 0; 888 883 889 884 match: ··· 961 954 962 955 if (pdev->vendor == PCI_VENDOR_ID_REALTEK && 963 956 pdev->device == PCI_DEVICE_ID_REALTEK_8139 && pci_rev >= 0x20) { 964 - printk(KERN_INFO PFX "pci dev %s (id %04x:%04x rev %02x) is an enhanced 8139C+ chip\n", 965 - pci_name(pdev), pdev->vendor, pdev->device, pci_rev); 966 - printk(KERN_INFO PFX "Use the \"8139cp\" driver for improved performance and stability.\n"); 957 + dev_printk(KERN_INFO, &pdev->dev, 958 + "This (id %04x:%04x rev %02x) is an enhanced 8139C+ chip\n", 959 + pdev->vendor, pdev->device, pci_rev); 960 + dev_printk(KERN_INFO, &pdev->dev, 961 + "Use the \"8139cp\" driver for improved performance and stability.\n"); 967 962 } 968 963 969 964 i = rtl8139_init_board (pdev, &dev);
+15 -13
drivers/net/b44.c
··· 2120 2120 2121 2121 err = pci_enable_device(pdev); 2122 2122 if (err) { 2123 - printk(KERN_ERR PFX "Cannot enable PCI device, " 2123 + dev_printk(KERN_ERR, &pdev->dev, "Cannot enable PCI device, " 2124 2124 "aborting.\n"); 2125 2125 return err; 2126 2126 } 2127 2127 2128 2128 if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM)) { 2129 - printk(KERN_ERR PFX "Cannot find proper PCI device " 2129 + dev_printk(KERN_ERR, &pdev->dev, 2130 + "Cannot find proper PCI device " 2130 2131 "base address, aborting.\n"); 2131 2132 err = -ENODEV; 2132 2133 goto err_out_disable_pdev; ··· 2135 2134 2136 2135 err = pci_request_regions(pdev, DRV_MODULE_NAME); 2137 2136 if (err) { 2138 - printk(KERN_ERR PFX "Cannot obtain PCI resources, " 2139 - "aborting.\n"); 2137 + dev_printk(KERN_ERR, &pdev->dev, 2138 + "Cannot obtain PCI resources, aborting.\n"); 2140 2139 goto err_out_disable_pdev; 2141 2140 } 2142 2141 ··· 2144 2143 2145 2144 err = pci_set_dma_mask(pdev, (u64) B44_DMA_MASK); 2146 2145 if (err) { 2147 - printk(KERN_ERR PFX "No usable DMA configuration, " 2148 - "aborting.\n"); 2146 + dev_printk(KERN_ERR, &pdev->dev, 2147 + "No usable DMA configuration, aborting.\n"); 2149 2148 goto err_out_free_res; 2150 2149 } 2151 2150 2152 2151 err = pci_set_consistent_dma_mask(pdev, (u64) B44_DMA_MASK); 2153 2152 if (err) { 2154 - printk(KERN_ERR PFX "No usable DMA configuration, " 2155 - "aborting.\n"); 2153 + dev_printk(KERN_ERR, &pdev->dev, 2154 + "No usable DMA configuration, aborting.\n"); 2156 2155 goto err_out_free_res; 2157 2156 } 2158 2157 ··· 2161 2160 2162 2161 dev = alloc_etherdev(sizeof(*bp)); 2163 2162 if (!dev) { 2164 - printk(KERN_ERR PFX "Etherdev alloc failed, aborting.\n"); 2163 + dev_printk(KERN_ERR, &pdev->dev, 2164 + "Etherdev alloc failed, aborting.\n"); 2165 2165 err = -ENOMEM; 2166 2166 goto err_out_free_res; 2167 2167 } ··· 2183 2181 2184 2182 bp->regs = ioremap(b44reg_base, b44reg_len); 2185 2183 if (bp->regs == 0UL) { 2186 - printk(KERN_ERR PFX "Cannot map device registers, " 2184 + dev_printk(KERN_ERR, &pdev->dev, "Cannot map device registers, " 2187 2185 "aborting.\n"); 2188 2186 err = -ENOMEM; 2189 2187 goto err_out_free_dev; ··· 2214 2212 2215 2213 err = b44_get_invariants(bp); 2216 2214 if (err) { 2217 - printk(KERN_ERR PFX "Problem fetching invariants of chip, " 2218 - "aborting.\n"); 2215 + dev_printk(KERN_ERR, &pdev->dev, 2216 + "Problem fetching invariants of chip, aborting.\n"); 2219 2217 goto err_out_iounmap; 2220 2218 } 2221 2219 ··· 2235 2233 2236 2234 err = register_netdev(dev); 2237 2235 if (err) { 2238 - printk(KERN_ERR PFX "Cannot register net device, " 2236 + dev_printk(KERN_ERR, &pdev->dev, "Cannot register net device, " 2239 2237 "aborting.\n"); 2240 2238 goto err_out_iounmap; 2241 2239 }
+22 -15
drivers/net/bnx2.c
··· 5575 5575 /* enable device (incl. PCI PM wakeup), and bus-mastering */ 5576 5576 rc = pci_enable_device(pdev); 5577 5577 if (rc) { 5578 - printk(KERN_ERR PFX "Cannot enable PCI device, aborting."); 5578 + dev_printk(KERN_ERR, &pdev->dev, 5579 + "Cannot enable PCI device, aborting."); 5579 5580 goto err_out; 5580 5581 } 5581 5582 5582 5583 if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM)) { 5583 - printk(KERN_ERR PFX "Cannot find PCI device base address, " 5584 - "aborting.\n"); 5584 + dev_printk(KERN_ERR, &pdev->dev, 5585 + "Cannot find PCI device base address, aborting.\n"); 5585 5586 rc = -ENODEV; 5586 5587 goto err_out_disable; 5587 5588 } 5588 5589 5589 5590 rc = pci_request_regions(pdev, DRV_MODULE_NAME); 5590 5591 if (rc) { 5591 - printk(KERN_ERR PFX "Cannot obtain PCI resources, aborting.\n"); 5592 + dev_printk(KERN_ERR, &pdev->dev, 5593 + "Cannot obtain PCI resources, aborting.\n"); 5592 5594 goto err_out_disable; 5593 5595 } 5594 5596 ··· 5598 5596 5599 5597 bp->pm_cap = pci_find_capability(pdev, PCI_CAP_ID_PM); 5600 5598 if (bp->pm_cap == 0) { 5601 - printk(KERN_ERR PFX "Cannot find power management capability, " 5602 - "aborting.\n"); 5599 + dev_printk(KERN_ERR, &pdev->dev, 5600 + "Cannot find power management capability, aborting.\n"); 5603 5601 rc = -EIO; 5604 5602 goto err_out_release; 5605 5603 } 5606 5604 5607 5605 bp->pcix_cap = pci_find_capability(pdev, PCI_CAP_ID_PCIX); 5608 5606 if (bp->pcix_cap == 0) { 5609 - printk(KERN_ERR PFX "Cannot find PCIX capability, aborting.\n"); 5607 + dev_printk(KERN_ERR, &pdev->dev, 5608 + "Cannot find PCIX capability, aborting.\n"); 5610 5609 rc = -EIO; 5611 5610 goto err_out_release; 5612 5611 } ··· 5615 5612 if (pci_set_dma_mask(pdev, DMA_64BIT_MASK) == 0) { 5616 5613 bp->flags |= USING_DAC_FLAG; 5617 5614 if (pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK) != 0) { 5618 - printk(KERN_ERR PFX "pci_set_consistent_dma_mask " 5619 - "failed, aborting.\n"); 5615 + dev_printk(KERN_ERR, &pdev->dev, 5616 + "pci_set_consistent_dma_mask failed, aborting.\n"); 5620 5617 rc = -EIO; 5621 5618 goto err_out_release; 5622 5619 } 5623 5620 } 5624 5621 else if (pci_set_dma_mask(pdev, DMA_32BIT_MASK) != 0) { 5625 - printk(KERN_ERR PFX "System does not support DMA, aborting.\n"); 5622 + dev_printk(KERN_ERR, &pdev->dev, 5623 + "System does not support DMA, aborting.\n"); 5626 5624 rc = -EIO; 5627 5625 goto err_out_release; 5628 5626 } ··· 5643 5639 bp->regview = ioremap_nocache(dev->base_addr, mem_len); 5644 5640 5645 5641 if (!bp->regview) { 5646 - printk(KERN_ERR PFX "Cannot map register space, aborting.\n"); 5642 + dev_printk(KERN_ERR, &pdev->dev, 5643 + "Cannot map register space, aborting.\n"); 5647 5644 rc = -ENOMEM; 5648 5645 goto err_out_release; 5649 5646 } ··· 5716 5711 else if ((CHIP_ID(bp) == CHIP_ID_5706_A1) && 5717 5712 !(bp->flags & PCIX_FLAG)) { 5718 5713 5719 - printk(KERN_ERR PFX "5706 A1 can only be used in a PCIX bus, " 5720 - "aborting.\n"); 5714 + dev_printk(KERN_ERR, &pdev->dev, 5715 + "5706 A1 can only be used in a PCIX bus, aborting.\n"); 5721 5716 goto err_out_unmap; 5722 5717 } 5723 5718 ··· 5738 5733 5739 5734 if ((reg & BNX2_DEV_INFO_SIGNATURE_MAGIC_MASK) != 5740 5735 BNX2_DEV_INFO_SIGNATURE_MAGIC) { 5741 - printk(KERN_ERR PFX "Firmware not running, aborting.\n"); 5736 + dev_printk(KERN_ERR, &pdev->dev, 5737 + "Firmware not running, aborting.\n"); 5742 5738 rc = -ENODEV; 5743 5739 goto err_out_unmap; 5744 5740 } ··· 5901 5895 #endif 5902 5896 5903 5897 if ((rc = register_netdev(dev))) { 5904 - printk(KERN_ERR PFX "Cannot register net device\n"); 5898 + dev_printk(KERN_ERR, &pdev->dev, 5899 + "Cannot register net device\n"); 5905 5900 if (bp->regview) 5906 5901 iounmap(bp->regview); 5907 5902 pci_release_regions(pdev);
+10 -10
drivers/net/cassini.c
··· 4887 4887 4888 4888 err = pci_enable_device(pdev); 4889 4889 if (err) { 4890 - printk(KERN_ERR PFX "Cannot enable PCI device, " 4890 + dev_printk(KERN_ERR, &pdev->dev, "Cannot enable PCI device, " 4891 4891 "aborting.\n"); 4892 4892 return err; 4893 4893 } 4894 4894 4895 4895 if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM)) { 4896 - printk(KERN_ERR PFX "Cannot find proper PCI device " 4896 + dev_printk(KERN_ERR, &pdev->dev, "Cannot find proper PCI device " 4897 4897 "base address, aborting.\n"); 4898 4898 err = -ENODEV; 4899 4899 goto err_out_disable_pdev; ··· 4901 4901 4902 4902 dev = alloc_etherdev(sizeof(*cp)); 4903 4903 if (!dev) { 4904 - printk(KERN_ERR PFX "Etherdev alloc failed, aborting.\n"); 4904 + dev_printk(KERN_ERR, &pdev->dev, "Etherdev alloc failed, aborting.\n"); 4905 4905 err = -ENOMEM; 4906 4906 goto err_out_disable_pdev; 4907 4907 } ··· 4910 4910 4911 4911 err = pci_request_regions(pdev, dev->name); 4912 4912 if (err) { 4913 - printk(KERN_ERR PFX "Cannot obtain PCI resources, " 4913 + dev_printk(KERN_ERR, &pdev->dev, "Cannot obtain PCI resources, " 4914 4914 "aborting.\n"); 4915 4915 goto err_out_free_netdev; 4916 4916 } ··· 4941 4941 if (pci_write_config_byte(pdev, 4942 4942 PCI_CACHE_LINE_SIZE, 4943 4943 cas_cacheline_size)) { 4944 - printk(KERN_ERR PFX "Could not set PCI cache " 4944 + dev_printk(KERN_ERR, &pdev->dev, "Could not set PCI cache " 4945 4945 "line size\n"); 4946 4946 goto err_write_cacheline; 4947 4947 } ··· 4955 4955 err = pci_set_consistent_dma_mask(pdev, 4956 4956 DMA_64BIT_MASK); 4957 4957 if (err < 0) { 4958 - printk(KERN_ERR PFX "Unable to obtain 64-bit DMA " 4958 + dev_printk(KERN_ERR, &pdev->dev, "Unable to obtain 64-bit DMA " 4959 4959 "for consistent allocations\n"); 4960 4960 goto err_out_free_res; 4961 4961 } ··· 4963 4963 } else { 4964 4964 err = pci_set_dma_mask(pdev, DMA_32BIT_MASK); 4965 4965 if (err) { 4966 - printk(KERN_ERR PFX "No usable DMA configuration, " 4966 + dev_printk(KERN_ERR, &pdev->dev, "No usable DMA configuration, " 4967 4967 "aborting.\n"); 4968 4968 goto err_out_free_res; 4969 4969 } ··· 5023 5023 /* give us access to cassini registers */ 5024 5024 cp->regs = pci_iomap(pdev, 0, casreg_len); 5025 5025 if (cp->regs == 0UL) { 5026 - printk(KERN_ERR PFX "Cannot map device registers, " 5026 + dev_printk(KERN_ERR, &pdev->dev, "Cannot map device registers, " 5027 5027 "aborting.\n"); 5028 5028 goto err_out_free_res; 5029 5029 } ··· 5040 5040 pci_alloc_consistent(pdev, sizeof(struct cas_init_block), 5041 5041 &cp->block_dvma); 5042 5042 if (!cp->init_block) { 5043 - printk(KERN_ERR PFX "Cannot allocate init block, " 5043 + dev_printk(KERN_ERR, &pdev->dev, "Cannot allocate init block, " 5044 5044 "aborting.\n"); 5045 5045 goto err_out_iounmap; 5046 5046 } ··· 5085 5085 dev->features |= NETIF_F_HIGHDMA; 5086 5086 5087 5087 if (register_netdev(dev)) { 5088 - printk(KERN_ERR PFX "Cannot register net device, " 5088 + dev_printk(KERN_ERR, &pdev->dev, "Cannot register net device, " 5089 5089 "aborting.\n"); 5090 5090 goto err_out_free_consistent; 5091 5091 }
+5 -3
drivers/net/eepro100.c
··· 555 555 556 556 if (!request_region(pci_resource_start(pdev, 1), 557 557 pci_resource_len(pdev, 1), "eepro100")) { 558 - printk (KERN_ERR "eepro100: cannot reserve I/O ports\n"); 558 + dev_printk (KERN_ERR, &pdev->dev, 559 + "eepro100: cannot reserve I/O ports\n"); 559 560 goto err_out_none; 560 561 } 561 562 if (!request_mem_region(pci_resource_start(pdev, 0), 562 563 pci_resource_len(pdev, 0), "eepro100")) { 563 - printk (KERN_ERR "eepro100: cannot reserve MMIO region\n"); 564 + dev_printk (KERN_ERR, &pdev->dev, 565 + "eepro100: cannot reserve MMIO region\n"); 564 566 goto err_out_free_pio_region; 565 567 } 566 568 ··· 575 573 576 574 ioaddr = pci_iomap(pdev, pci_bar, 0); 577 575 if (!ioaddr) { 578 - printk (KERN_ERR "eepro100: cannot remap IO\n"); 576 + dev_printk (KERN_ERR, &pdev->dev, "eepro100: cannot remap IO\n"); 579 577 goto err_out_free_mmio_region; 580 578 } 581 579
+12 -11
drivers/net/epic100.c
··· 422 422 ((u16 *)dev->dev_addr)[i] = le16_to_cpu(inw(ioaddr + LAN0 + i*4)); 423 423 424 424 if (debug > 2) { 425 - printk(KERN_DEBUG DRV_NAME "(%s): EEPROM contents\n", 426 - pci_name(pdev)); 425 + dev_printk(KERN_DEBUG, &pdev->dev, "EEPROM contents:\n"); 427 426 for (i = 0; i < 64; i++) 428 427 printk(" %4.4x%s", read_eeprom(ioaddr, i), 429 428 i % 16 == 15 ? "\n" : ""); ··· 444 445 int mii_status = mdio_read(dev, phy, MII_BMSR); 445 446 if (mii_status != 0xffff && mii_status != 0x0000) { 446 447 ep->phys[phy_idx++] = phy; 447 - printk(KERN_INFO DRV_NAME "(%s): MII transceiver #%d control " 448 - "%4.4x status %4.4x.\n", 449 - pci_name(pdev), phy, mdio_read(dev, phy, 0), mii_status); 448 + dev_printk(KERN_INFO, &pdev->dev, 449 + "MII transceiver #%d control " 450 + "%4.4x status %4.4x.\n", 451 + phy, mdio_read(dev, phy, 0), mii_status); 450 452 } 451 453 } 452 454 ep->mii_phy_cnt = phy_idx; 453 455 if (phy_idx != 0) { 454 456 phy = ep->phys[0]; 455 457 ep->mii.advertising = mdio_read(dev, phy, MII_ADVERTISE); 456 - printk(KERN_INFO DRV_NAME "(%s): Autonegotiation advertising %4.4x link " 458 + dev_printk(KERN_INFO, &pdev->dev, 459 + "Autonegotiation advertising %4.4x link " 457 460 "partner %4.4x.\n", 458 - pci_name(pdev), ep->mii.advertising, mdio_read(dev, phy, 5)); 461 + ep->mii.advertising, mdio_read(dev, phy, 5)); 459 462 } else if ( ! (ep->chip_flags & NO_MII)) { 460 - printk(KERN_WARNING DRV_NAME "(%s): ***WARNING***: No MII transceiver found!\n", 461 - pci_name(pdev)); 463 + dev_printk(KERN_WARNING, &pdev->dev, 464 + "***WARNING***: No MII transceiver found!\n"); 462 465 /* Use the known PHY address of the EPII. */ 463 466 ep->phys[0] = 3; 464 467 } ··· 475 474 /* The lower four bits are the media type. */ 476 475 if (duplex) { 477 476 ep->mii.force_media = ep->mii.full_duplex = 1; 478 - printk(KERN_INFO DRV_NAME "(%s): Forced full duplex operation requested.\n", 479 - pci_name(pdev)); 477 + dev_printk(KERN_INFO, &pdev->dev, 478 + "Forced full duplex operation requested.\n"); 480 479 } 481 480 dev->if_port = ep->default_port = option; 482 481
+9 -8
drivers/net/fealnx.c
··· 578 578 579 579 if (mii_status != 0xffff && mii_status != 0x0000) { 580 580 np->phys[phy_idx++] = phy; 581 - printk(KERN_INFO 582 - "%s: MII PHY found at address %d, status " 583 - "0x%4.4x.\n", dev->name, phy, mii_status); 581 + dev_printk(KERN_INFO, &pdev->dev, 582 + "MII PHY found at address %d, status " 583 + "0x%4.4x.\n", phy, mii_status); 584 584 /* get phy type */ 585 585 { 586 586 unsigned int data; ··· 603 603 } 604 604 605 605 np->mii_cnt = phy_idx; 606 - if (phy_idx == 0) { 607 - printk(KERN_WARNING "%s: MII PHY not found -- this device may " 608 - "not operate correctly.\n", dev->name); 609 - } 606 + if (phy_idx == 0) 607 + dev_printk(KERN_WARNING, &pdev->dev, 608 + "MII PHY not found -- this device may " 609 + "not operate correctly.\n"); 610 610 } else { 611 611 np->phys[0] = 32; 612 612 /* 89/6/23 add, (begin) */ ··· 632 632 np->mii.full_duplex = full_duplex[card_idx]; 633 633 634 634 if (np->mii.full_duplex) { 635 - printk(KERN_INFO "%s: Media type forced to Full Duplex.\n", dev->name); 635 + dev_printk(KERN_INFO, &pdev->dev, 636 + "Media type forced to Full Duplex.\n"); 636 637 /* 89/6/13 add, (begin) */ 637 638 // if (np->PHYType==MarvellPHY) 638 639 if ((np->PHYType == MarvellPHY) || (np->PHYType == LevelOnePHY)) {
+2 -1
drivers/net/hamachi.c
··· 601 601 pci_set_master(pdev); 602 602 603 603 i = pci_request_regions(pdev, DRV_NAME); 604 - if (i) return i; 604 + if (i) 605 + return i; 605 606 606 607 irq = pdev->irq; 607 608 ioaddr = ioremap(base, 0x400);
+8 -4
drivers/net/ne2k-pci.c
··· 231 231 irq = pdev->irq; 232 232 233 233 if (!ioaddr || ((pci_resource_flags (pdev, 0) & IORESOURCE_IO) == 0)) { 234 - printk (KERN_ERR PFX "no I/O resource at PCI BAR #0\n"); 234 + dev_printk (KERN_ERR, &pdev->dev, 235 + "no I/O resource at PCI BAR #0\n"); 235 236 return -ENODEV; 236 237 } 237 238 238 239 if (request_region (ioaddr, NE_IO_EXTENT, DRV_NAME) == NULL) { 239 - printk (KERN_ERR PFX "I/O resource 0x%x @ 0x%lx busy\n", 240 + dev_printk (KERN_ERR, &pdev->dev, 241 + "I/O resource 0x%x @ 0x%lx busy\n", 240 242 NE_IO_EXTENT, ioaddr); 241 243 return -EBUSY; 242 244 } ··· 265 263 /* Allocate net_device, dev->priv; fill in 8390 specific dev fields. */ 266 264 dev = alloc_ei_netdev(); 267 265 if (!dev) { 268 - printk (KERN_ERR PFX "cannot allocate ethernet device\n"); 266 + dev_printk (KERN_ERR, &pdev->dev, 267 + "cannot allocate ethernet device\n"); 269 268 goto err_out_free_res; 270 269 } 271 270 SET_MODULE_OWNER(dev); ··· 284 281 while ((inb(ioaddr + EN0_ISR) & ENISR_RESET) == 0) 285 282 /* Limit wait: '2' avoids jiffy roll-over. */ 286 283 if (jiffies - reset_start_time > 2) { 287 - printk(KERN_ERR PFX "Card failure (no reset ack).\n"); 284 + dev_printk(KERN_ERR, &pdev->dev, 285 + "Card failure (no reset ack).\n"); 288 286 goto err_out_free_netdev; 289 287 } 290 288
+9 -5
drivers/net/ns83820.c
··· 1832 1832 } else if (!pci_set_dma_mask(pci_dev, DMA_32BIT_MASK)) { 1833 1833 using_dac = 0; 1834 1834 } else { 1835 - printk(KERN_WARNING "ns83820.c: pci_set_dma_mask failed!\n"); 1835 + dev_printk(KERN_WARNING, &pci_dev->dev, 1836 + "pci_set_dma_mask failed!\n"); 1836 1837 return -ENODEV; 1837 1838 } 1838 1839 ··· 1856 1855 1857 1856 err = pci_enable_device(pci_dev); 1858 1857 if (err) { 1859 - printk(KERN_INFO "ns83820: pci_enable_dev failed: %d\n", err); 1858 + dev_printk(KERN_INFO, &pci_dev->dev, 1859 + "pci_enable_dev failed: %d\n", err); 1860 1860 goto out_free; 1861 1861 } 1862 1862 ··· 1886 1884 err = request_irq(pci_dev->irq, ns83820_irq, IRQF_SHARED, 1887 1885 DRV_NAME, ndev); 1888 1886 if (err) { 1889 - printk(KERN_INFO "ns83820: unable to register irq %d\n", 1890 - pci_dev->irq); 1887 + dev_printk(KERN_INFO, &pci_dev->dev, 1888 + "unable to register irq %d, err %d\n", 1889 + pci_dev->irq, err); 1891 1890 goto out_disable; 1892 1891 } 1893 1892 ··· 1902 1899 rtnl_lock(); 1903 1900 err = dev_alloc_name(ndev, ndev->name); 1904 1901 if (err < 0) { 1905 - printk(KERN_INFO "ns83820: unable to get netdev name: %d\n", err); 1902 + dev_printk(KERN_INFO, &pci_dev->dev, 1903 + "unable to get netdev name: %d\n", err); 1906 1904 goto out_free_irq; 1907 1905 } 1908 1906
+15 -9
drivers/net/pci-skeleton.c
··· 601 601 /* dev zeroed in alloc_etherdev */ 602 602 dev = alloc_etherdev (sizeof (*tp)); 603 603 if (dev == NULL) { 604 - printk (KERN_ERR PFX "unable to alloc new ethernet\n"); 604 + dev_printk (KERN_ERR, &pdev->dev, 605 + "unable to alloc new ethernet\n"); 605 606 DPRINTK ("EXIT, returning -ENOMEM\n"); 606 607 return -ENOMEM; 607 608 } ··· 632 631 633 632 /* make sure PCI base addr 0 is PIO */ 634 633 if (!(pio_flags & IORESOURCE_IO)) { 635 - printk (KERN_ERR PFX "region #0 not a PIO resource, aborting\n"); 634 + dev_printk (KERN_ERR, &pdev->dev, 635 + "region #0 not a PIO resource, aborting\n"); 636 636 rc = -ENODEV; 637 637 goto err_out; 638 638 } 639 639 640 640 /* make sure PCI base addr 1 is MMIO */ 641 641 if (!(mmio_flags & IORESOURCE_MEM)) { 642 - printk (KERN_ERR PFX "region #1 not an MMIO resource, aborting\n"); 642 + dev_printk (KERN_ERR, &pdev->dev, 643 + "region #1 not an MMIO resource, aborting\n"); 643 644 rc = -ENODEV; 644 645 goto err_out; 645 646 } ··· 649 646 /* check for weird/broken PCI region reporting */ 650 647 if ((pio_len < NETDRV_MIN_IO_SIZE) || 651 648 (mmio_len < NETDRV_MIN_IO_SIZE)) { 652 - printk (KERN_ERR PFX "Invalid PCI region size(s), aborting\n"); 649 + dev_printk (KERN_ERR, &pdev->dev, 650 + "Invalid PCI region size(s), aborting\n"); 653 651 rc = -ENODEV; 654 652 goto err_out; 655 653 } 656 654 657 - rc = pci_request_regions (pdev, "pci-skeleton"); 655 + rc = pci_request_regions (pdev, MODNAME); 658 656 if (rc) 659 657 goto err_out; 660 658 ··· 667 663 /* ioremap MMIO region */ 668 664 ioaddr = ioremap (mmio_start, mmio_len); 669 665 if (ioaddr == NULL) { 670 - printk (KERN_ERR PFX "cannot remap MMIO, aborting\n"); 666 + dev_printk (KERN_ERR, &pdev->dev, 667 + "cannot remap MMIO, aborting\n"); 671 668 rc = -EIO; 672 669 goto err_out_free_res; 673 670 } ··· 704 699 } 705 700 706 701 /* if unknown chip, assume array element #0, original RTL-8139 in this case */ 707 - printk (KERN_DEBUG PFX "PCI device %s: unknown chip version, assuming RTL-8139\n", 708 - pci_name(pdev)); 709 - printk (KERN_DEBUG PFX "PCI device %s: TxConfig = 0x%lx\n", pci_name(pdev), NETDRV_R32 (TxConfig)); 702 + dev_printk (KERN_DEBUG, &pdev->dev, 703 + "unknown chip version, assuming RTL-8139\n"); 704 + dev_printk (KERN_DEBUG, &pdev->dev, "TxConfig = 0x%lx\n", 705 + NETDRV_R32 (TxConfig)); 710 706 tp->chipset = 0; 711 707 712 708 match:
+19 -24
drivers/net/r8169.c
··· 1406 1406 dev = alloc_etherdev(sizeof (*tp)); 1407 1407 if (dev == NULL) { 1408 1408 if (netif_msg_drv(&debug)) 1409 - printk(KERN_ERR PFX "unable to alloc new ethernet\n"); 1409 + dev_printk(KERN_ERR, &pdev->dev, 1410 + "unable to alloc new ethernet\n"); 1410 1411 goto err_out; 1411 1412 } 1412 1413 ··· 1419 1418 /* enable device (incl. PCI PM wakeup and hotplug setup) */ 1420 1419 rc = pci_enable_device(pdev); 1421 1420 if (rc < 0) { 1422 - if (netif_msg_probe(tp)) { 1423 - printk(KERN_ERR PFX "%s: enable failure\n", 1424 - pci_name(pdev)); 1425 - } 1421 + if (netif_msg_probe(tp)) 1422 + dev_printk(KERN_ERR, &pdev->dev, "enable failure\n"); 1426 1423 goto err_out_free_dev; 1427 1424 } 1428 1425 ··· 1436 1437 pci_read_config_word(pdev, pm_cap + PCI_PM_CTRL, &pwr_command); 1437 1438 acpi_idle_state = pwr_command & PCI_PM_CTRL_STATE_MASK; 1438 1439 } else { 1439 - if (netif_msg_probe(tp)) { 1440 - printk(KERN_ERR PFX 1440 + if (netif_msg_probe(tp)) 1441 + dev_printk(KERN_ERR, &pdev->dev, 1441 1442 "PowerManagement capability not found.\n"); 1442 - } 1443 1443 } 1444 1444 1445 1445 /* make sure PCI base addr 1 is MMIO */ 1446 1446 if (!(pci_resource_flags(pdev, 1) & IORESOURCE_MEM)) { 1447 - if (netif_msg_probe(tp)) { 1448 - printk(KERN_ERR PFX 1447 + if (netif_msg_probe(tp)) 1448 + dev_printk(KERN_ERR, &pdev->dev, 1449 1449 "region #1 not an MMIO resource, aborting\n"); 1450 - } 1451 1450 rc = -ENODEV; 1452 1451 goto err_out_mwi; 1453 1452 } 1454 1453 /* check for weird/broken PCI region reporting */ 1455 1454 if (pci_resource_len(pdev, 1) < R8169_REGS_SIZE) { 1456 - if (netif_msg_probe(tp)) { 1457 - printk(KERN_ERR PFX 1455 + if (netif_msg_probe(tp)) 1456 + dev_printk(KERN_ERR, &pdev->dev, 1458 1457 "Invalid PCI region size(s), aborting\n"); 1459 - } 1460 1458 rc = -ENODEV; 1461 1459 goto err_out_mwi; 1462 1460 } 1463 1461 1464 1462 rc = pci_request_regions(pdev, MODULENAME); 1465 1463 if (rc < 0) { 1466 - if (netif_msg_probe(tp)) { 1467 - printk(KERN_ERR PFX "%s: could not request regions.\n", 1468 - pci_name(pdev)); 1469 - } 1464 + if (netif_msg_probe(tp)) 1465 + dev_printk(KERN_ERR, &pdev->dev, 1466 + "could not request regions.\n"); 1470 1467 goto err_out_mwi; 1471 1468 } 1472 1469 ··· 1475 1480 } else { 1476 1481 rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK); 1477 1482 if (rc < 0) { 1478 - if (netif_msg_probe(tp)) { 1479 - printk(KERN_ERR PFX 1483 + if (netif_msg_probe(tp)) 1484 + dev_printk(KERN_ERR, &pdev->dev, 1480 1485 "DMA configuration failed.\n"); 1481 - } 1482 1486 goto err_out_free_res; 1483 1487 } 1484 1488 } ··· 1488 1494 ioaddr = ioremap(pci_resource_start(pdev, 1), R8169_REGS_SIZE); 1489 1495 if (ioaddr == NULL) { 1490 1496 if (netif_msg_probe(tp)) 1491 - printk(KERN_ERR PFX "cannot remap MMIO, aborting\n"); 1497 + dev_printk(KERN_ERR, &pdev->dev, 1498 + "cannot remap MMIO, aborting\n"); 1492 1499 rc = -EIO; 1493 1500 goto err_out_free_res; 1494 1501 } ··· 1521 1526 if (i < 0) { 1522 1527 /* Unknown chip: assume array element #0, original RTL-8169 */ 1523 1528 if (netif_msg_probe(tp)) { 1524 - printk(KERN_DEBUG PFX "PCI device %s: " 1529 + dev_printk(KERN_DEBUG, &pdev->dev, 1525 1530 "unknown chip version, assuming %s\n", 1526 - pci_name(pdev), rtl_chip_info[0].name); 1531 + rtl_chip_info[0].name); 1527 1532 } 1528 1533 i++; 1529 1534 }