pci_dev->device == PCI_DEVICE_ID_NVIDIA_NVENET_2 || pci_dev->device == PCI_DEVICE_ID_NVIDIA_NVENET_3 || pci_dev->device == PCI_DEVICE_ID_NVIDIA_NVENET_12 || pci_dev->device == PCI_DEVICE_ID_NVIDIA_NVENET_13) 
pci_dev->device == PCI_DEVICE_ID_NVIDIA_NVENET_2 || pci_dev->device == PCI_DEVICE_ID_NVIDIA_NVENET_3 || pci_dev->device == PCI_DEVICE_ID_NVIDIA_NVENET_12 || pci_dev->device == PCI_DEVICE_ID_NVIDIA_NVENET_13) { 
static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_id *id){	struct net_device *dev;	struct fe_priv *np;	unsigned long addr;	u8 __iomem *base;	int err, i;	dev = alloc_etherdev(sizeof(struct fe_priv));	err = -ENOMEM;	if (!dev)		goto out;	np = get_nvpriv(dev);	np->pci_dev = pci_dev;	spin_lock_init(&np->lock);	SET_MODULE_OWNER(dev);	SET_NETDEV_DEV(dev, &pci_dev->dev);	init_timer(&np->oom_kick);	np->oom_kick.data = (unsigned long) dev;	np->oom_kick.function = &nv_do_rx_refill;	/* timer handler */	init_timer(&np->nic_poll);	np->nic_poll.data = (unsigned long) dev;	np->nic_poll.function = &nv_do_nic_poll;	/* timer handler */	err = pci_enable_device(pci_dev);	if (err) {		printk(KERN_INFO "forcedeth: pci_enable_dev failed (%d) for device %s\n",				err, pci_name(pci_dev));		goto out_free;	}	pci_set_master(pci_dev);	err = pci_request_regions(pci_dev, DRV_NAME);	if (err < 0)		goto out_disable;	err = -EINVAL;	addr = 0;	for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {		dprintk(KERN_DEBUG "%s: resource %d start %p len %ld flags 0x%08lx.\n",				pci_name(pci_dev), i, (void*)pci_resource_start(pci_dev, i),				pci_resource_len(pci_dev, i),				pci_resource_flags(pci_dev, i));		if (pci_resource_flags(pci_dev, i) & IORESOURCE_MEM &&				pci_resource_len(pci_dev, i) >= NV_PCI_REGSZ) {			addr = pci_resource_start(pci_dev, i);			break;		}	}	if (i == DEVICE_COUNT_RESOURCE) {		printk(KERN_INFO "forcedeth: Couldn't find register window for device %s.\n",					pci_name(pci_dev));		goto out_relreg;	}	/* handle different descriptor versions */	if (pci_dev->device == PCI_DEVICE_ID_NVIDIA_NVENET_1 ||		pci_dev->device == PCI_DEVICE_ID_NVIDIA_NVENET_2 ||		pci_dev->device == PCI_DEVICE_ID_NVIDIA_NVENET_3 ||    		pci_dev->device == PCI_DEVICE_ID_NVIDIA_NVENET_12 ||		pci_dev->device == PCI_DEVICE_ID_NVIDIA_NVENET_13)		np->desc_ver = DESC_VER_1;	else		np->desc_ver = DESC_VER_2;	err = -ENOMEM;	np->base = ioremap(addr, NV_PCI_REGSZ);	if (!np->base)		goto out_relreg;	dev->base_addr = (unsigned long)np->base;	dev->irq = pci_dev->irq;	np->rx_ring = pci_alloc_consistent(pci_dev, sizeof(struct ring_desc) * (RX_RING + TX_RING),						&np->ring_addr);	if (!np->rx_ring)		goto out_unmap;	np->tx_ring = &np->rx_ring[RX_RING];	dev->open = nv_open;	dev->stop = nv_close;	dev->hard_start_xmit = nv_start_xmit;	dev->get_stats = nv_get_stats;	dev->change_mtu = nv_change_mtu;	dev->set_multicast_list = nv_set_multicast;#ifdef CONFIG_NET_POLL_CONTROLLER	dev->poll_controller = nv_poll_controller;#endif	SET_ETHTOOL_OPS(dev, &ops);	dev->tx_timeout = nv_tx_timeout;	dev->watchdog_timeo = NV_WATCHDOG_TIMEO;	pci_set_drvdata(pci_dev, dev);	/* read the mac address */	base = get_hwbase(dev);	np->orig_mac[0] = readl(base + NvRegMacAddrA);	np->orig_mac[1] = readl(base + NvRegMacAddrB);	dev->dev_addr[0] = (np->orig_mac[1] >>  8) & 0xff;	dev->dev_addr[1] = (np->orig_mac[1] >>  0) & 0xff;	dev->dev_addr[2] = (np->orig_mac[0] >> 24) & 0xff;	dev->dev_addr[3] = (np->orig_mac[0] >> 16) & 0xff;	dev->dev_addr[4] = (np->orig_mac[0] >>  8) & 0xff;	dev->dev_addr[5] = (np->orig_mac[0] >>  0) & 0xff;	if (!is_valid_ether_addr(dev->dev_addr)) {		/*		 * Bad mac address. At least one bios sets the mac address		 * to 01:23:45:67:89:ab		 */		printk(KERN_ERR "%s: Invalid Mac address detected: %02x:%02x:%02x:%02x:%02x:%02x\n",			pci_name(pci_dev),			dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[2],			dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5]);		printk(KERN_ERR "Please complain to your hardware vendor. Switching to a random MAC.\n");		dev->dev_addr[0] = 0x00;		dev->dev_addr[1] = 0x00;		dev->dev_addr[2] = 0x6c;		get_random_bytes(&dev->dev_addr[3], 3);	}	dprintk(KERN_DEBUG "%s: MAC Address %02x:%02x:%02x:%02x:%02x:%02x\n", pci_name(pci_dev),			dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[2],			dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5]);	/* disable WOL */	writel(0, base + NvRegWakeUpFlags);	np->wolenabled = 0;	if (np->desc_ver == DESC_VER_1) {		np->tx_flags = NV_TX_LASTPACKET|NV_TX_VALID;		if (id->driver_data & DEV_NEED_LASTPACKET1)			np->tx_flags |= NV_TX_LASTPACKET1;	} else {		np->tx_flags = NV_TX2_LASTPACKET|NV_TX2_VALID;		if (id->driver_data & DEV_NEED_LASTPACKET1)			np->tx_flags |= NV_TX2_LASTPACKET1;	}	if (id->driver_data & DEV_IRQMASK_1)		np->irqmask = NVREG_IRQMASK_WANTED_1;	if (id->driver_data & DEV_IRQMASK_2)		np->irqmask = NVREG_IRQMASK_WANTED_2;	if (id->driver_data & DEV_NEED_TIMERIRQ)		np->irqmask |= NVREG_IRQ_TIMER;	if (id->driver_data & DEV_NEED_LINKTIMER) {		dprintk(KERN_INFO "%s: link timer on.\n", pci_name(pci_dev));		np->need_linktimer = 1;		np->link_timeout = jiffies + LINK_TIMEOUT;	} else {		dprintk(KERN_INFO "%s: link timer off.\n", pci_name(pci_dev));		np->need_linktimer = 0;	}	/* find a suitable phy */	for (i = 1; i < 32; i++) {		int id1, id2;		spin_lock_irq(&np->lock);		id1 = mii_rw(dev, i, MII_PHYSID1, MII_READ);		spin_unlock_irq(&np->lock);		if (id1 < 0 || id1 == 0xffff)			continue;		spin_lock_irq(&np->lock);		id2 = mii_rw(dev, i, MII_PHYSID2, MII_READ);		spin_unlock_irq(&np->lock);		if (id2 < 0 || id2 == 0xffff)			continue;		id1 = (id1 & PHYID1_OUI_MASK) << PHYID1_OUI_SHFT;		id2 = (id2 & PHYID2_OUI_MASK) >> PHYID2_OUI_SHFT;		dprintk(KERN_DEBUG "%s: open: Found PHY %04x:%04x at address %d.\n",				pci_name(pci_dev), id1, id2, i);		np->phyaddr = i;		np->phy_oui = id1 | id2;		break;	}	if (i == 32) {		/* PHY in isolate mode? No phy attached and user wants to		 * test loopback? Very odd, but can be correct.		 */		printk(KERN_INFO "%s: open: Could not find a valid PHY.\n",				pci_name(pci_dev));	}	if (i != 32) {		/* reset it */		phy_init(dev);	}	/* set default link speed settings */	np->linkspeed = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_10;	np->duplex = 0;	np->autoneg = 1;	err = register_netdev(dev);	if (err) {		printk(KERN_INFO "forcedeth: unable to register netdev: %d\n", err);		goto out_freering;	}	printk(KERN_INFO "%s: forcedeth.c: subsystem: %05x:%04x bound to %s\n",			dev->name, pci_dev->subsystem_vendor, pci_dev->subsystem_device,			pci_name(pci_dev));	return 0;out_freering:	pci_free_consistent(np->pci_dev, sizeof(struct ring_desc) * (RX_RING + TX_RING),				np->rx_ring, np->ring_addr);	pci_set_drvdata(pci_dev, NULL);out_unmap:	iounmap(get_hwbase(dev));out_relreg:	pci_release_regions(pci_dev);out_disable:	pci_disable_device(pci_dev);out_free:	free_netdev(dev);out:	return err;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/d81c0983de80c956cf37835b0d35adb3ab4bb03a/forcedeth.c/buggy/drivers/net/forcedeth.c