Michael Grzeschik <m.grzesc...@pengutronix.de> writes:

> This patch changes the read of the td status to one atomic operation to
> analyse coherent bits.
>
> Signed-off-by: Michael Grzeschik <m.grzesc...@pengutronix.de>
> ---
>  drivers/usb/chipidea/udc.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
> index 21e1dd6..19fc185 100644
> --- a/drivers/usb/chipidea/udc.c
> +++ b/drivers/usb/chipidea/udc.c
> @@ -495,10 +495,12 @@ done:
>   */
>  static int _hardware_dequeue(struct ci13xxx_ep *mEp, struct ci13xxx_req 
> *mReq)
>  {
> +     u32 tmptoken = cpu_to_le32(mReq->ptr->token);

This should really be le32_to_cpu(), since you're reading.

[..]

> @@ -512,7 +514,7 @@ static int _hardware_dequeue(struct ci13xxx_ep *mEp, 
> struct ci13xxx_req *mReq)
>  
>       usb_gadget_unmap_request(&mEp->ci->gadget, &mReq->req, mEp->dir);
>  
> -     mReq->req.status = le32_to_cpu(mReq->ptr->token) & TD_STATUS;

Like it was here, for example.

> +     mReq->req.status = tmptoken & TD_STATUS;
>       if ((TD_STATUS_HALTED & mReq->req.status) != 0)
>               mReq->req.status = -1;
>       else if ((TD_STATUS_DT_ERR & mReq->req.status) != 0)
> @@ -520,7 +522,7 @@ static int _hardware_dequeue(struct ci13xxx_ep *mEp, 
> struct ci13xxx_req *mReq)
>       else if ((TD_STATUS_TR_ERR & mReq->req.status) != 0)
>               mReq->req.status = -1;
>  
> -     mReq->req.actual   = le32_to_cpu(mReq->ptr->token) & TD_TOTAL_BYTES;
> +     mReq->req.actual   = tmptoken & TD_TOTAL_BYTES;
>       mReq->req.actual >>= __ffs(TD_TOTAL_BYTES);
>       mReq->req.actual   = mReq->req.length - mReq->req.actual;
>       mReq->req.actual   = mReq->req.status ? 0 : mReq->req.actual;
> -- 
> 1.8.2.rc2
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to