Re: [PATCH 1/2] usb: dwc3: gadget: Simplify skipping of link TRBs

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

 



Hi,

John Youn <johnyoun@xxxxxxxxxxxx> writes:
> Make the skipping of the link TRBS build-in to the increment and
> decrement operations. This simplifies the code wherever we increment and
> decrement and ensures that we never end up pointing to a link trb.
>
> Signed-off-by: John Youn <johnyoun@xxxxxxxxxxxx>

I had this in my TODO for today :-) Glad I don't have to do it :-p

> ---
>  drivers/usb/dwc3/gadget.c | 26 +++++++++-----------------
>  1 file changed, 9 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> index 8629b60..3eaef22 100644
> --- a/drivers/usb/dwc3/gadget.c
> +++ b/drivers/usb/dwc3/gadget.c
> @@ -145,21 +145,23 @@ int dwc3_gadget_set_link_state(struct dwc3 *dwc, enum dwc3_link_state state)
>  	return -ETIMEDOUT;
>  }
>  
> +static bool dwc3_ep_is_last_trb(unsigned int index)
> +{
> +	return index == (DWC3_TRB_NUM - 1);
> +}
> +
>  static void dwc3_ep_inc_enq(struct dwc3_ep *dep)
>  {
>  	dep->trb_enqueue++;
> -	dep->trb_enqueue %= DWC3_TRB_NUM;

I would really like to keep the comment about skipping link TRB here.

-- 
balbi

Attachment: signature.asc
Description: PGP signature


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

  Powered by Linux