Commit 3ace426f authored by Salyzyn, Mark's avatar Salyzyn, Mark Committed by James Bottomley

[SCSI] aacraid: replace '<?:' with min_t()

The promised min_t() cleanup. Purely cosmetic.
Signed-off-by: default avatarMark Salyzyn <aacraid@adaptec.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
parent b80ca4f7
...@@ -912,9 +912,8 @@ static int aac_bounds_32(struct aac_dev * dev, struct scsi_cmnd * cmd, u64 lba) ...@@ -912,9 +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) > SCSI_SENSE_BUFFERSIZE) min_t(size_t, sizeof(dev->fsa_dev[cid].sense_data),
? SCSI_SENSE_BUFFERSIZE SCSI_SENSE_BUFFERSIZE));
: sizeof(dev->fsa_dev[cid].sense_data));
cmd->scsi_done(cmd); cmd->scsi_done(cmd);
return 1; return 1;
} }
...@@ -1525,9 +1524,8 @@ static void io_callback(void *context, struct fib * fibptr) ...@@ -1525,9 +1524,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) > SCSI_SENSE_BUFFERSIZE) min_t(size_t, sizeof(dev->fsa_dev[cid].sense_data),
? SCSI_SENSE_BUFFERSIZE SCSI_SENSE_BUFFERSIZE));
: sizeof(dev->fsa_dev[cid].sense_data));
} }
aac_fib_complete(fibptr); aac_fib_complete(fibptr);
aac_fib_free(fibptr); aac_fib_free(fibptr);
...@@ -1949,9 +1947,8 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) ...@@ -1949,9 +1947,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) > SCSI_SENSE_BUFFERSIZE) min_t(size_t, sizeof(dev->fsa_dev[cid].sense_data),
? SCSI_SENSE_BUFFERSIZE SCSI_SENSE_BUFFERSIZE));
: sizeof(dev->fsa_dev[cid].sense_data));
scsicmd->scsi_done(scsicmd); scsicmd->scsi_done(scsicmd);
return 0; return 0;
} }
...@@ -2001,10 +1998,9 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) ...@@ -2001,10 +1998,9 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
ASENCODE_NO_SENSE, 0, 7, 2, 0); ASENCODE_NO_SENSE, 0, 7, 2, 0);
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) > min_t(size_t,
SCSI_SENSE_BUFFERSIZE) sizeof(dev->fsa_dev[cid].sense_data),
? SCSI_SENSE_BUFFERSIZE SCSI_SENSE_BUFFERSIZE));
: sizeof(dev->fsa_dev[cid].sense_data));
} }
scsicmd->scsi_done(scsicmd); scsicmd->scsi_done(scsicmd);
return 0; return 0;
...@@ -2259,9 +2255,9 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) ...@@ -2259,9 +2255,9 @@ 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) > SCSI_SENSE_BUFFERSIZE) min_t(size_t,
? SCSI_SENSE_BUFFERSIZE sizeof(dev->fsa_dev[cid].sense_data),
: sizeof(dev->fsa_dev[cid].sense_data)); SCSI_SENSE_BUFFERSIZE));
scsicmd->scsi_done(scsicmd); scsicmd->scsi_done(scsicmd);
return 0; return 0;
} }
...@@ -2421,10 +2417,8 @@ static void aac_srb_callback(void *context, struct fib * fibptr) ...@@ -2421,10 +2417,8 @@ static void aac_srb_callback(void *context, struct fib * fibptr)
if (le32_to_cpu(srbreply->status) != ST_OK){ if (le32_to_cpu(srbreply->status) != ST_OK){
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 = min_t(u32, le32_to_cpu(srbreply->sense_data_size),
SCSI_SENSE_BUFFERSIZE) ? SCSI_SENSE_BUFFERSIZE);
SCSI_SENSE_BUFFERSIZE :
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);
} }
...@@ -2527,10 +2521,8 @@ static void aac_srb_callback(void *context, struct fib * fibptr) ...@@ -2527,10 +2521,8 @@ static void aac_srb_callback(void *context, struct fib * fibptr)
if (le32_to_cpu(srbreply->scsi_status) == 0x02 ){ // Check Condition if (le32_to_cpu(srbreply->scsi_status) == 0x02 ){ // Check Condition
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 = min_t(u32, le32_to_cpu(srbreply->sense_data_size),
SCSI_SENSE_BUFFERSIZE) ? SCSI_SENSE_BUFFERSIZE);
SCSI_SENSE_BUFFERSIZE :
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",
le32_to_cpu(srbreply->status), len); le32_to_cpu(srbreply->status), len);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment