Re: [RFC 2/6] usb/dummy_hcd: add sg support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 8 Dec 2011, Sebastian Andrzej Siewior wrote:

> This patch adds sg support to dummy_hcd. It seems that uas is not able
> to work with a hcd which does not support sg only based transfers.
> 
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
> ---
>  drivers/usb/gadget/dummy_hcd.c |   78 ++++++++++++++++++++++++++++++++++++----
>  1 files changed, 71 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c
> index bfba4aa..5ba8e18 100644
> --- a/drivers/usb/gadget/dummy_hcd.c
> +++ b/drivers/usb/gadget/dummy_hcd.c

> @@ -1140,21 +1142,82 @@ static int dummy_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)
>  	return rc;
>  }
>  
> +static void forward_miter(struct sg_mapping_iter *miter, u32 bytes)
> +{
> +	u32 done = 0;
> +
> +	/* press the forward button on the URB side */
> +	if (!bytes)
> +		return;
> +	do {
> +		done += miter->length;
> +		if (bytes > done) {
> +			sg_miter_next(miter);
> +			continue;
> +		}
> +		if (bytes == done)
> +			break;
> +
> +		miter->consumed = miter->length - (done - bytes);
> +		break;
> +	} while (1);
> +	sg_miter_next(miter);
> +}

This entire routine could be eliminated if you put the sg_mapping_iter
thingy inside the urbp private structure.  Don't start the iteration 
until you're ready to use it, of course.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux