pci_release_regions(pDev); 
static int adpt_install_hba(struct scsi_host_template* sht, struct pci_dev* pDev) {	adpt_hba* pHba = NULL;	adpt_hba* p = NULL;	ulong base_addr0_phys = 0;	ulong base_addr1_phys = 0;	u32 hba_map0_area_size = 0;	u32 hba_map1_area_size = 0;	void __iomem *base_addr_virt = NULL;	void __iomem *msg_addr_virt = NULL;	int raptorFlag = FALSE;	if(pci_enable_device(pDev)) {		return -EINVAL;	}	pci_set_master(pDev);	if (pci_set_dma_mask(pDev, 0xffffffffffffffffULL) &&	    pci_set_dma_mask(pDev, 0xffffffffULL))		return -EINVAL;	base_addr0_phys = pci_resource_start(pDev,0);	hba_map0_area_size = pci_resource_len(pDev,0);	// Check if standard PCI card or single BAR Raptor	if(pDev->device == PCI_DPT_DEVICE_ID){		if(pDev->subsystem_device >=0xc032 && pDev->subsystem_device <= 0xc03b){			// Raptor card with this device id needs 4M			hba_map0_area_size = 0x400000;		} else { // Not Raptor - it is a PCI card			if(hba_map0_area_size > 0x100000 ){ 				hba_map0_area_size = 0x100000;			}		}	} else {// Raptor split BAR config		// Use BAR1 in this configuration		base_addr1_phys = pci_resource_start(pDev,1);		hba_map1_area_size = pci_resource_len(pDev,1);		raptorFlag = TRUE;	}	base_addr_virt = ioremap(base_addr0_phys,hba_map0_area_size);	if (!base_addr_virt) {		PERROR("dpti: adpt_config_hba: io remap failed\n");		return -EINVAL;	}        if(raptorFlag == TRUE) {		msg_addr_virt = ioremap(base_addr1_phys, hba_map1_area_size );		if (!msg_addr_virt) {			PERROR("dpti: adpt_config_hba: io remap failed on BAR1\n");			iounmap(base_addr_virt);			return -EINVAL;		}	} else {		msg_addr_virt = base_addr_virt;	}		// Allocate and zero the data structure	pHba = kmalloc(sizeof(adpt_hba), GFP_KERNEL);	if( pHba == NULL) {		if(msg_addr_virt != base_addr_virt){			iounmap(msg_addr_virt);		}		iounmap(base_addr_virt);		return -ENOMEM;	}	memset(pHba, 0, sizeof(adpt_hba));	down(&adpt_configuration_lock);	if(hba_chain != NULL){		for(p = hba_chain; p->next; p = p->next);		p->next = pHba;	} else {		hba_chain = pHba;	}	pHba->next = NULL;	pHba->unit = hba_count;	sprintf(pHba->name, "dpti%d", hba_count);	hba_count++;		up(&adpt_configuration_lock);	pHba->pDev = pDev;	pHba->base_addr_phys = base_addr0_phys;	// Set up the Virtual Base Address of the I2O Device	pHba->base_addr_virt = base_addr_virt;	pHba->msg_addr_virt = msg_addr_virt;	pHba->irq_mask = base_addr_virt+0x30;	pHba->post_port = base_addr_virt+0x40;	pHba->reply_port = base_addr_virt+0x44;	pHba->hrt = NULL;	pHba->lct = NULL;	pHba->lct_size = 0;	pHba->status_block = NULL;	pHba->post_count = 0;	pHba->state = DPTI_STATE_RESET;	pHba->pDev = pDev;	pHba->devices = NULL;	// Initializing the spinlocks	spin_lock_init(&pHba->state_lock);	spin_lock_init(&adpt_post_wait_lock);	if(raptorFlag == 0){		printk(KERN_INFO"Adaptec I2O RAID controller %d at %p size=%x irq=%d\n", 			hba_count-1, base_addr_virt, hba_map0_area_size, pDev->irq);	} else {		printk(KERN_INFO"Adaptec I2O RAID controller %d irq=%d\n",hba_count-1, pDev->irq);		printk(KERN_INFO"     BAR0 %p - size= %x\n",base_addr_virt,hba_map0_area_size);		printk(KERN_INFO"     BAR1 %p - size= %x\n",msg_addr_virt,hba_map1_area_size);	}	if (request_irq (pDev->irq, adpt_isr, SA_SHIRQ, pHba->name, pHba)) {		printk(KERN_ERR"%s: Couldn't register IRQ %d\n", pHba->name, pDev->irq);		adpt_i2o_delete_hba(pHba);		return -EINVAL;	}	return 0;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/9c472dd9197429a37691e91c938660a062bf20b0/dpt_i2o.c/clean/drivers/scsi/dpt_i2o.c