staging: emxx_udc: use list_first_entry_or_null()
Simplify the code with list_first_entry_or_null(). Signed-off-by: Geliang Tang <geliangtang@163.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
e7cfb3907d
commit
e59ac74794
|
@ -1285,11 +1285,7 @@ static void _nbu2ss_restert_transfer(struct nbu2ss_ep *ep)
|
||||||
bool bflag = FALSE;
|
bool bflag = FALSE;
|
||||||
struct nbu2ss_req *req;
|
struct nbu2ss_req *req;
|
||||||
|
|
||||||
if (list_empty(&ep->queue))
|
req = list_first_entry_or_null(&ep->queue, struct nbu2ss_req, queue);
|
||||||
req = NULL;
|
|
||||||
else
|
|
||||||
req = list_entry(ep->queue.next, struct nbu2ss_req, queue);
|
|
||||||
|
|
||||||
if (!req)
|
if (!req)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1784,11 +1780,7 @@ static inline int _nbu2ss_ep0_in_data_stage(struct nbu2ss_udc *udc)
|
||||||
struct nbu2ss_req *req;
|
struct nbu2ss_req *req;
|
||||||
struct nbu2ss_ep *ep = &udc->ep[0];
|
struct nbu2ss_ep *ep = &udc->ep[0];
|
||||||
|
|
||||||
if (list_empty(&ep->queue))
|
req = list_first_entry_or_null(&ep->queue, struct nbu2ss_req, queue);
|
||||||
req = NULL;
|
|
||||||
else
|
|
||||||
req = list_entry(ep->queue.next, struct nbu2ss_req, queue);
|
|
||||||
|
|
||||||
if (!req)
|
if (!req)
|
||||||
req = &udc->ep0_req;
|
req = &udc->ep0_req;
|
||||||
|
|
||||||
|
@ -1811,11 +1803,7 @@ static inline int _nbu2ss_ep0_out_data_stage(struct nbu2ss_udc *udc)
|
||||||
struct nbu2ss_req *req;
|
struct nbu2ss_req *req;
|
||||||
struct nbu2ss_ep *ep = &udc->ep[0];
|
struct nbu2ss_ep *ep = &udc->ep[0];
|
||||||
|
|
||||||
if (list_empty(&ep->queue))
|
req = list_first_entry_or_null(&ep->queue, struct nbu2ss_req, queue);
|
||||||
req = NULL;
|
|
||||||
else
|
|
||||||
req = list_entry(ep->queue.next, struct nbu2ss_req, queue);
|
|
||||||
|
|
||||||
if (!req)
|
if (!req)
|
||||||
req = &udc->ep0_req;
|
req = &udc->ep0_req;
|
||||||
|
|
||||||
|
@ -1838,11 +1826,7 @@ static inline int _nbu2ss_ep0_status_stage(struct nbu2ss_udc *udc)
|
||||||
struct nbu2ss_req *req;
|
struct nbu2ss_req *req;
|
||||||
struct nbu2ss_ep *ep = &udc->ep[0];
|
struct nbu2ss_ep *ep = &udc->ep[0];
|
||||||
|
|
||||||
if (list_empty(&ep->queue))
|
req = list_first_entry_or_null(&ep->queue, struct nbu2ss_req, queue);
|
||||||
req = NULL;
|
|
||||||
else
|
|
||||||
req = list_entry(ep->queue.next, struct nbu2ss_req, queue);
|
|
||||||
|
|
||||||
if (!req) {
|
if (!req) {
|
||||||
req = &udc->ep0_req;
|
req = &udc->ep0_req;
|
||||||
if (req->req.complete)
|
if (req->req.complete)
|
||||||
|
@ -2145,11 +2129,7 @@ static inline void _nbu2ss_epn_int(struct nbu2ss_udc *udc, u32 epnum)
|
||||||
/* Interrupt Clear */
|
/* Interrupt Clear */
|
||||||
_nbu2ss_writel(&udc->p_regs->EP_REGS[num].EP_STATUS, ~(u32)status);
|
_nbu2ss_writel(&udc->p_regs->EP_REGS[num].EP_STATUS, ~(u32)status);
|
||||||
|
|
||||||
if (list_empty(&ep->queue))
|
req = list_first_entry_or_null(&ep->queue, struct nbu2ss_req, queue);
|
||||||
req = NULL;
|
|
||||||
else
|
|
||||||
req = list_entry(ep->queue.next, struct nbu2ss_req, queue);
|
|
||||||
|
|
||||||
if (!req) {
|
if (!req) {
|
||||||
/* pr_warn("=== %s(%d) req == NULL\n", __func__, epnum); */
|
/* pr_warn("=== %s(%d) req == NULL\n", __func__, epnum); */
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue