Commit 0944a721 authored by FUJITA Tomonori's avatar FUJITA Tomonori Committed by James Bottomley

[SCSI] st: convert test_ready to use st_scsi_kern_execute

This replaces st_do_scsi in test_ready (TEST_UNIT_READY) with
st_scsi_kern_execute.
Signed-off-by: default avatarFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: default avatarKai Makisara <Kai.Makisara@kolumbus.fi>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
parent ffb43494
...@@ -874,21 +874,24 @@ static int test_ready(struct scsi_tape *STp, int do_wait) ...@@ -874,21 +874,24 @@ static int test_ready(struct scsi_tape *STp, int do_wait)
int attentions, waits, max_wait, scode; int attentions, waits, max_wait, scode;
int retval = CHKRES_READY, new_session = 0; int retval = CHKRES_READY, new_session = 0;
unsigned char cmd[MAX_COMMAND_SIZE]; unsigned char cmd[MAX_COMMAND_SIZE];
struct st_request *SRpnt = NULL; struct st_request *SRpnt;
struct st_cmdstatus *cmdstatp = &STp->buffer->cmdstat; struct st_cmdstatus *cmdstatp = &STp->buffer->cmdstat;
SRpnt = st_allocate_request(STp);
if (!SRpnt)
return STp->buffer->syscall_result;
max_wait = do_wait ? ST_BLOCK_SECONDS : 0; max_wait = do_wait ? ST_BLOCK_SECONDS : 0;
for (attentions=waits=0; ; ) { for (attentions=waits=0; ; ) {
memset((void *) &cmd[0], 0, MAX_COMMAND_SIZE); memset((void *) &cmd[0], 0, MAX_COMMAND_SIZE);
cmd[0] = TEST_UNIT_READY; cmd[0] = TEST_UNIT_READY;
SRpnt = st_do_scsi(SRpnt, STp, cmd, 0, DMA_NONE,
STp->long_timeout, MAX_READY_RETRIES, 1);
if (!SRpnt) { retval = st_scsi_kern_execute(SRpnt, cmd, DMA_NONE, NULL, 0,
retval = (STp->buffer)->syscall_result; STp->long_timeout,
MAX_READY_RETRIES);
if (retval)
break; break;
}
if (cmdstatp->have_sense) { if (cmdstatp->have_sense) {
...@@ -932,8 +935,8 @@ static int test_ready(struct scsi_tape *STp, int do_wait) ...@@ -932,8 +935,8 @@ static int test_ready(struct scsi_tape *STp, int do_wait)
break; break;
} }
if (SRpnt != NULL) st_release_request(SRpnt);
st_release_request(SRpnt);
return retval; return retval;
} }
......
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