diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2008-12-05 01:25:20 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2008-12-29 12:24:28 -0500 |
commit | 4deba245d0d6b2dc97cc4277c37f8519655d3afe (patch) | |
tree | c373ce904c08b0df912082019446f9955751d995 /drivers/scsi/st.c | |
parent | 5d2711c0ff9cdff79cd62d3c830e763d889e73de (diff) |
[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.c | 32 |
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) | |||
451 | complete(SRpnt->waiting); | 451 | complete(SRpnt->waiting); |
452 | } | 452 | } |
453 | 453 | ||
454 | static struct st_request *st_allocate_request(void) | 454 | static struct st_request *st_allocate_request(struct scsi_tape *stp) |
455 | { | 455 | { |
456 | return kzalloc(sizeof(struct st_request), GFP_KERNEL); | 456 | struct st_request *streq; |
457 | |||
458 | streq = kzalloc(sizeof(*streq), GFP_KERNEL); | ||
459 | if (streq) | ||
460 | streq->stp = stp; | ||
461 | else { | ||
462 | DEBC(printk(KERN_ERR "%s: Can't get SCSI request.\n", | ||
463 | tape_name(stp));); | ||
464 | if (signal_pending(current)) | ||
465 | stp->buffer->syscall_result = -EINTR; | ||
466 | else | ||
467 | stp->buffer->syscall_result = -EBUSY; | ||
468 | } | ||
469 | |||
470 | return streq; | ||
457 | } | 471 | } |
458 | 472 | ||
459 | static void st_release_request(struct st_request *streq) | 473 | 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 | |||
481 | return NULL; | 495 | return NULL; |
482 | } | 496 | } |
483 | 497 | ||
484 | if (SRpnt == NULL) { | 498 | if (!SRpnt) { |
485 | SRpnt = st_allocate_request(); | 499 | SRpnt = st_allocate_request(STp); |
486 | if (SRpnt == NULL) { | 500 | if (!SRpnt) |
487 | DEBC( printk(KERN_ERR "%s: Can't get SCSI request.\n", | ||
488 | tape_name(STp)); ); | ||
489 | if (signal_pending(current)) | ||
490 | (STp->buffer)->syscall_result = (-EINTR); | ||
491 | else | ||
492 | (STp->buffer)->syscall_result = (-EBUSY); | ||
493 | return NULL; | 501 | return NULL; |
494 | } | ||
495 | SRpnt->stp = STp; | ||
496 | } | 502 | } |
497 | 503 | ||
498 | /* If async IO, set last_SRpnt. This ptr tells write_behind_check | 504 | /* If async IO, set last_SRpnt. This ptr tells write_behind_check |