On Sun, 30 Nov 2008 14:12:41 +0200 Boaz Harrosh <bharrosh@xxxxxxxxxxx> wrote: > FUJITA Tomonori wrote: > > This replaces st_do_scsi in read_mode_page (MODE_SENSE) with > > st_scsi_kern_execute. > > > > Signed-off-by: FUJITA Tomonori <fujita.tomonori@xxxxxxxxxxxxx> > > --- > > drivers/scsi/st.c | 16 +++++++++++----- > > 1 files changed, 11 insertions(+), 5 deletions(-) > > > > diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c > > index cc085bc..91d1249 100644 > > --- a/drivers/scsi/st.c > > +++ b/drivers/scsi/st.c > > @@ -2393,7 +2393,8 @@ static int st_set_options(struct scsi_tape *STp, long options) > > static int read_mode_page(struct scsi_tape *STp, int page, int omit_block_descs) > > { > > unsigned char cmd[MAX_COMMAND_SIZE]; > > - struct st_request *SRpnt = NULL; > > + struct st_request *SRpnt; > > + int ret; > > > > memset(cmd, 0, MAX_COMMAND_SIZE); > > cmd[0] = MODE_SENSE; > > @@ -2402,10 +2403,15 @@ static int read_mode_page(struct scsi_tape *STp, int page, int omit_block_descs) > > cmd[2] = page; > > cmd[4] = 255; > > > > - SRpnt = st_do_scsi(SRpnt, STp, cmd, cmd[4], DMA_FROM_DEVICE, > > - STp->device->timeout, 0, 1); > > - if (SRpnt == NULL) > > - return (STp->buffer)->syscall_result; > > + SRpnt = st_allocate_request(STp); > > + if (!SRpnt) > > + return STp->buffer->syscall_result; > > + > > + ret = st_scsi_kern_execute(SRpnt, cmd, DMA_FROM_DEVICE, > > + STp->buffer->b_data, cmd[4], > > + STp->device->timeout, MAX_RETRIES); > > + if (ret) > > + return ret; > > Are you sure you want to return here without st_release_request() ? > All other patches return ret but release first. Ah, thanks a lot. It should do something like this. diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c index cc085bc..cf8861f 100644 --- a/drivers/scsi/st.c +++ b/drivers/scsi/st.c @@ -2393,7 +2393,8 @@ static int st_set_options(struct scsi_tape *STp, long options) static int read_mode_page(struct scsi_tape *STp, int page, int omit_block_descs) { unsigned char cmd[MAX_COMMAND_SIZE]; - struct st_request *SRpnt = NULL; + struct st_request *SRpnt; + int ret; memset(cmd, 0, MAX_COMMAND_SIZE); cmd[0] = MODE_SENSE; @@ -2402,14 +2403,16 @@ static int read_mode_page(struct scsi_tape *STp, int page, int omit_block_descs) cmd[2] = page; cmd[4] = 255; - SRpnt = st_do_scsi(SRpnt, STp, cmd, cmd[4], DMA_FROM_DEVICE, - STp->device->timeout, 0, 1); - if (SRpnt == NULL) - return (STp->buffer)->syscall_result; + SRpnt = st_allocate_request(STp); + if (!SRpnt) + return STp->buffer->syscall_result; + ret = st_scsi_kern_execute(SRpnt, cmd, DMA_FROM_DEVICE, + STp->buffer->b_data, cmd[4], + STp->device->timeout, MAX_RETRIES); st_release_request(SRpnt); - return (STp->buffer)->syscall_result; + return ret ? : STp->buffer->syscall_result; } -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html