Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 86190
b: refs/heads/master
c: 26106e3
h: refs/heads/master
v: v3
  • Loading branch information
FUJITA Tomonori authored and James Bottomley committed Feb 22, 2008
1 parent 2827d6f commit 31d8b2c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 23 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: eafe1df9e311034cce204e43c0e45c91723b802f
refs/heads/master: 26106e3ca379e30790c41d8835e79395437152ec
34 changes: 12 additions & 22 deletions trunk/drivers/scsi/stex.c
Original file line number Diff line number Diff line change
Expand Up @@ -461,23 +461,6 @@ static void stex_internal_copy(struct scsi_cmnd *cmd,
}
}

static int stex_direct_copy(struct scsi_cmnd *cmd,
const void *src, size_t count)
{
size_t cp_len = count;
int n_elem = 0;

n_elem = scsi_dma_map(cmd);
if (n_elem < 0)
return 0;

stex_internal_copy(cmd, src, &cp_len, n_elem, ST_TO_CMD);

scsi_dma_unmap(cmd);

return cp_len == count;
}

static void stex_controller_info(struct st_hba *hba, struct st_ccb *ccb)
{
struct st_frame *p;
Expand Down Expand Up @@ -569,8 +552,10 @@ stex_queuecommand(struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd *))
unsigned char page;
page = cmd->cmnd[2] & 0x3f;
if (page == 0x8 || page == 0x3f) {
stex_direct_copy(cmd, ms10_caching_page,
sizeof(ms10_caching_page));
size_t cp_len = sizeof(ms10_caching_page);
stex_internal_copy(cmd, ms10_caching_page,
&cp_len, scsi_sg_count(cmd),
ST_TO_CMD);
cmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8;
done(cmd);
} else
Expand Down Expand Up @@ -599,8 +584,10 @@ stex_queuecommand(struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd *))
if (id != host->max_id - 1)
break;
if (lun == 0 && (cmd->cmnd[1] & INQUIRY_EVPD) == 0) {
stex_direct_copy(cmd, console_inq_page,
sizeof(console_inq_page));
size_t cp_len = sizeof(console_inq_page);
stex_internal_copy(cmd, console_inq_page,
&cp_len, scsi_sg_count(cmd),
ST_TO_CMD);
cmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8;
done(cmd);
} else
Expand All @@ -609,14 +596,17 @@ stex_queuecommand(struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd *))
case PASSTHRU_CMD:
if (cmd->cmnd[1] == PASSTHRU_GET_DRVVER) {
struct st_drvver ver;
size_t cp_len = sizeof(ver);
ver.major = ST_VER_MAJOR;
ver.minor = ST_VER_MINOR;
ver.oem = ST_OEM;
ver.build = ST_BUILD_VER;
ver.signature[0] = PASSTHRU_SIGNATURE;
ver.console_id = host->max_id - 1;
ver.host_no = hba->host->host_no;
cmd->result = stex_direct_copy(cmd, &ver, sizeof(ver)) ?
stex_internal_copy(cmd, &ver, &cp_len,
scsi_sg_count(cmd), ST_TO_CMD);
cmd->result = sizeof(ver) == cp_len ?
DID_OK << 16 | COMMAND_COMPLETE << 8 :
DID_ERROR << 16 | COMMAND_COMPLETE << 8;
done(cmd);
Expand Down

0 comments on commit 31d8b2c

Please sign in to comment.