]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/scsi/tmscsim.c
backlight/leds: Make two structs static
[linux-2.6-omap-h63xx.git] / drivers / scsi / tmscsim.c
index 73c5ca082e6514993a6d65267c2286d34ff95930..5db1520f8ba968a48a9bcc783d2e100cc5d0c98f 100644 (file)
@@ -1564,7 +1564,8 @@ dc390_Disconnect( struct dc390_acb* pACB )
        if( (pSRB->SRBState & (SRB_START_+SRB_MSGOUT)) ||
           !(pSRB->SRBState & (SRB_DISCONNECT+SRB_COMPLETED)) )
        {       /* Selection time out */
-               pSRB->TargetStatus = SCSI_STAT_SEL_TIMEOUT;
+               pSRB->AdaptStatus = H_SEL_TIMEOUT;
+               pSRB->TargetStatus = 0;
                goto  disc1;
        }
        else if (!(pSRB->SRBState & SRB_DISCONNECT) && (pSRB->SRBState & SRB_COMPLETED))
@@ -1680,7 +1681,6 @@ dc390_RequestSense(struct dc390_acb* pACB, struct dc390_dcb* pDCB, struct dc390_
                              pcmd->cmnd[0], pDCB->TargetID, pDCB->TargetLUN));
 
        pSRB->SRBFlag |= AUTO_REQSENSE;
-       pSRB->SavedSGCount = scsi_sg_count(pcmd);
        pSRB->SavedTotXLen = pSRB->TotalXferredLen;
        pSRB->AdaptStatus = 0;
        pSRB->TargetStatus = 0; /* CHECK_CONDITION<<1; */
@@ -1713,22 +1713,21 @@ dc390_SRBdone( struct dc390_acb* pACB, struct dc390_dcb* pDCB, struct dc390_srb*
     {  /* Last command was a Request Sense */
        pSRB->SRBFlag &= ~AUTO_REQSENSE;
        pSRB->AdaptStatus = 0;
-       pSRB->TargetStatus = CHECK_CONDITION << 1;
+       pSRB->TargetStatus = SAM_STAT_CHECK_CONDITION;
 
        //pcmd->result = MK_RES(DRIVER_SENSE,DID_OK,0,status);
-       if (status == (CHECK_CONDITION << 1))
+       if (status == SAM_STAT_CHECK_CONDITION)
            pcmd->result = MK_RES_LNX(0, DID_BAD_TARGET, 0, /*CHECK_CONDITION*/0);
        else /* Retry */
        {
            if( pSRB->pcmd->cmnd[0] == TEST_UNIT_READY /* || pSRB->pcmd->cmnd[0] == START_STOP */)
            {
                /* Don't retry on TEST_UNIT_READY */
-               pcmd->result = MK_RES_LNX(DRIVER_SENSE,DID_OK,0,CHECK_CONDITION);
+               pcmd->result = MK_RES_LNX(DRIVER_SENSE, DID_OK, 0, SAM_STAT_CHECK_CONDITION);
                REMOVABLEDEBUG(printk(KERN_INFO "Cmd=%02x, Result=%08x, XferL=%08x\n",pSRB->pcmd->cmnd[0],\
                       (u32) pcmd->result, (u32) pSRB->TotalXferredLen));
            } else {
                SET_RES_DRV(pcmd->result, DRIVER_SENSE);
-               scsi_sg_count(pcmd) = pSRB->SavedSGCount;
                //pSRB->ScsiCmdLen       = (u8) (pSRB->Segment1[0] >> 8);
                DEBUG0 (printk ("DC390: RETRY pid %li (%02x), target %02i-%02i\n", pcmd->pid, pcmd->cmnd[0], pcmd->device->id, pcmd->device->lun));
                pSRB->TotalXferredLen = 0;
@@ -1739,7 +1738,7 @@ dc390_SRBdone( struct dc390_acb* pACB, struct dc390_dcb* pDCB, struct dc390_srb*
     }
     if( status )
     {
-       if( status_byte(status) == CHECK_CONDITION )
+       if (status == SAM_STAT_CHECK_CONDITION)
        {
            if (dc390_RequestSense(pACB, pDCB, pSRB)) {
                SET_RES_DID(pcmd->result, DID_ERROR);
@@ -1747,22 +1746,14 @@ dc390_SRBdone( struct dc390_acb* pACB, struct dc390_dcb* pDCB, struct dc390_srb*
            }
            return;
        }
-       else if( status_byte(status) == QUEUE_FULL )
+       else if (status == SAM_STAT_TASK_SET_FULL)
        {
            scsi_track_queue_full(pcmd->device, pDCB->GoingSRBCnt - 1);
-           scsi_sg_count(pcmd) = pSRB->SavedSGCount;
            DEBUG0 (printk ("DC390: RETRY pid %li (%02x), target %02i-%02i\n", pcmd->pid, pcmd->cmnd[0], pcmd->device->id, pcmd->device->lun));
            pSRB->TotalXferredLen = 0;
            SET_RES_DID(pcmd->result, DID_SOFT_ERROR);
        }
-       else if(status == SCSI_STAT_SEL_TIMEOUT)
-       {
-           pSRB->AdaptStatus = H_SEL_TIMEOUT;
-           pSRB->TargetStatus = 0;
-           pcmd->result = MK_RES(0,DID_NO_CONNECT,0,0);
-           /* Devices are removed below ... */
-       }
-       else if (status_byte(status) == BUSY && 
+       else if (status == SAM_STAT_BUSY &&
                 (pcmd->cmnd[0] == TEST_UNIT_READY || pcmd->cmnd[0] == INQUIRY) &&
                 pACB->scan_devices)
        {
@@ -1780,12 +1771,17 @@ dc390_SRBdone( struct dc390_acb* pACB, struct dc390_dcb* pDCB, struct dc390_srb*
     else
     {  /*  Target status == 0 */
        status = pSRB->AdaptStatus;
-       if(status & H_OVER_UNDER_RUN)
+       if (status == H_OVER_UNDER_RUN)
        {
            pSRB->TargetStatus = 0;
            SET_RES_DID(pcmd->result,DID_OK);
            SET_RES_MSG(pcmd->result,pSRB->EndMessage);
        }
+       else if (status == H_SEL_TIMEOUT)
+       {
+           pcmd->result = MK_RES(0, DID_NO_CONNECT, 0, 0);
+           /* Devices are removed below ... */
+       }
        else if( pSRB->SRBStatus & PARITY_ERROR)
        {
            //pcmd->result = MK_RES(0,DID_PARITY,pSRB->EndMessage,0);
@@ -2086,10 +2082,9 @@ static int dc390_slave_alloc(struct scsi_device *scsi_device)
        uint id = scsi_device->id;
        uint lun = scsi_device->lun;
 
-       pDCB = kmalloc(sizeof(struct dc390_dcb), GFP_KERNEL);
+       pDCB = kzalloc(sizeof(struct dc390_dcb), GFP_KERNEL);
        if (!pDCB)
                return -ENOMEM;
-       memset(pDCB, 0, sizeof(struct dc390_dcb));
 
        if (!pACB->DCBCnt++) {
                pACB->pLinkDCB = pDCB;