All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boaz Harrosh <bharrosh@panasas.com>
To: Greg KH <gregkh@suse.de>
Cc: Oliver Neukum <oliver@neukum.name>,
	FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>,
	linux-scsi <linux-scsi@vger.kernel.org>
Subject: Re: [PATCH] microtek.c - use data accessors and !use_sg cleanup
Date: Thu, 12 Jul 2007 20:04:16 +0300	[thread overview]
Message-ID: <46965F10.4080607@panasas.com> (raw)
In-Reply-To: <20070712165805.GB19998@suse.de>

Greg KH wrote:
> On Thu, Jul 12, 2007 at 04:24:04PM +0300, Boaz Harrosh wrote:
>> Boaz Harrosh wrote:
>>>   - use scsi_cmnd data accessors
>>>   - Clean the !use_sg code paths
>>>
>>> Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
>>> ---
>>>  drivers/usb/image/microtek.c |   32 ++++++++++++++------------------
>>>  1 files changed, 14 insertions(+), 18 deletions(-)
>>>
>>> diff --git a/drivers/usb/image/microtek.c b/drivers/usb/image/microtek.c
>>> index 51bd80d..0a5c6e8 100644
>>> --- a/drivers/usb/image/microtek.c
>>> +++ b/drivers/usb/image/microtek.c
>>> @@ -447,7 +447,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(transfer->status) ) {
>>>  		context->srb->result = (transfer->status == -ENOENT ? DID_ABORT : DID_ERROR)<<16;
>>>  	}
>>> @@ -490,7 +491,8 @@ 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);
>>>  		}
>>> @@ -504,21 +506,23 @@ static void mts_do_sg (struct urb* transfer)
>>>  	struct scatterlist * sg;
>>>  	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(transfer->status)) {
>>>                  context->srb->result = (transfer->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;
>>>  }
>>>  
>>> @@ -546,20 +550,12 @@ 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);
>>> -		}
>>> +	if (!scsi_bufflen(srb)) {
>>> +		desc->context.data = NULL;
>>> +		desc->context.data_length = 0;
>>> +		return;
>>>  	} else {
>>> -		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;
>>>  	}
>> I forgot TO: of maintainers
>>
>> Oliver Neukum <oliver@neukum.name>
>> Greg Kroah-Hartman <gregkh@suse.de>
>>
>> You seem to have signed some of the last patches
>> on this driver. Please review
> 
> No objetion from me.  Care to resend it to me, and CC: the
> linux-usb-devel list also so that it is in a format that I can apply to
> the tree?
> 
> thanks,
> 
> greg k-h
Will do. I hope I can post with out signing up.

  reply	other threads:[~2007-07-12 17:04 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-04 18:19 Data accessors more patches Boaz Harrosh
2007-07-04 18:24 ` [PATCH] libata-scsi.c: convert to use the data buffer accessors Boaz Harrosh
2007-07-04 18:26 ` [PATCH] scsi.c: " Boaz Harrosh
2007-07-04 18:28 ` [PATCH] scsi_debug: convert to use the data buffer accessors and !use_sg cleanup Boaz Harrosh
2007-07-12 13:11 ` [PATCH] microtek.c - use data " Boaz Harrosh
2007-07-12 13:24   ` Boaz Harrosh
2007-07-12 16:58     ` Greg KH
2007-07-12 17:04       ` Boaz Harrosh [this message]
2007-07-12 17:05       ` James Bottomley
2007-07-12 18:05         ` Greg KH
2007-07-12 13:29   ` Oliver Neukum
2007-07-12 13:54     ` James Bottomley
2007-07-12 13:56       ` Oliver Neukum
2007-07-12 14:01         ` Boaz Harrosh
2007-07-12 13:58     ` Boaz Harrosh
2007-07-12 13:13 ` Data accessors more patches Boaz Harrosh
2007-07-12 22:37   ` FUJITA Tomonori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46965F10.4080607@panasas.com \
    --to=bharrosh@panasas.com \
    --cc=fujita.tomonori@lab.ntt.co.jp \
    --cc=gregkh@suse.de \
    --cc=linux-scsi@vger.kernel.org \
    --cc=oliver@neukum.name \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.