* [PATCH] microtek: convert to use the data buffer accessors
@ 2007-08-12 7:11 FUJITA Tomonori
2007-08-12 15:01 ` Harrosh, Boaz
0 siblings, 1 reply; 4+ messages in thread
From: FUJITA Tomonori @ 2007-08-12 7:11 UTC (permalink / raw)
To: linux-scsi; +Cc: James.Bottomley, greg, fujita.tomonori
The patch is only compile tested.
---
>From d5ad824bce0e5e3894a102fee74f1f7c36d639b7 Mon Sep 17 00:00:00 2001
From: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Date: Sun, 12 Aug 2007 15:33:23 +0900
Subject: [PATCH] microtek: convert to use the data buffer accessors
- remove the unnecessary map_single path.
- convert to use the new accessors for the sg lists and the
parameters.
TODO: sg chaining support
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
---
drivers/usb/image/microtek.c | 32 +++++++++++++-------------------
1 files changed, 13 insertions(+), 19 deletions(-)
diff --git a/drivers/usb/image/microtek.c b/drivers/usb/image/microtek.c
index 768b2c1..59b57c3 100644
--- a/drivers/usb/image/microtek.c
+++ b/drivers/usb/image/microtek.c
@@ -446,7 +446,8 @@ static void mts_data_done( struct urb* transfer )
MTS_INT_INIT();
if ( context->data_length != transfer->actual_length ) {
- context->srb->resid = context->data_length - transfer->actual_length;
+ scsi_set_resid(context->srb,
+ context->data_length - transfer->actual_length);
} else if ( unlikely(status) ) {
context->srb->result = (status == -ENOENT ? DID_ABORT : DID_ERROR)<<16;
}
@@ -490,7 +491,7 @@ static void mts_command_done( struct urb *transfer )
context->data_pipe,
context->data,
context->data_length,
- context->srb->use_sg > 1 ? mts_do_sg : mts_data_done);
+ scsi_sg_count(context->srb) > 1 ? mts_do_sg : mts_data_done);
} else {
mts_get_status(transfer);
}
@@ -505,21 +506,22 @@ static void mts_do_sg (struct urb* transfer)
int status = transfer->status;
MTS_INT_INIT();
- MTS_DEBUG("Processing fragment %d of %d\n", context->fragment,context->srb->use_sg);
+ MTS_DEBUG("Processing fragment %d of %d\n", context->fragment,
+ scsi_sg_count(context->srb));
if (unlikely(status)) {
context->srb->result = (status == -ENOENT ? DID_ABORT : DID_ERROR)<<16;
mts_transfer_cleanup(transfer);
}
- sg = context->srb->request_buffer;
+ sg = scsi_sglist(context->srb);
context->fragment++;
mts_int_submit_urb(transfer,
context->data_pipe,
page_address(sg[context->fragment].page) +
sg[context->fragment].offset,
sg[context->fragment].length,
- context->fragment + 1 == context->srb->use_sg ? mts_data_done : mts_do_sg);
+ context->fragment + 1 == scsi_sg_count(context->srb) ? mts_data_done : mts_do_sg);
return;
}
@@ -547,25 +549,17 @@ mts_build_transfer_context(struct scsi_cmnd *srb, struct mts_desc* desc)
desc->context.srb = srb;
desc->context.fragment = 0;
- if (!srb->use_sg) {
- if ( !srb->request_bufflen ){
- desc->context.data = NULL;
- desc->context.data_length = 0;
- return;
- } else {
- desc->context.data = srb->request_buffer;
- desc->context.data_length = srb->request_bufflen;
- MTS_DEBUG("length = %d or %d\n",
- srb->request_bufflen, srb->bufflen);
- }
- } else {
+ if (scsi_sg_count(srb)) {
MTS_DEBUG("Using scatter/gather\n");
- sg = srb->request_buffer;
+ sg = scsi_sglist(srb);
desc->context.data = page_address(sg[0].page) + sg[0].offset;
desc->context.data_length = sg[0].length;
+ } else {
+ desc->context.data = NULL;
+ desc->context.data_length = 0;
+ return;
}
-
/* can't rely on srb->sc_data_direction */
/* Brutally ripped from usb-storage */
--
1.5.2.4
^ permalink raw reply related [flat|nested] 4+ messages in thread* RE: [PATCH] microtek: convert to use the data buffer accessors
2007-08-12 7:11 [PATCH] microtek: convert to use the data buffer accessors FUJITA Tomonori
@ 2007-08-12 15:01 ` Harrosh, Boaz
2007-08-12 15:12 ` FUJITA Tomonori
0 siblings, 1 reply; 4+ messages in thread
From: Harrosh, Boaz @ 2007-08-12 15:01 UTC (permalink / raw)
To: FUJITA Tomonori, linux-scsi; +Cc: James.Bottomley, greg, fujita.tomonori
FUJITA Tomonori wrote ...
> Subject: [PATCH] microtek: convert to use the data buffer accessors
>
> - remove the unnecessary map_single path.
>
> - convert to use the new accessors for the sg lists and the
> parameters.
>
> TODO: sg chaining support
>
> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Is this not the same as the patch I sent at 2007-07-12
http://marc.info/?l=linux-scsi&m=118424592500438&w=4
And was ACKed by one of the maintainers:
http://marc.info/?l=linux-scsi&m=118426360825803&w=4
Boaz
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] microtek: convert to use the data buffer accessors
2007-08-12 15:01 ` Harrosh, Boaz
@ 2007-08-12 15:12 ` FUJITA Tomonori
2007-08-12 15:26 ` James Bottomley
0 siblings, 1 reply; 4+ messages in thread
From: FUJITA Tomonori @ 2007-08-12 15:12 UTC (permalink / raw)
To: bharrosh; +Cc: tomof, linux-scsi, James.Bottomley, greg, fujita.tomonori
On Sun, 12 Aug 2007 11:01:20 -0400
"Harrosh, Boaz" <bharrosh@panasas.com> wrote:
> FUJITA Tomonori wrote ...
> > Subject: [PATCH] microtek: convert to use the data buffer accessors
> >
> > - remove the unnecessary map_single path.
> >
> > - convert to use the new accessors for the sg lists and the
> > parameters.
> >
> > TODO: sg chaining support
> >
> > Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
>
> Is this not the same as the patch I sent at 2007-07-12
> http://marc.info/?l=linux-scsi&m=118424592500438&w=4
>
> And was ACKed by one of the maintainers:
> http://marc.info/?l=linux-scsi&m=118426360825803&w=4
>
Oops, I didn't realized that. Isn't the patch in scsi-misc,
scsi-pending, or scsi-fixes?
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] microtek: convert to use the data buffer accessors
2007-08-12 15:12 ` FUJITA Tomonori
@ 2007-08-12 15:26 ` James Bottomley
0 siblings, 0 replies; 4+ messages in thread
From: James Bottomley @ 2007-08-12 15:26 UTC (permalink / raw)
To: FUJITA Tomonori; +Cc: bharrosh, linux-scsi, greg, fujita.tomonori
On Mon, 2007-08-13 at 00:12 +0900, FUJITA Tomonori wrote:
> Oops, I didn't realized that. Isn't the patch in scsi-misc,
> scsi-pending, or scsi-fixes?
No ... I forgot ... after Greg told me to take it through my tree ...
I'll add it.
James
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-08-12 15:26 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-12 7:11 [PATCH] microtek: convert to use the data buffer accessors FUJITA Tomonori
2007-08-12 15:01 ` Harrosh, Boaz
2007-08-12 15:12 ` FUJITA Tomonori
2007-08-12 15:26 ` James Bottomley
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox