aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeliang Tang <geliangtang@163.com>2015-11-16 08:54:46 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-12-21 21:32:52 -0500
commite59ac747946693b1356d576f843ce8ac1e283927 (patch)
tree1127226be49fe5f7d9ab150166fb96d1bd7eb384
parente7cfb3907d1c88cea8977fa267149cb2297fb07e (diff)
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>
-rw-r--r--drivers/staging/emxx_udc/emxx_udc.c30
1 files changed, 5 insertions, 25 deletions
diff --git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c
index c168845cbb91..beb9411658ba 100644
--- a/drivers/staging/emxx_udc/emxx_udc.c
+++ b/drivers/staging/emxx_udc/emxx_udc.c
@@ -1285,11 +1285,7 @@ static void _nbu2ss_restert_transfer(struct nbu2ss_ep *ep)
1285 bool bflag = FALSE; 1285 bool bflag = FALSE;
1286 struct nbu2ss_req *req; 1286 struct nbu2ss_req *req;
1287 1287
1288 if (list_empty(&ep->queue)) 1288 req = list_first_entry_or_null(&ep->queue, struct nbu2ss_req, queue);
1289 req = NULL;
1290 else
1291 req = list_entry(ep->queue.next, struct nbu2ss_req, queue);
1292
1293 if (!req) 1289 if (!req)
1294 return; 1290 return;
1295 1291
@@ -1784,11 +1780,7 @@ static inline int _nbu2ss_ep0_in_data_stage(struct nbu2ss_udc *udc)
1784 struct nbu2ss_req *req; 1780 struct nbu2ss_req *req;
1785 struct nbu2ss_ep *ep = &udc->ep[0]; 1781 struct nbu2ss_ep *ep = &udc->ep[0];
1786 1782
1787 if (list_empty(&ep->queue)) 1783 req = list_first_entry_or_null(&ep->queue, struct nbu2ss_req, queue);
1788 req = NULL;
1789 else
1790 req = list_entry(ep->queue.next, struct nbu2ss_req, queue);
1791
1792 if (!req) 1784 if (!req)
1793 req = &udc->ep0_req; 1785 req = &udc->ep0_req;
1794 1786
@@ -1811,11 +1803,7 @@ static inline int _nbu2ss_ep0_out_data_stage(struct nbu2ss_udc *udc)
1811 struct nbu2ss_req *req; 1803 struct nbu2ss_req *req;
1812 struct nbu2ss_ep *ep = &udc->ep[0]; 1804 struct nbu2ss_ep *ep = &udc->ep[0];
1813 1805
1814 if (list_empty(&ep->queue)) 1806 req = list_first_entry_or_null(&ep->queue, struct nbu2ss_req, queue);
1815 req = NULL;
1816 else
1817 req = list_entry(ep->queue.next, struct nbu2ss_req, queue);
1818
1819 if (!req) 1807 if (!req)
1820 req = &udc->ep0_req; 1808 req = &udc->ep0_req;
1821 1809
@@ -1838,11 +1826,7 @@ static inline int _nbu2ss_ep0_status_stage(struct nbu2ss_udc *udc)
1838 struct nbu2ss_req *req; 1826 struct nbu2ss_req *req;
1839 struct nbu2ss_ep *ep = &udc->ep[0]; 1827 struct nbu2ss_ep *ep = &udc->ep[0];
1840 1828
1841 if (list_empty(&ep->queue)) 1829 req = list_first_entry_or_null(&ep->queue, struct nbu2ss_req, queue);
1842 req = NULL;
1843 else
1844 req = list_entry(ep->queue.next, struct nbu2ss_req, queue);
1845
1846 if (!req) { 1830 if (!req) {
1847 req = &udc->ep0_req; 1831 req = &udc->ep0_req;
1848 if (req->req.complete) 1832 if (req->req.complete)
@@ -2145,11 +2129,7 @@ static inline void _nbu2ss_epn_int(struct nbu2ss_udc *udc, u32 epnum)
2145 /* Interrupt Clear */ 2129 /* Interrupt Clear */
2146 _nbu2ss_writel(&udc->p_regs->EP_REGS[num].EP_STATUS, ~(u32)status); 2130 _nbu2ss_writel(&udc->p_regs->EP_REGS[num].EP_STATUS, ~(u32)status);
2147 2131
2148 if (list_empty(&ep->queue)) 2132 req = list_first_entry_or_null(&ep->queue, struct nbu2ss_req, queue);
2149 req = NULL;
2150 else
2151 req = list_entry(ep->queue.next, struct nbu2ss_req, queue);
2152
2153 if (!req) { 2133 if (!req) {
2154 /* pr_warn("=== %s(%d) req == NULL\n", __func__, epnum); */ 2134 /* pr_warn("=== %s(%d) req == NULL\n", __func__, epnum); */
2155 return; 2135 return;