diff options
author | Michael Grzeschik <m.grzeschik@pengutronix.de> | 2013-03-30 14:54:07 +0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-03-30 19:20:48 +0400 |
commit | 9e5064384a69e6dac15e3ba8590355ec844e47b5 (patch) | |
tree | 16a05cdebd3702506e6532bc4e57eb8dbeece2e6 | |
parent | 776ffc16b74a5c19285135cfbc6dd02e1c733f25 (diff) | |
download | linux-9e5064384a69e6dac15e3ba8590355ec844e47b5.tar.xz |
usb: chipidea: udc: read status of td only once in hardware_dequeue
This patch changes the read of the td status to one atomic operation to
analyse coherent bits.
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
[Alex: fixed backwards endianness conversion]
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/usb/chipidea/udc.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index 94af0208dab8..20a5b79f58f8 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c @@ -481,10 +481,12 @@ done: */ static int _hardware_dequeue(struct ci13xxx_ep *mEp, struct ci13xxx_req *mReq) { + u32 tmptoken = le32_to_cpu(mReq->ptr->token); + if (mReq->req.status != -EALREADY) return -EINVAL; - if ((cpu_to_le32(TD_STATUS_ACTIVE) & mReq->ptr->token) != 0) + if ((TD_STATUS_ACTIVE & tmptoken) != 0) return -EBUSY; if (mReq->zptr) { @@ -498,7 +500,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; + 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) @@ -506,7 +508,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; |