]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/scsi/megaraid.c
[PATCH] sk98lin: avoid message confusion with skge
[linux-2.6-omap-h63xx.git] / drivers / scsi / megaraid.c
index 61a6fd810bb4bedfb24a13b57265e7af87a56966..f9792528e33fb473d7e03314d5318b4aa0863ef9 100644 (file)
@@ -362,6 +362,7 @@ megaraid_queue(Scsi_Cmnd *scmd, void (*done)(Scsi_Cmnd *))
        adapter_t       *adapter;
        scb_t   *scb;
        int     busy=0;
+       unsigned long flags;
 
        adapter = (adapter_t *)scmd->device->host->hostdata;
 
@@ -377,23 +378,25 @@ megaraid_queue(Scsi_Cmnd *scmd, void (*done)(Scsi_Cmnd *))
         * return 0 in that case.
         */
 
+       spin_lock_irqsave(&adapter->lock, flags);
        scb = mega_build_cmd(adapter, scmd, &busy);
+       if (!scb)
+               goto out;
 
-       if(scb) {
-               scb->state |= SCB_PENDQ;
-               list_add_tail(&scb->list, &adapter->pending_list);
+       scb->state |= SCB_PENDQ;
+       list_add_tail(&scb->list, &adapter->pending_list);
 
-               /*
-                * Check if the HBA is in quiescent state, e.g., during a
-                * delete logical drive opertion. If it is, don't run
-                * the pending_list.
-                */
-               if(atomic_read(&adapter->quiescent) == 0) {
-                       mega_runpendq(adapter);
-               }
-               return 0;
-       }
+       /*
+        * Check if the HBA is in quiescent state, e.g., during a
+        * delete logical drive opertion. If it is, don't run
+        * the pending_list.
+        */
+       if (atomic_read(&adapter->quiescent) == 0)
+               mega_runpendq(adapter);
 
+       busy = 0;
+ out:
+       spin_unlock_irqrestore(&adapter->lock, flags);
        return busy;
 }
 
@@ -1683,7 +1686,7 @@ mega_rundoneq (adapter_t *adapter)
 
        list_for_each(pos, &adapter->completed_list) {
 
-               Scsi_Pointer* spos = (Scsi_Pointer *)pos;
+               struct scsi_pointer* spos = (struct scsi_pointer *)pos;
 
                cmd = list_entry(spos, Scsi_Cmnd, SCp);
                cmd->scsi_done(cmd);
@@ -1981,7 +1984,7 @@ megaraid_reset(struct scsi_cmnd *cmd)
        mc.cmd = MEGA_CLUSTER_CMD;
        mc.opcode = MEGA_RESET_RESERVATIONS;
 
-       if( mega_internal_command(adapter, LOCK_INT, &mc, NULL) != 0 ) {
+       if( mega_internal_command(adapter, &mc, NULL) != 0 ) {
                printk(KERN_WARNING
                                "megaraid: reservation reset failed.\n");
        }
@@ -3011,7 +3014,7 @@ proc_rdrv(adapter_t *adapter, char *page, int start, int end )
                mc.cmd = FC_NEW_CONFIG;
                mc.opcode = OP_DCMD_READ_CONFIG;
 
-               if( mega_internal_command(adapter, LOCK_INT, &mc, NULL) ) {
+               if( mega_internal_command(adapter, &mc, NULL) ) {
 
                        len = sprintf(page, "40LD read config failed.\n");
 
@@ -3029,11 +3032,11 @@ proc_rdrv(adapter_t *adapter, char *page, int start, int end )
        else {
                mc.cmd = NEW_READ_CONFIG_8LD;
 
-               if( mega_internal_command(adapter, LOCK_INT, &mc, NULL) ) {
+               if( mega_internal_command(adapter, &mc, NULL) ) {
 
                        mc.cmd = READ_CONFIG_8LD;
 
-                       if( mega_internal_command(adapter, LOCK_INT, &mc,
+                       if( mega_internal_command(adapter, &mc,
                                                NULL) ){
 
                                len = sprintf(page,
@@ -3632,7 +3635,7 @@ megadev_ioctl(struct inode *inode, struct file *filep, unsigned int cmd,
                        /*
                         * Issue the command
                         */
-                       mega_internal_command(adapter, LOCK_INT, &mc, pthru);
+                       mega_internal_command(adapter, &mc, pthru);
 
                        rval = mega_n_to_m((void __user *)arg, &mc);
 
@@ -3715,7 +3718,7 @@ freemem_and_return:
                        /*
                         * Issue the command
                         */
-                       mega_internal_command(adapter, LOCK_INT, &mc, NULL);
+                       mega_internal_command(adapter, &mc, NULL);
 
                        rval = mega_n_to_m((void __user *)arg, &mc);
 
@@ -4234,7 +4237,7 @@ mega_do_del_logdrv(adapter_t *adapter, int logdrv)
        mc.opcode = OP_DEL_LOGDRV;
        mc.subopcode = logdrv;
 
-       rval = mega_internal_command(adapter, LOCK_INT, &mc, NULL);
+       rval = mega_internal_command(adapter, &mc, NULL);
 
        /* log this event */
        if(rval) {
@@ -4367,7 +4370,7 @@ mega_adapinq(adapter_t *adapter, dma_addr_t dma_handle)
 
        mc.xferaddr = (u32)dma_handle;
 
-       if ( mega_internal_command(adapter, LOCK_INT, &mc, NULL) != 0 ) {
+       if ( mega_internal_command(adapter, &mc, NULL) != 0 ) {
                return -1;
        }
 
@@ -4435,7 +4438,7 @@ mega_internal_dev_inquiry(adapter_t *adapter, u8 ch, u8 tgt,
        mc.cmd = MEGA_MBOXCMD_PASSTHRU;
        mc.xferaddr = (u32)pthru_dma_handle;
 
-       rval = mega_internal_command(adapter, LOCK_INT, &mc, pthru);
+       rval = mega_internal_command(adapter, &mc, pthru);
 
        pci_free_consistent(pdev, sizeof(mega_passthru), pthru,
                        pthru_dma_handle);
@@ -4449,7 +4452,6 @@ mega_internal_dev_inquiry(adapter_t *adapter, u8 ch, u8 tgt,
 /**
  * mega_internal_command()
  * @adapter - pointer to our soft state
- * @ls - the scope of the exclusion lock.
  * @mc - the mailbox command
  * @pthru - Passthru structure for DCDB commands
  *
@@ -4463,8 +4465,7 @@ mega_internal_dev_inquiry(adapter_t *adapter, u8 ch, u8 tgt,
  * Note: parameter 'pthru' is null for non-passthru commands.
  */
 static int
-mega_internal_command(adapter_t *adapter, lockscope_t ls, megacmd_t *mc,
-               mega_passthru *pthru )
+mega_internal_command(adapter_t *adapter, megacmd_t *mc, mega_passthru *pthru)
 {
        Scsi_Cmnd       *scmd;
        struct  scsi_device *sdev;
@@ -4508,15 +4509,8 @@ mega_internal_command(adapter_t *adapter, lockscope_t ls, megacmd_t *mc,
 
        scb->idx = CMDID_INT_CMDS;
 
-       /*
-        * Get the lock only if the caller has not acquired it already
-        */
-       if( ls == LOCK_INT ) spin_lock_irqsave(&adapter->lock, flags);
-
        megaraid_queue(scmd, mega_internal_done);
 
-       if( ls == LOCK_INT ) spin_unlock_irqrestore(&adapter->lock, flags);
-
        wait_for_completion(&adapter->int_waitq);
 
        rval = scmd->result;
@@ -4683,7 +4677,6 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
 
        adapter->flag = flag;
        spin_lock_init(&adapter->lock);
-       scsi_assign_lock(host, &adapter->lock);
 
        host->cmd_per_lun = max_cmd_per_lun;
        host->max_sectors = max_sectors_per_io;