Commit ed226f08 authored by Mike Christie's avatar Mike Christie Committed by Martin K. Petersen

scsi: ch: Convert to scsi_execute_cmd()

scsi_execute_req() is going to be removed. Convert ch to
scsi_execute_cmd().
Signed-off-by: default avatarMike Christie <michael.christie@oracle.com>
Reviewed-by: default avatarJohn Garry <john.g.garry@oracle.com>
Reviewed-by: default avatarBart Van Assche <bvanassche@acm.org>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 08e95a2b
...@@ -184,20 +184,21 @@ static int ch_find_errno(struct scsi_sense_hdr *sshdr) ...@@ -184,20 +184,21 @@ static int ch_find_errno(struct scsi_sense_hdr *sshdr)
static int static int
ch_do_scsi(scsi_changer *ch, unsigned char *cmd, int cmd_len, ch_do_scsi(scsi_changer *ch, unsigned char *cmd, int cmd_len,
void *buffer, unsigned buflength, void *buffer, unsigned int buflength, enum req_op op)
enum dma_data_direction direction)
{ {
int errno, retries = 0, timeout, result; int errno, retries = 0, timeout, result;
struct scsi_sense_hdr sshdr; struct scsi_sense_hdr sshdr;
const struct scsi_exec_args exec_args = {
.sshdr = &sshdr,
};
timeout = (cmd[0] == INITIALIZE_ELEMENT_STATUS) timeout = (cmd[0] == INITIALIZE_ELEMENT_STATUS)
? timeout_init : timeout_move; ? timeout_init : timeout_move;
retry: retry:
errno = 0; errno = 0;
result = scsi_execute_req(ch->device, cmd, direction, buffer, result = scsi_execute_cmd(ch->device, cmd, op, buffer, buflength,
buflength, &sshdr, timeout * HZ, timeout * HZ, MAX_RETRIES, &exec_args);
MAX_RETRIES, NULL);
if (result < 0) if (result < 0)
return result; return result;
if (scsi_sense_valid(&sshdr)) { if (scsi_sense_valid(&sshdr)) {
...@@ -254,7 +255,7 @@ ch_read_element_status(scsi_changer *ch, u_int elem, char *data) ...@@ -254,7 +255,7 @@ ch_read_element_status(scsi_changer *ch, u_int elem, char *data)
cmd[5] = 1; cmd[5] = 1;
cmd[9] = 255; cmd[9] = 255;
if (0 == (result = ch_do_scsi(ch, cmd, 12, if (0 == (result = ch_do_scsi(ch, cmd, 12,
buffer, 256, DMA_FROM_DEVICE))) { buffer, 256, REQ_OP_DRV_IN))) {
if (((buffer[16] << 8) | buffer[17]) != elem) { if (((buffer[16] << 8) | buffer[17]) != elem) {
DPRINTK("asked for element 0x%02x, got 0x%02x\n", DPRINTK("asked for element 0x%02x, got 0x%02x\n",
elem,(buffer[16] << 8) | buffer[17]); elem,(buffer[16] << 8) | buffer[17]);
...@@ -284,7 +285,7 @@ ch_init_elem(scsi_changer *ch) ...@@ -284,7 +285,7 @@ ch_init_elem(scsi_changer *ch)
memset(cmd,0,sizeof(cmd)); memset(cmd,0,sizeof(cmd));
cmd[0] = INITIALIZE_ELEMENT_STATUS; cmd[0] = INITIALIZE_ELEMENT_STATUS;
cmd[1] = (ch->device->lun & 0x7) << 5; cmd[1] = (ch->device->lun & 0x7) << 5;
err = ch_do_scsi(ch, cmd, 6, NULL, 0, DMA_NONE); err = ch_do_scsi(ch, cmd, 6, NULL, 0, REQ_OP_DRV_IN);
VPRINTK(KERN_INFO, "... finished\n"); VPRINTK(KERN_INFO, "... finished\n");
return err; return err;
} }
...@@ -306,10 +307,10 @@ ch_readconfig(scsi_changer *ch) ...@@ -306,10 +307,10 @@ ch_readconfig(scsi_changer *ch)
cmd[1] = (ch->device->lun & 0x7) << 5; cmd[1] = (ch->device->lun & 0x7) << 5;
cmd[2] = 0x1d; cmd[2] = 0x1d;
cmd[4] = 255; cmd[4] = 255;
result = ch_do_scsi(ch, cmd, 10, buffer, 255, DMA_FROM_DEVICE); result = ch_do_scsi(ch, cmd, 10, buffer, 255, REQ_OP_DRV_IN);
if (0 != result) { if (0 != result) {
cmd[1] |= (1<<3); cmd[1] |= (1<<3);
result = ch_do_scsi(ch, cmd, 10, buffer, 255, DMA_FROM_DEVICE); result = ch_do_scsi(ch, cmd, 10, buffer, 255, REQ_OP_DRV_IN);
} }
if (0 == result) { if (0 == result) {
ch->firsts[CHET_MT] = ch->firsts[CHET_MT] =
...@@ -434,7 +435,7 @@ ch_position(scsi_changer *ch, u_int trans, u_int elem, int rotate) ...@@ -434,7 +435,7 @@ ch_position(scsi_changer *ch, u_int trans, u_int elem, int rotate)
cmd[4] = (elem >> 8) & 0xff; cmd[4] = (elem >> 8) & 0xff;
cmd[5] = elem & 0xff; cmd[5] = elem & 0xff;
cmd[8] = rotate ? 1 : 0; cmd[8] = rotate ? 1 : 0;
return ch_do_scsi(ch, cmd, 10, NULL, 0, DMA_NONE); return ch_do_scsi(ch, cmd, 10, NULL, 0, REQ_OP_DRV_IN);
} }
static int static int
...@@ -455,7 +456,7 @@ ch_move(scsi_changer *ch, u_int trans, u_int src, u_int dest, int rotate) ...@@ -455,7 +456,7 @@ ch_move(scsi_changer *ch, u_int trans, u_int src, u_int dest, int rotate)
cmd[6] = (dest >> 8) & 0xff; cmd[6] = (dest >> 8) & 0xff;
cmd[7] = dest & 0xff; cmd[7] = dest & 0xff;
cmd[10] = rotate ? 1 : 0; cmd[10] = rotate ? 1 : 0;
return ch_do_scsi(ch, cmd, 12, NULL,0, DMA_NONE); return ch_do_scsi(ch, cmd, 12, NULL, 0, REQ_OP_DRV_IN);
} }
static int static int
...@@ -481,7 +482,7 @@ ch_exchange(scsi_changer *ch, u_int trans, u_int src, ...@@ -481,7 +482,7 @@ ch_exchange(scsi_changer *ch, u_int trans, u_int src,
cmd[9] = dest2 & 0xff; cmd[9] = dest2 & 0xff;
cmd[10] = (rotate1 ? 1 : 0) | (rotate2 ? 2 : 0); cmd[10] = (rotate1 ? 1 : 0) | (rotate2 ? 2 : 0);
return ch_do_scsi(ch, cmd, 12, NULL, 0, DMA_NONE); return ch_do_scsi(ch, cmd, 12, NULL, 0, REQ_OP_DRV_IN);
} }
static void static void
...@@ -531,7 +532,7 @@ ch_set_voltag(scsi_changer *ch, u_int elem, ...@@ -531,7 +532,7 @@ ch_set_voltag(scsi_changer *ch, u_int elem,
memcpy(buffer,tag,32); memcpy(buffer,tag,32);
ch_check_voltag(buffer); ch_check_voltag(buffer);
result = ch_do_scsi(ch, cmd, 12, buffer, 256, DMA_TO_DEVICE); result = ch_do_scsi(ch, cmd, 12, buffer, 256, REQ_OP_DRV_OUT);
kfree(buffer); kfree(buffer);
return result; return result;
} }
...@@ -799,8 +800,7 @@ static long ch_ioctl(struct file *file, ...@@ -799,8 +800,7 @@ static long ch_ioctl(struct file *file,
ch_cmd[5] = 1; ch_cmd[5] = 1;
ch_cmd[9] = 255; ch_cmd[9] = 255;
result = ch_do_scsi(ch, ch_cmd, 12, result = ch_do_scsi(ch, ch_cmd, 12, buffer, 256, REQ_OP_DRV_IN);
buffer, 256, DMA_FROM_DEVICE);
if (!result) { if (!result) {
cge.cge_status = buffer[18]; cge.cge_status = buffer[18];
cge.cge_flags = 0; cge.cge_flags = 0;
......
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