Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b80ca4f7 authored by FUJITA Tomonori's avatar FUJITA Tomonori Committed by James Bottomley
Browse files

[SCSI] replace sizeof sense_buffer with SCSI_SENSE_BUFFERSIZE



This replaces sizeof sense_buffer with SCSI_SENSE_BUFFERSIZE in
several LLDs. It's a preparation for the future changes to remove
sense_buffer array in scsi_cmnd structure.

Signed-off-by: default avatarFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
parent 94aa5e5f
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -111,7 +111,7 @@ int mptscsih_suspend(struct pci_dev *pdev, pm_message_t state);
int 		mptscsih_resume(struct pci_dev *pdev);
int 		mptscsih_resume(struct pci_dev *pdev);
#endif
#endif


#define SNS_LEN(scp)	sizeof((scp)->sense_buffer)
#define SNS_LEN(scp)	SCSI_SENSE_BUFFERSIZE


/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
/**
/**
+1 −1
Original line number Original line Diff line number Diff line
@@ -370,7 +370,7 @@ static int i2o_scsi_reply(struct i2o_controller *c, u32 m,
	 */
	 */
	if (cmd->result)
	if (cmd->result)
		memcpy(cmd->sense_buffer, &msg->body[3],
		memcpy(cmd->sense_buffer, &msg->body[3],
		       min(sizeof(cmd->sense_buffer), (size_t) 40));
		       min(SCSI_SENSE_BUFFERSIZE, 40));


	/* only output error code if AdapterStatus is not HBA_SUCCESS */
	/* only output error code if AdapterStatus is not HBA_SUCCESS */
	if ((error >> 8) & 0xff)
	if ((error >> 8) & 0xff)
+6 −5
Original line number Original line Diff line number Diff line
@@ -608,7 +608,8 @@ NCR_700_scsi_done(struct NCR_700_Host_Parameters *hostdata,
			scsi_print_sense("53c700", SCp);
			scsi_print_sense("53c700", SCp);


#endif
#endif
			dma_unmap_single(hostdata->dev, slot->dma_handle, sizeof(SCp->sense_buffer), DMA_FROM_DEVICE);
			dma_unmap_single(hostdata->dev, slot->dma_handle,
					 SCSI_SENSE_BUFFERSIZE, DMA_FROM_DEVICE);
			/* restore the old result if the request sense was
			/* restore the old result if the request sense was
			 * successful */
			 * successful */
			if (result == 0)
			if (result == 0)
@@ -1010,7 +1011,7 @@ process_script_interrupt(__u32 dsps, __u32 dsp, struct scsi_cmnd *SCp,
				cmnd[1] = (SCp->device->lun & 0x7) << 5;
				cmnd[1] = (SCp->device->lun & 0x7) << 5;
				cmnd[2] = 0;
				cmnd[2] = 0;
				cmnd[3] = 0;
				cmnd[3] = 0;
				cmnd[4] = sizeof(SCp->sense_buffer);
				cmnd[4] = SCSI_SENSE_BUFFERSIZE;
				cmnd[5] = 0;
				cmnd[5] = 0;
				/* Here's a quiet hack: the
				/* Here's a quiet hack: the
				 * REQUEST_SENSE command is six bytes,
				 * REQUEST_SENSE command is six bytes,
@@ -1024,14 +1025,14 @@ process_script_interrupt(__u32 dsps, __u32 dsp, struct scsi_cmnd *SCp,
				SCp->cmd_len = 6; /* command length for
				SCp->cmd_len = 6; /* command length for
						   * REQUEST_SENSE */
						   * REQUEST_SENSE */
				slot->pCmd = dma_map_single(hostdata->dev, cmnd, MAX_COMMAND_SIZE, DMA_TO_DEVICE);
				slot->pCmd = dma_map_single(hostdata->dev, cmnd, MAX_COMMAND_SIZE, DMA_TO_DEVICE);
				slot->dma_handle = dma_map_single(hostdata->dev, SCp->sense_buffer, sizeof(SCp->sense_buffer), DMA_FROM_DEVICE);
				slot->dma_handle = dma_map_single(hostdata->dev, SCp->sense_buffer, SCSI_SENSE_BUFFERSIZE, DMA_FROM_DEVICE);
				slot->SG[0].ins = bS_to_host(SCRIPT_MOVE_DATA_IN | sizeof(SCp->sense_buffer));
				slot->SG[0].ins = bS_to_host(SCRIPT_MOVE_DATA_IN | SCSI_SENSE_BUFFERSIZE);
				slot->SG[0].pAddr = bS_to_host(slot->dma_handle);
				slot->SG[0].pAddr = bS_to_host(slot->dma_handle);
				slot->SG[1].ins = bS_to_host(SCRIPT_RETURN);
				slot->SG[1].ins = bS_to_host(SCRIPT_RETURN);
				slot->SG[1].pAddr = 0;
				slot->SG[1].pAddr = 0;
				slot->resume_offset = hostdata->pScript;
				slot->resume_offset = hostdata->pScript;
				dma_cache_sync(hostdata->dev, slot->SG, sizeof(slot->SG[0])*2, DMA_TO_DEVICE);
				dma_cache_sync(hostdata->dev, slot->SG, sizeof(slot->SG[0])*2, DMA_TO_DEVICE);
				dma_cache_sync(hostdata->dev, SCp->sense_buffer, sizeof(SCp->sense_buffer), DMA_FROM_DEVICE);
				dma_cache_sync(hostdata->dev, SCp->sense_buffer, SCSI_SENSE_BUFFERSIZE, DMA_FROM_DEVICE);


				/* queue the command for reissue */
				/* queue the command for reissue */
				slot->state = NCR_700_SLOT_QUEUED;
				slot->state = NCR_700_SLOT_QUEUED;
+1 −1
Original line number Original line Diff line number Diff line
@@ -2947,7 +2947,7 @@ static int BusLogic_QueueCommand(struct scsi_cmnd *Command, void (*CompletionRou
		}
		}
	}
	}
	memcpy(CCB->CDB, CDB, CDB_Length);
	memcpy(CCB->CDB, CDB, CDB_Length);
	CCB->SenseDataLength = sizeof(Command->sense_buffer);
	CCB->SenseDataLength = SCSI_SENSE_BUFFERSIZE;
	CCB->SenseDataPointer = pci_map_single(HostAdapter->PCI_Device, Command->sense_buffer, CCB->SenseDataLength, PCI_DMA_FROMDEVICE);
	CCB->SenseDataPointer = pci_map_single(HostAdapter->PCI_Device, Command->sense_buffer, CCB->SenseDataLength, PCI_DMA_FROMDEVICE);
	CCB->Command = Command;
	CCB->Command = Command;
	Command->scsi_done = CompletionRoutine;
	Command->scsi_done = CompletionRoutine;
+16 −16
Original line number Original line Diff line number Diff line
@@ -912,8 +912,8 @@ static int aac_bounds_32(struct aac_dev * dev, struct scsi_cmnd * cmd, u64 lba)
			    ASENCODE_INTERNAL_TARGET_FAILURE, 0, 0,
			    ASENCODE_INTERNAL_TARGET_FAILURE, 0, 0,
			    0, 0);
			    0, 0);
		memcpy(cmd->sense_buffer, &dev->fsa_dev[cid].sense_data,
		memcpy(cmd->sense_buffer, &dev->fsa_dev[cid].sense_data,
		  (sizeof(dev->fsa_dev[cid].sense_data) > sizeof(cmd->sense_buffer))
		  (sizeof(dev->fsa_dev[cid].sense_data) > SCSI_SENSE_BUFFERSIZE)
		    ? sizeof(cmd->sense_buffer)
		    ? SCSI_SENSE_BUFFERSIZE
		    : sizeof(dev->fsa_dev[cid].sense_data));
		    : sizeof(dev->fsa_dev[cid].sense_data));
		cmd->scsi_done(cmd);
		cmd->scsi_done(cmd);
		return 1;
		return 1;
@@ -1525,8 +1525,8 @@ static void io_callback(void *context, struct fib * fibptr)
				    ASENCODE_INTERNAL_TARGET_FAILURE, 0, 0,
				    ASENCODE_INTERNAL_TARGET_FAILURE, 0, 0,
				    0, 0);
				    0, 0);
		memcpy(scsicmd->sense_buffer, &dev->fsa_dev[cid].sense_data,
		memcpy(scsicmd->sense_buffer, &dev->fsa_dev[cid].sense_data,
		  (sizeof(dev->fsa_dev[cid].sense_data) > sizeof(scsicmd->sense_buffer))
		  (sizeof(dev->fsa_dev[cid].sense_data) > SCSI_SENSE_BUFFERSIZE)
		    ? sizeof(scsicmd->sense_buffer)
		    ? SCSI_SENSE_BUFFERSIZE
		    : sizeof(dev->fsa_dev[cid].sense_data));
		    : sizeof(dev->fsa_dev[cid].sense_data));
	}
	}
	aac_fib_complete(fibptr);
	aac_fib_complete(fibptr);
@@ -1739,8 +1739,8 @@ static void synchronize_callback(void *context, struct fib *fibptr)
				    ASENCODE_INTERNAL_TARGET_FAILURE, 0, 0,
				    ASENCODE_INTERNAL_TARGET_FAILURE, 0, 0,
				    0, 0);
				    0, 0);
		memcpy(cmd->sense_buffer, &dev->fsa_dev[cid].sense_data,
		memcpy(cmd->sense_buffer, &dev->fsa_dev[cid].sense_data,
		  min(sizeof(dev->fsa_dev[cid].sense_data),
		       min_t(size_t, sizeof(dev->fsa_dev[cid].sense_data),
			  sizeof(cmd->sense_buffer)));
			     SCSI_SENSE_BUFFERSIZE));
	}
	}


	aac_fib_complete(fibptr);
	aac_fib_complete(fibptr);
@@ -1949,8 +1949,8 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
			    SENCODE_INVALID_COMMAND,
			    SENCODE_INVALID_COMMAND,
			    ASENCODE_INVALID_COMMAND, 0, 0, 0, 0);
			    ASENCODE_INVALID_COMMAND, 0, 0, 0, 0);
		memcpy(scsicmd->sense_buffer, &dev->fsa_dev[cid].sense_data,
		memcpy(scsicmd->sense_buffer, &dev->fsa_dev[cid].sense_data,
		  (sizeof(dev->fsa_dev[cid].sense_data) > sizeof(scsicmd->sense_buffer))
		  (sizeof(dev->fsa_dev[cid].sense_data) > SCSI_SENSE_BUFFERSIZE)
		    ? sizeof(scsicmd->sense_buffer)
		    ? SCSI_SENSE_BUFFERSIZE
		    : sizeof(dev->fsa_dev[cid].sense_data));
		    : sizeof(dev->fsa_dev[cid].sense_data));
		scsicmd->scsi_done(scsicmd);
		scsicmd->scsi_done(scsicmd);
		return 0;
		return 0;
@@ -2002,8 +2002,8 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
				memcpy(scsicmd->sense_buffer,
				memcpy(scsicmd->sense_buffer,
				  &dev->fsa_dev[cid].sense_data,
				  &dev->fsa_dev[cid].sense_data,
				  (sizeof(dev->fsa_dev[cid].sense_data) >
				  (sizeof(dev->fsa_dev[cid].sense_data) >
				    sizeof(scsicmd->sense_buffer))
				    SCSI_SENSE_BUFFERSIZE)
				       ? sizeof(scsicmd->sense_buffer)
				       ? SCSI_SENSE_BUFFERSIZE
				       : sizeof(dev->fsa_dev[cid].sense_data));
				       : sizeof(dev->fsa_dev[cid].sense_data));
			}
			}
			scsicmd->scsi_done(scsicmd);
			scsicmd->scsi_done(scsicmd);
@@ -2259,8 +2259,8 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
				ILLEGAL_REQUEST, SENCODE_INVALID_COMMAND,
				ILLEGAL_REQUEST, SENCODE_INVALID_COMMAND,
				ASENCODE_INVALID_COMMAND, 0, 0, 0, 0);
				ASENCODE_INVALID_COMMAND, 0, 0, 0, 0);
			memcpy(scsicmd->sense_buffer, &dev->fsa_dev[cid].sense_data,
			memcpy(scsicmd->sense_buffer, &dev->fsa_dev[cid].sense_data,
			  (sizeof(dev->fsa_dev[cid].sense_data) > sizeof(scsicmd->sense_buffer))
			  (sizeof(dev->fsa_dev[cid].sense_data) > SCSI_SENSE_BUFFERSIZE)
			    ? sizeof(scsicmd->sense_buffer)
			    ? SCSI_SENSE_BUFFERSIZE
			    : sizeof(dev->fsa_dev[cid].sense_data));
			    : sizeof(dev->fsa_dev[cid].sense_data));
			scsicmd->scsi_done(scsicmd);
			scsicmd->scsi_done(scsicmd);
			return 0;
			return 0;
@@ -2422,8 +2422,8 @@ static void aac_srb_callback(void *context, struct fib * fibptr)
		int len;
		int len;
		printk(KERN_WARNING "aac_srb_callback: srb failed, status = %d\n", le32_to_cpu(srbreply->status));
		printk(KERN_WARNING "aac_srb_callback: srb failed, status = %d\n", le32_to_cpu(srbreply->status));
		len = (le32_to_cpu(srbreply->sense_data_size) > 
		len = (le32_to_cpu(srbreply->sense_data_size) > 
				sizeof(scsicmd->sense_buffer)) ?
				SCSI_SENSE_BUFFERSIZE) ?
				sizeof(scsicmd->sense_buffer) : 
				SCSI_SENSE_BUFFERSIZE :
				le32_to_cpu(srbreply->sense_data_size);
				le32_to_cpu(srbreply->sense_data_size);
		scsicmd->result = DID_ERROR << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_CHECK_CONDITION;
		scsicmd->result = DID_ERROR << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_CHECK_CONDITION;
		memcpy(scsicmd->sense_buffer, srbreply->sense_data, len);
		memcpy(scsicmd->sense_buffer, srbreply->sense_data, len);
@@ -2528,8 +2528,8 @@ static void aac_srb_callback(void *context, struct fib * fibptr)
		int len;
		int len;
		scsicmd->result |= SAM_STAT_CHECK_CONDITION;
		scsicmd->result |= SAM_STAT_CHECK_CONDITION;
		len = (le32_to_cpu(srbreply->sense_data_size) > 
		len = (le32_to_cpu(srbreply->sense_data_size) > 
				sizeof(scsicmd->sense_buffer)) ?
				SCSI_SENSE_BUFFERSIZE) ?
				sizeof(scsicmd->sense_buffer) :
				SCSI_SENSE_BUFFERSIZE :
				le32_to_cpu(srbreply->sense_data_size);
				le32_to_cpu(srbreply->sense_data_size);
#ifdef AAC_DETAILED_STATUS_INFO
#ifdef AAC_DETAILED_STATUS_INFO
		printk(KERN_WARNING "aac_srb_callback: check condition, status = %d len=%d\n",
		printk(KERN_WARNING "aac_srb_callback: check condition, status = %d len=%d\n",
Loading