summaryrefslogtreecommitdiff
path: root/drivers/staging/rtl8188eu/core/rtw_recv.c
diff options
context:
space:
mode:
authorGeliang Tang <geliangtang@163.com>2016-02-01 22:37:13 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-02-07 19:00:46 -0800
commitb9f1c275b695ff9339cfd0c2ea841f53d4205611 (patch)
tree9e8eb01f88f6764d23d5388234cf3ce646342bc0 /drivers/staging/rtl8188eu/core/rtw_recv.c
parenta67080ee826467cbcb9691418126607bb0d1e33e (diff)
staging: rtl8188eu: use list_first_entry_or_null()
Use list_first_entry_or_null() instead of list_empty() + container_of() to simplify the code. Signed-off-by: Geliang Tang <geliangtang@163.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/rtl8188eu/core/rtw_recv.c')
-rw-r--r--drivers/staging/rtl8188eu/core/rtw_recv.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c b/drivers/staging/rtl8188eu/core/rtw_recv.c
index 3f03999b4d22..c81639cae1ea 100644
--- a/drivers/staging/rtl8188eu/core/rtw_recv.c
+++ b/drivers/staging/rtl8188eu/core/rtw_recv.c
@@ -127,22 +127,15 @@ void _rtw_free_recv_priv(struct recv_priv *precvpriv)
struct recv_frame *_rtw_alloc_recvframe(struct __queue *pfree_recv_queue)
{
struct recv_frame *hdr;
- struct list_head *plist, *phead;
struct adapter *padapter;
struct recv_priv *precvpriv;
- if (list_empty(&pfree_recv_queue->queue)) {
- hdr = NULL;
- } else {
- phead = get_list_head(pfree_recv_queue);
-
- plist = phead->next;
-
- hdr = container_of(plist, struct recv_frame, list);
-
+ hdr = list_first_entry_or_null(&pfree_recv_queue->queue,
+ struct recv_frame, list);
+ if (hdr) {
list_del_init(&hdr->list);
padapter = hdr->adapter;
- if (padapter != NULL) {
+ if (padapter) {
precvpriv = &padapter->recvpriv;
if (pfree_recv_queue == &precvpriv->free_recv_queue)
precvpriv->free_recvframe_cnt--;