Merge master.kernel.org:/pub/scm/linux/kernel/git/acme/net-2.6
[pandora-kernel.git] / drivers / scsi / dpt_i2o.c
index cdeb30b..7b3bd34 100644 (file)
@@ -46,7 +46,6 @@ MODULE_DESCRIPTION("Adaptec I2O RAID Driver");
 
 #include <linux/stat.h>
 #include <linux/slab.h>                /* for kmalloc() */
-#include <linux/config.h>      /* for CONFIG_PCI */
 #include <linux/pci.h>         /* for PCI support */
 #include <linux/proc_fs.h>
 #include <linux/blkdev.h>
@@ -57,6 +56,7 @@ MODULE_DESCRIPTION("Adaptec I2O RAID Driver");
 #include <linux/reboot.h>
 #include <linux/spinlock.h>
 #include <linux/smp_lock.h>
+#include <linux/dma-mapping.h>
 
 #include <linux/timer.h>
 #include <linux/string.h>
@@ -184,7 +184,7 @@ static int adpt_detect(struct scsi_host_template* sht)
        PINFO("Detecting Adaptec I2O RAID controllers...\n");
 
         /* search for all Adatpec I2O RAID cards */
-       while ((pDev = pci_find_device( PCI_DPT_VENDOR_ID, PCI_ANY_ID, pDev))) {
+       while ((pDev = pci_get_device( PCI_DPT_VENDOR_ID, PCI_ANY_ID, pDev))) {
                if(pDev->device == PCI_DPT_DEVICE_ID ||
                   pDev->device == PCI_DPT_RAPTOR_DEVICE_ID){
                        if(adpt_install_hba(sht, pDev) ){
@@ -192,8 +192,11 @@ static int adpt_detect(struct scsi_host_template* sht)
                                PERROR("Will not try to detect others.\n");
                                return hba_count-1;
                        }
+                       pci_dev_get(pDev);
                }
        }
+       if (pDev)
+               pci_dev_put(pDev);
 
        /* In INIT state, Activate IOPs */
        for (pHba = hba_chain; pHba; pHba = pHba->next) {
@@ -899,9 +902,15 @@ static int adpt_install_hba(struct scsi_host_template* sht, struct pci_dev* pDev
        if(pci_enable_device(pDev)) {
                return -EINVAL;
        }
+
+       if (pci_request_regions(pDev, "dpt_i2o")) {
+               PERROR("dpti: adpt_config_hba: pci request region failed\n");
+               return -EINVAL;
+       }
+
        pci_set_master(pDev);
-       if (pci_set_dma_mask(pDev, 0xffffffffffffffffULL) &&
-           pci_set_dma_mask(pDev, 0xffffffffULL))
+       if (pci_set_dma_mask(pDev, DMA_64BIT_MASK) &&
+           pci_set_dma_mask(pDev, DMA_32BIT_MASK))
                return -EINVAL;
 
        base_addr0_phys = pci_resource_start(pDev,0);
@@ -924,10 +933,6 @@ static int adpt_install_hba(struct scsi_host_template* sht, struct pci_dev* pDev
                raptorFlag = TRUE;
        }
 
-       if (pci_request_regions(pDev, "dpt_i2o")) {
-               PERROR("dpti: adpt_config_hba: pci request region failed\n");
-               return -EINVAL;
-       }
        base_addr_virt = ioremap(base_addr0_phys,hba_map0_area_size);
        if (!base_addr_virt) {
                pci_release_regions(pDev);
@@ -1006,7 +1011,7 @@ static int adpt_install_hba(struct scsi_host_template* sht, struct pci_dev* pDev
                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)) {
+       if (request_irq (pDev->irq, adpt_isr, IRQF_SHARED, pHba->name, pHba)) {
                printk(KERN_ERR"%s: Couldn't register IRQ %d\n", pHba->name, pDev->irq);
                adpt_i2o_delete_hba(pHba);
                return -EINVAL;
@@ -1073,6 +1078,7 @@ static void adpt_i2o_delete_hba(adpt_hba* pHba)
                        }
                }
        }
+       pci_dev_put(pHba->pDev);
        kfree(pHba);
 
        if(hba_count <= 0){