summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/st.c
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2008-12-05 15:25:20 +0900
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-12-29 11:24:28 -0600
commit4deba245d0d6b2dc97cc4277c37f8519655d3afe (patch)
treec373ce904c08b0df912082019446f9955751d995 /drivers/scsi/st.c
parent5d2711c0ff9cdff79cd62d3c830e763d889e73de (diff)
downloadtalos-op-linux-4deba245d0d6b2dc97cc4277c37f8519655d3afe.tar.gz
talos-op-linux-4deba245d0d6b2dc97cc4277c37f8519655d3afe.zip
[SCSI] st: move st_request initialization to st_allocate_request form st_do_scsi
This moves st_request initialization code to st_allocate_request() form st_do_scsi(). This is a preparation for making st_allocate_request() usable for everyone, not only st_do_scsi(). Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Acked-by: Kai Makisara <Kai.Makisara@kolumbus.fi> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/st.c')
-rw-r--r--drivers/scsi/st.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index d60be83ba78b..203f22e816c0 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -451,9 +451,23 @@ static void st_sleep_done(void *data, char *sense, int result, int resid)
complete(SRpnt->waiting);
}
-static struct st_request *st_allocate_request(void)
+static struct st_request *st_allocate_request(struct scsi_tape *stp)
{
- return kzalloc(sizeof(struct st_request), GFP_KERNEL);
+ struct st_request *streq;
+
+ streq = kzalloc(sizeof(*streq), GFP_KERNEL);
+ if (streq)
+ streq->stp = stp;
+ else {
+ DEBC(printk(KERN_ERR "%s: Can't get SCSI request.\n",
+ tape_name(stp)););
+ if (signal_pending(current))
+ stp->buffer->syscall_result = -EINTR;
+ else
+ stp->buffer->syscall_result = -EBUSY;
+ }
+
+ return streq;
}
static void st_release_request(struct st_request *streq)
@@ -481,18 +495,10 @@ st_do_scsi(struct st_request * SRpnt, struct scsi_tape * STp, unsigned char *cmd
return NULL;
}
- if (SRpnt == NULL) {
- SRpnt = st_allocate_request();
- if (SRpnt == NULL) {
- DEBC( printk(KERN_ERR "%s: Can't get SCSI request.\n",
- tape_name(STp)); );
- if (signal_pending(current))
- (STp->buffer)->syscall_result = (-EINTR);
- else
- (STp->buffer)->syscall_result = (-EBUSY);
+ if (!SRpnt) {
+ SRpnt = st_allocate_request(STp);
+ if (!SRpnt)
return NULL;
- }
- SRpnt->stp = STp;
}
/* If async IO, set last_SRpnt. This ptr tells write_behind_check
OpenPOWER on IntegriCloud