dev = prism2_init_local_data(&prism2_plx_funcs, cards_found); 
dev = prism2_init_local_data(&prism2_plx_funcs, cards_found, &pdev->dev); 
static int prism2_plx_probe(struct pci_dev *pdev,			    const struct pci_device_id *id){	unsigned int pccard_ioaddr, plx_ioaddr;	unsigned long pccard_attr_mem;	unsigned int pccard_attr_len;	void __iomem *attr_mem = NULL;	unsigned int cor_offset, cor_index;	u32 reg;	local_info_t *local = NULL;	struct net_device *dev = NULL;	struct hostap_interface *iface;	static int cards_found /* = 0 */;	int irq_registered = 0;	int tmd7160;	if (pci_enable_device(pdev))		return -EIO;	/* National Datacomm NCP130 based on TMD7160, not PLX9052. */	tmd7160 = (pdev->vendor == 0x15e8) && (pdev->device == 0x0131);	plx_ioaddr = pci_resource_start(pdev, 1);	pccard_ioaddr = pci_resource_start(pdev, tmd7160 ? 2 : 3);	if (tmd7160) {		/* TMD7160 */		attr_mem = NULL; /* no access to PC Card attribute memory */		printk(KERN_INFO "TMD7160 PCI/PCMCIA adapter: io=0x%x, "		       "irq=%d, pccard_io=0x%x\n",		       plx_ioaddr, pdev->irq, pccard_ioaddr);		cor_offset = plx_ioaddr;		cor_index = 0x04;		outb(cor_index | COR_LEVLREQ | COR_ENABLE_FUNC, plx_ioaddr);		mdelay(1);		reg = inb(plx_ioaddr);		if (reg != (cor_index | COR_LEVLREQ | COR_ENABLE_FUNC)) {			printk(KERN_ERR "%s: Error setting COR (expected="			       "0x%02x, was=0x%02x)\n", dev_info,			       cor_index | COR_LEVLREQ | COR_ENABLE_FUNC, reg);			goto fail;		}	} else {		/* PLX9052 */		pccard_attr_mem = pci_resource_start(pdev, 2);		pccard_attr_len = pci_resource_len(pdev, 2);		if (pccard_attr_len < PLX_MIN_ATTR_LEN)			goto fail;		attr_mem = ioremap(pccard_attr_mem, pccard_attr_len);		if (attr_mem == NULL) {			printk(KERN_ERR "%s: cannot remap attr_mem\n",			       dev_info);			goto fail;		}		printk(KERN_INFO "PLX9052 PCI/PCMCIA adapter: "		       "mem=0x%lx, plx_io=0x%x, irq=%d, pccard_io=0x%x\n",		       pccard_attr_mem, plx_ioaddr, pdev->irq, pccard_ioaddr);		if (prism2_plx_check_cis(attr_mem, pccard_attr_len,					 &cor_offset, &cor_index)) {			printk(KERN_INFO "Unknown PC Card CIS - not a "			       "Prism2/2.5 card?\n");			goto fail;		}		printk(KERN_DEBUG "Prism2/2.5 PC Card detected in PLX9052 "		       "adapter\n");		/* Write COR to enable PC Card */		writeb(cor_index | COR_LEVLREQ | COR_ENABLE_FUNC,		       attr_mem + cor_offset);		/* Enable PCI interrupts if they are not already enabled */		reg = inl(plx_ioaddr + PLX_INTCSR);		printk(KERN_DEBUG "PLX_INTCSR=0x%x\n", reg);		if (!(reg & PLX_INTCSR_PCI_INTEN)) {			outl(reg | PLX_INTCSR_PCI_INTEN,			     plx_ioaddr + PLX_INTCSR);			if (!(inl(plx_ioaddr + PLX_INTCSR) &			      PLX_INTCSR_PCI_INTEN)) {				printk(KERN_WARNING "%s: Could not enable "				       "Local Interrupts\n", dev_info);				goto fail;			}		}		reg = inl(plx_ioaddr + PLX_CNTRL);		printk(KERN_DEBUG "PLX_CNTRL=0x%x (Serial EEPROM "		       "present=%d)\n",		       reg, (reg & PLX_CNTRL_SERIAL_EEPROM_PRESENT) != 0);		/* should set PLX_PCIIPR to 0x01 (INTA#) if Serial EEPROM is		 * not present; but are there really such cards in use(?) */	}	dev = prism2_init_local_data(&prism2_plx_funcs, cards_found);	if (dev == NULL)		goto fail;	iface = netdev_priv(dev);	local = iface->local;	cards_found++;	dev->irq = pdev->irq;	dev->base_addr = pccard_ioaddr;	local->attr_mem = attr_mem;	local->cor_offset = cor_offset;	pci_set_drvdata(pdev, dev);	if (request_irq(dev->irq, prism2_interrupt, SA_SHIRQ, dev->name,			dev)) {		printk(KERN_WARNING "%s: request_irq failed\n", dev->name);		goto fail;	} else		irq_registered = 1;	if (prism2_hw_config(dev, 1)) {		printk(KERN_DEBUG "%s: hardware initialization failed\n",		       dev_info);		goto fail;	}	return hostap_hw_ready(dev); fail:	prism2_free_local_data(dev);	if (irq_registered && dev)		free_irq(dev->irq, dev);	if (attr_mem)		iounmap(attr_mem);	pci_disable_device(pdev);	return -ENODEV;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/0cd545d6ba0e0138782eb0ec287d0eb3db529b69/hostap_plx.c/clean/drivers/net/wireless/hostap/hostap_plx.c