# This is a BitKeeper generated patch for the following project: # Project Name: Linux kernel tree # This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas: # ChangeSet 1.1590 -> 1.1591 # drivers/scsi/tmscsim.c 1.27 -> 1.28 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 04/02/22 hch@bird.bsdonline.org 1.1591 # no queue fixups # -------------------------------------------- # diff -Nru a/drivers/scsi/tmscsim.c b/drivers/scsi/tmscsim.c --- a/drivers/scsi/tmscsim.c Sun Feb 22 19:08:47 2004 +++ b/drivers/scsi/tmscsim.c Sun Feb 22 19:08:47 2004 @@ -1117,9 +1117,6 @@ DC390_LOCK_ACB; - /* Assume BAD_TARGET; will be cleared later */ - cmd->result = DID_BAD_TARGET << 16; - /* TODO: Change the policy: Alway accept TEST_UNIT_READY or INQUIRY * commands and alloc a DCB for the device if not yet there. DCB will * be removed in dc390_SRBdone if SEL_TIMEOUT */ @@ -1130,17 +1127,6 @@ else if( (pACB->scan_devices) && (cmd->cmnd[0] == READ_6) ) pACB->scan_devices = 0; - if ( ( cmd->device->id >= pACB->pScsiHost->max_id ) || - (cmd->device->lun >= pACB->pScsiHost->max_lun) ) - { -/* printk ("DC390: Ignore target %d lun %d\n", - cmd->device->id, cmd->device->lun); */ - DC390_UNLOCK_ACB; - //return (1); - done (cmd); - return (0); - } - if( (pACB->scan_devices || cmd->cmnd[0] == TEST_UNIT_READY || cmd->cmnd[0] == INQUIRY) && !(pACB->DCBmap[cmd->device->id] & (1 << cmd->device->lun)) ) { @@ -1151,14 +1137,7 @@ { printk (KERN_ERR "DC390: kmalloc for DCB failed, target %02x lun %02x\n", cmd->device->id, cmd->device->lun); - DC390_UNLOCK_ACB; - printk ("DC390: No DCB in queue_command!\n"); -#ifdef USE_NEW_EH - return (1); -#else - done (cmd); - return (0); -#endif + goto fail; } } @@ -1166,10 +1145,7 @@ { printk(KERN_INFO "DC390: Ignore target %02x lun %02x\n", cmd->device->id, cmd->device->lun); - DC390_UNLOCK_ACB; - //return (1); - done (cmd); - return (0); + goto fail; } else { @@ -1178,52 +1154,37 @@ { /* should never happen */ printk (KERN_ERR "DC390: no DCB failed, target %02x lun %02x\n", cmd->device->id, cmd->device->lun); - DC390_UNLOCK_ACB; - printk ("DC390: No DCB in queuecommand (2)!\n"); -#ifdef USE_NEW_EH - return (1); -#else - done (cmd); - return (0); -#endif + goto fail; } } pACB->Cmds++; cmd->scsi_done = done; cmd->result = 0; - if (pDCB->pWaitingSRB) - { - pSRB = dc390_Free_get ( pACB ); - DEBUG0(if (!pSRB) printk ("DC390: No free SRB but Waiting\n"); else printk ("DC390: Free SRB w/ Waiting\n")); - if (!pSRB) - return 1; - else - { - dc390_BuildSRB (cmd, pDCB, pSRB); - dc390_Waiting_append (pDCB, pSRB); - } - dc390_Waiting_process (pACB); - } - else - { - pSRB = dc390_Free_get ( pACB ); - DEBUG0(if (!pSRB) printk ("DC390: No free SRB w/o Waiting\n"); else printk ("DC390: Free SRB w/o Waiting\n")); - if (!pSRB) - { - dc390_Waiting_process (pACB); - return 1; - } - else - { - dc390_BuildSRB (cmd, pDCB, pSRB); - dc390_SendSRB (pACB, pSRB); - } - } + + pSRB = dc390_Free_get(pACB); + if (!pSRB) + goto requeue; + + dc390_BuildSRB(cmd, pDCB, pSRB); + if (pDCB->pWaitingSRB) { + dc390_Waiting_append(pDCB, pSRB); + dc390_Waiting_process(pACB); + } else + dc390_SendSRB(pACB, pSRB); DC390_UNLOCK_ACB; DEBUG1(printk (KERN_DEBUG " ... command (pid %li) queued successfully.\n", cmd->pid)); return(0); + + requeue: + DC390_UNLOCK_ACB; + return 1; + fail: + DC390_UNLOCK_ACB; + cmd->result = DID_BAD_TARGET << 16; + done(cmd); + return 0; } /* We ignore mapping problems, as we expect everybody to respect