Merge by Hand
[cascardo/linux.git] / drivers / scsi / dpt_i2o.c
index 9cc0015..7235f94 100644 (file)
@@ -34,7 +34,6 @@
 
 #define ADDR32 (0)
 
-#include <linux/version.h>
 #include <linux/module.h>
 
 MODULE_AUTHOR("Deanna Bonds, with _lots_ of help from Mark Salyzyn");
@@ -383,7 +382,6 @@ static int adpt_queue(struct scsi_cmnd * cmd, void (*done) (struct scsi_cmnd *))
 {
        adpt_hba* pHba = NULL;
        struct adpt_device* pDev = NULL;        /* dpt per device information */
-       ulong timeout = jiffies + (TMOUT_SCSI*HZ);
 
        cmd->scsi_done = done;
        /*
@@ -419,11 +417,6 @@ static int adpt_queue(struct scsi_cmnd * cmd, void (*done) (struct scsi_cmnd *))
                return 1;
        }
 
-       if(cmd->eh_state != SCSI_STATE_QUEUED){
-               // If we are not doing error recovery
-               mod_timer(&cmd->eh_timeout, timeout);
-       }
-
        // TODO if the cmd->device if offline then I may need to issue a bus rescan
        // followed by a get_lct to see if the device is there anymore
        if((pDev = (struct adpt_device*) (cmd->device->hostdata)) == NULL) {
@@ -914,9 +907,13 @@ 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);
                PERROR("dpti: adpt_config_hba: io remap failed\n");
                return -EINVAL;
        }
@@ -926,6 +923,7 @@ static int adpt_install_hba(struct scsi_host_template* sht, struct pci_dev* pDev
                if (!msg_addr_virt) {
                        PERROR("dpti: adpt_config_hba: io remap failed on BAR1\n");
                        iounmap(base_addr_virt);
+                       pci_release_regions(pDev);
                        return -EINVAL;
                }
        } else {
@@ -939,6 +937,7 @@ static int adpt_install_hba(struct scsi_host_template* sht, struct pci_dev* pDev
                        iounmap(msg_addr_virt);
                }
                iounmap(base_addr_virt);
+               pci_release_regions(pDev);
                return -ENOMEM;
        }
        memset(pHba, 0, sizeof(adpt_hba));
@@ -1034,6 +1033,7 @@ static void adpt_i2o_delete_hba(adpt_hba* pHba)
        up(&adpt_configuration_lock);
 
        iounmap(pHba->base_addr_virt);
+       pci_release_regions(pHba->pDev);
        if(pHba->msg_addr_virt != pHba->base_addr_virt){
                iounmap(pHba->msg_addr_virt);
        }
@@ -1126,11 +1126,11 @@ static int adpt_i2o_post_wait(adpt_hba* pHba, u32* msg, int len, int timeout)
        struct adpt_i2o_post_wait_data *p1, *p2;
        struct adpt_i2o_post_wait_data *wait_data =
                kmalloc(sizeof(struct adpt_i2o_post_wait_data),GFP_KERNEL);
-       adpt_wait_queue_t wait;
+       DECLARE_WAITQUEUE(wait, current);
 
-       if(!wait_data){
+       if (!wait_data)
                return -ENOMEM;
-       }
+
        /*
         * The spin locking is needed to keep anyone from playing
         * with the queue pointers and id while we do the same
@@ -1148,12 +1148,7 @@ static int adpt_i2o_post_wait(adpt_hba* pHba, u32* msg, int len, int timeout)
        wait_data->wq = &adpt_wq_i2o_post;
        wait_data->status = -ETIMEDOUT;
 
-       // this code is taken from kernel/sched.c:interruptible_sleep_on_timeout
-       wait.task = current;
-       init_waitqueue_entry(&wait, current);
-       spin_lock_irqsave(&adpt_wq_i2o_post.lock, flags);
-       __add_wait_queue(&adpt_wq_i2o_post, &wait);
-       spin_unlock(&adpt_wq_i2o_post.lock);
+       add_wait_queue(&adpt_wq_i2o_post, &wait);
 
        msg[2] |= 0x80000000 | ((u32)wait_data->id);
        timeout *= HZ;
@@ -1175,9 +1170,7 @@ static int adpt_i2o_post_wait(adpt_hba* pHba, u32* msg, int len, int timeout)
                if(pHba->host)
                        spin_lock_irq(pHba->host->host_lock);
        }
-       spin_lock_irq(&adpt_wq_i2o_post.lock);
-       __remove_wait_queue(&adpt_wq_i2o_post, &wait);
-       spin_unlock_irqrestore(&adpt_wq_i2o_post.lock, flags);
+       remove_wait_queue(&adpt_wq_i2o_post, &wait);
 
        if(status == -ETIMEDOUT){
                printk(KERN_INFO"dpti%d: POST WAIT TIMEOUT\n",pHba->unit);
@@ -1818,9 +1811,9 @@ static int adpt_system_info(void __user *buffer)
        memset(&si, 0, sizeof(si));
 
        si.osType = OS_LINUX;
-       si.osMajorVersion = (u8) (LINUX_VERSION_CODE >> 16);
-       si.osMinorVersion = (u8) (LINUX_VERSION_CODE >> 8 & 0x0ff);
-       si.osRevision =     (u8) (LINUX_VERSION_CODE & 0x0ff);
+       si.osMajorVersion = 0;
+       si.osMinorVersion = 0;
+       si.osRevision = 0;
        si.busType = SI_PCI_BUS;
        si.processorFamily = DPTI_sig.dsProcessorFamily;