iounmap((char*)base_addr); 
iounmap(base_addr); 
static int ipw2100_pci_init_one(struct pci_dev *pci_dev,				const struct pci_device_id *ent){	unsigned long mem_start, mem_len, mem_flags;	char *base_addr = NULL;	struct net_device *dev = NULL;	struct ipw2100_priv *priv = NULL;	int err = 0;	int registered = 0;	u32 val;	IPW_DEBUG_INFO("enter\n");	mem_start = pci_resource_start(pci_dev, 0);	mem_len = pci_resource_len(pci_dev, 0);	mem_flags = pci_resource_flags(pci_dev, 0);	if ((mem_flags & IORESOURCE_MEM) != IORESOURCE_MEM) {		IPW_DEBUG_INFO("weird - resource type is not memory\n");		err = -ENODEV;		goto fail;	}	base_addr = ioremap_nocache(mem_start, mem_len);	if (!base_addr) {		printk(KERN_WARNING DRV_NAME		       "Error calling ioremap_nocache.\n");		err = -EIO;		goto fail;	}	/* allocate and initialize our net_device */	dev = ipw2100_alloc_device(pci_dev, base_addr, mem_start, mem_len);	if (!dev) {		printk(KERN_WARNING DRV_NAME		       "Error calling ipw2100_alloc_device.\n");		err = -ENOMEM;		goto fail;	}	/* set up PCI mappings for device */	err = pci_enable_device(pci_dev);	if (err) {		printk(KERN_WARNING DRV_NAME		       "Error calling pci_enable_device.\n");		return err;	}	priv = ieee80211_priv(dev);	pci_set_master(pci_dev);	pci_set_drvdata(pci_dev, priv);	err = pci_set_dma_mask(pci_dev, DMA_32BIT_MASK);	if (err) {		printk(KERN_WARNING DRV_NAME		       "Error calling pci_set_dma_mask.\n");		pci_disable_device(pci_dev);		return err;	}	err = pci_request_regions(pci_dev, DRV_NAME);	if (err) {		printk(KERN_WARNING DRV_NAME		       "Error calling pci_request_regions.\n");		pci_disable_device(pci_dev);		return err;	}        /* We disable the RETRY_TIMEOUT register (0x41) to keep	 * PCI Tx retries from interfering with C3 CPU state */	pci_read_config_dword(pci_dev, 0x40, &val);	if ((val & 0x0000ff00) != 0)		pci_write_config_dword(pci_dev, 0x40, val & 0xffff00ff);	pci_set_power_state(pci_dev, PCI_D0);	if (!ipw2100_hw_is_adapter_in_system(dev)) {		printk(KERN_WARNING DRV_NAME		       "Device not found via register read.\n");		err = -ENODEV;		goto fail;	}	SET_NETDEV_DEV(dev, &pci_dev->dev);	/* Force interrupts to be shut off on the device */	priv->status |= STATUS_INT_ENABLED;	ipw2100_disable_interrupts(priv);	/* Allocate and initialize the Tx/Rx queues and lists */	if (ipw2100_queues_allocate(priv)) {		printk(KERN_WARNING DRV_NAME		       "Error calilng ipw2100_queues_allocate.\n");		err = -ENOMEM;		goto fail;	}	ipw2100_queues_initialize(priv);	err = request_irq(pci_dev->irq,			  ipw2100_interrupt, SA_SHIRQ,			  dev->name, priv);	if (err) {		printk(KERN_WARNING DRV_NAME		       "Error calling request_irq: %d.\n",		       pci_dev->irq);		goto fail;	}	dev->irq = pci_dev->irq;	IPW_DEBUG_INFO("Attempting to register device...\n");	SET_MODULE_OWNER(dev);	printk(KERN_INFO DRV_NAME	       ": Detected Intel PRO/Wireless 2100 Network Connection\n");	/* Bring up the interface.  Pre 0.46, after we registered the	 * network device we would call ipw2100_up.  This introduced a race	 * condition with newer hotplug configurations (network was coming	 * up and making calls before the device was initialized).	 *	 * If we called ipw2100_up before we registered the device, then the	 * device name wasn't registered.  So, we instead use the net_dev->init	 * member to call a function that then just turns and calls ipw2100_up.	 * net_dev->init is called after name allocation but before the	 * notifier chain is called */	down(&priv->action_sem);	err = register_netdev(dev);	if (err) {		printk(KERN_WARNING DRV_NAME		       "Error calling register_netdev.\n");		goto fail_unlock;	}	registered = 1;	IPW_DEBUG_INFO("%s: Bound to %s\n", dev->name, pci_name(pci_dev));	/* perform this after register_netdev so that dev->name is set */	sysfs_create_group(&pci_dev->dev.kobj, &ipw2100_attribute_group);	netif_carrier_off(dev);	/* If the RF Kill switch is disabled, go ahead and complete the	 * startup sequence */	if (!(priv->status & STATUS_RF_KILL_MASK)) {		/* Enable the adapter - sends HOST_COMPLETE */		if (ipw2100_enable_adapter(priv)) {			printk(KERN_WARNING DRV_NAME			       ": %s: failed in call to enable adapter.\n",			       priv->net_dev->name);			ipw2100_hw_stop_adapter(priv);			err = -EIO;			goto fail_unlock;		}		/* Start a scan . . . */		ipw2100_set_scan_options(priv);		ipw2100_start_scan(priv);	}	IPW_DEBUG_INFO("exit\n");	priv->status |= STATUS_INITIALIZED;	up(&priv->action_sem);	return 0; fail_unlock:	up(&priv->action_sem); fail:	if (dev) {		if (registered)			unregister_netdev(dev);		ipw2100_hw_stop_adapter(priv);		ipw2100_disable_interrupts(priv);		if (dev->irq)			free_irq(dev->irq, priv);		ipw2100_kill_workqueue(priv);		/* These are safe to call even if they weren't allocated */		ipw2100_queues_free(priv);		sysfs_remove_group(&pci_dev->dev.kobj, &ipw2100_attribute_group);		free_ieee80211(dev);		pci_set_drvdata(pci_dev, NULL);	}	if (base_addr)		iounmap((char*)base_addr);	pci_release_regions(pci_dev);	pci_disable_device(pci_dev);	return err;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/2be041a79bbdbb3c830f4cc3bc3387ba6fff7566/ipw2100.c/clean/drivers/net/wireless/ipw2100.c