fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / drivers / scsi / dpt_i2o.c
index 6e6b293..365db53 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) {
@@ -294,7 +297,7 @@ static void adpt_inquiry(adpt_hba* pHba)
        s32 rcode;
 
        memset(msg, 0, sizeof(msg));
-       buf = (u8*)kmalloc(80,GFP_KERNEL|ADDR32);
+       buf = kmalloc(80,GFP_KERNEL|ADDR32);
        if(!buf){
                printk(KERN_ERR"%s: Could not allocate buffer\n",pHba->name);
                return;
@@ -906,8 +909,8 @@ static int adpt_install_hba(struct scsi_host_template* sht, struct pci_dev* pDev
        }
 
        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);
@@ -1008,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;
@@ -1075,6 +1078,7 @@ static void adpt_i2o_delete_hba(adpt_hba* pHba)
                        }
                }
        }
+       pci_dev_put(pHba->pDev);
        kfree(pHba);
 
        if(hba_count <= 0){
@@ -1307,7 +1311,7 @@ static s32 adpt_i2o_reset_hba(adpt_hba* pHba)
                schedule_timeout_uninterruptible(1);
        } while (m == EMPTY_QUEUE);
 
-       status = (u8*)kmalloc(4, GFP_KERNEL|ADDR32);
+       status = kmalloc(4, GFP_KERNEL|ADDR32);
        if(status == NULL) {
                adpt_send_nop(pHba, m);
                printk(KERN_ERR"IOP reset failed - no free memory.\n");
@@ -1440,7 +1444,7 @@ static int adpt_i2o_parse_lct(adpt_hba* pHba)
                        }
                        continue;
                }
-               d = (struct i2o_device *)kmalloc(sizeof(struct i2o_device), GFP_KERNEL);
+               d = kmalloc(sizeof(struct i2o_device), GFP_KERNEL);
                if(d==NULL)
                {
                        printk(KERN_CRIT"%s: Out of memory for I2O device data.\n",pHba->name);
@@ -1985,7 +1989,7 @@ static int adpt_ioctl(struct inode *inode, struct file *file, uint cmd,
 }
 
 
-static irqreturn_t adpt_isr(int irq, void *dev_id, struct pt_regs *regs)
+static irqreturn_t adpt_isr(int irq, void *dev_id)
 {
        struct scsi_cmnd* cmd;
        adpt_hba* pHba = dev_id;
@@ -2208,7 +2212,7 @@ static s32 adpt_scsi_register(adpt_hba* pHba,struct scsi_host_template * sht)
         */
        host->io_port = 0;
        host->n_io_port = 0;
-                               /* see comments in hosts.h */
+                               /* see comments in scsi_host.h */
        host->max_id = 16;
        host->max_lun = 256;
        host->max_channel = pHba->top_scsi_channel + 1;
@@ -2421,7 +2425,7 @@ static s32 adpt_i2o_reparse_lct(adpt_hba* pHba)
                                pDev = pDev->next_lun;
                        }
                        if(!pDev ) { // Something new add it
-                               d = (struct i2o_device *)kmalloc(sizeof(struct i2o_device), GFP_KERNEL);
+                               d = kmalloc(sizeof(struct i2o_device), GFP_KERNEL);
                                if(d==NULL)
                                {
                                        printk(KERN_CRIT "Out of memory for I2O device data.\n");
@@ -2724,7 +2728,7 @@ static s32 adpt_i2o_init_outbound_q(adpt_hba* pHba)
 
        kfree(pHba->reply_pool);
 
-       pHba->reply_pool = (u32*)kmalloc(pHba->reply_fifo_size * REPLY_FRAME_SIZE * 4, GFP_KERNEL|ADDR32);
+       pHba->reply_pool = kmalloc(pHba->reply_fifo_size * REPLY_FRAME_SIZE * 4, GFP_KERNEL|ADDR32);
        if(!pHba->reply_pool){
                printk(KERN_ERR"%s: Could not allocate reply pool\n",pHba->name);
                return -1;