Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2e8a538d authored by Jeff Garzik's avatar Jeff Garzik
Browse files

[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: default avatarJeff Garzik <jeff@garzik.org>
parent cabb7667
Loading
Loading
Loading
Loading
+22 −16
Original line number Diff line number Diff line
@@ -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,13 +1899,14 @@ 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, "
			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",
		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, pci_name(pdev));
		       (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);
+25 −16
Original line number Diff line number Diff line
@@ -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);
+15 −13
Original line number Diff line number Diff line
@@ -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;
	}
+22 −15
Original line number Diff line number Diff line
@@ -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);
+10 −10
Original line number Diff line number Diff line
@@ -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;
	}
Loading