Re: [PATCH 3/5] usb: chipidea: udc: add the define TD_COUNT and fix all users

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

 



On Fri, Mar 01, 2013 at 03:42:25PM +0100, Michael Grzeschik wrote:
> A static count of transfer descriptors was used everywhere in the driver
> with the fixed number 4. This patch adds a define, named TD_COUNT, and
> replaces all users of this value. This way its possible to have only one
> parameter to change and limit the amount of tds per transfer.
> 
> Signed-off-by: Michael Grzeschik <m.grzeschik@xxxxxxxxxxxxxx>

Reviewed-by: Peter Chen <peter.chen@xxxxxxxxxxxxx>

> ---
>  drivers/usb/chipidea/ci.h  |    1 +
>  drivers/usb/chipidea/udc.c |    6 +++---
>  2 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h
> index e25d126..1532f08 100644
> --- a/drivers/usb/chipidea/ci.h
> +++ b/drivers/usb/chipidea/ci.h
> @@ -21,6 +21,7 @@
>  /******************************************************************************
>   * DEFINE
>   *****************************************************************************/
> +#define TD_COUNT           4
>  #define CI13XXX_PAGE_SIZE  4096ul /* page size for TD's */
>  #define ENDPT_MAX          32
>  
> diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
> index 45cce45..0b80228 100644
> --- a/drivers/usb/chipidea/udc.c
> +++ b/drivers/usb/chipidea/udc.c
> @@ -457,7 +457,7 @@ static int _hardware_enqueue(struct ci13xxx_ep *mEp, struct ci13xxx_req *mReq)
>  			mReq->ptr->token  |= TD_IOC;
>  	}
>  	mReq->ptr->page[0]  = mReq->req.dma;
> -	for (i = 1; i < 5; i++)
> +	for (i = 1; i <= TD_COUNT; i++)
>  		mReq->ptr->page[i] =
>  			(mReq->req.dma + i * CI13XXX_PAGE_SIZE) & ~TD_RESERVED_MASK;
>  
> @@ -702,8 +702,8 @@ static int _ep_queue(struct usb_ep *ep, struct usb_request *req,
>  		goto done;
>  	}
>  
> -	if (req->length > 4 * CI13XXX_PAGE_SIZE) {
> -		req->length = 4 * CI13XXX_PAGE_SIZE;
> +	if (req->length > TD_COUNT * CI13XXX_PAGE_SIZE) {
> +		req->length = TD_COUNT * CI13XXX_PAGE_SIZE;
>  		retval = -EMSGSIZE;
>  		dev_warn(mEp->ci->dev, "request length truncated\n");
>  	}
> -- 
> 1.7.10.4
> 
> 

-- 

Best Regards,
Peter Chen

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


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux