Skip to contentSkip to conversation

Staging: rtl8192e: Use list_first_entry instead of list_entry

PATCH In review Bhumika Goyal 2 participants 2 messages Mar 6, 2016 – Mar 7, 2016 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: rtl8192e: Use list_first_entry instead of list_entry

This patch replaces list_entry with list_first_entry as it makes the code more clear.
Done using coccinelle:

@@
expression e;
@@
(
- list_entry(e->next,
+ list_first_entry(e,
...)
|
- list_entry(e->prev,
+ list_last_entry(e,
...)
)

---
 drivers/staging/rtl8192e/rtl819x_TSProc.c | 2 +-
 drivers/staging/rtl8192e/rtllib_rx.c      | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/staging/rtl8192e/rtl819x_TSProc.c +1 -1
index 2c8a526..22ee936 100644
@@ -371,7 +371,7 @@ bool GetTs(struct rtllib_device *ieee, struct ts_common_info **ppTS,
 				((TxRxSelect == TX_DIR) ? DIR_UP : DIR_DOWN);
 
 	if (!list_empty(pUnusedList)) {
-		(*ppTS) = list_entry(pUnusedList->next,
+		(*ppTS) = list_first_entry(pUnusedList,
 			  struct ts_common_info, List);
 		list_del_init(&(*ppTS)->List);
 		if (TxRxSelect == TX_DIR) {
drivers/staging/rtl8192e/rtllib_rx.c +2 -2
index af64bd3..5893005 100644
@@ -461,11 +461,11 @@ static bool AddReorderEntry(struct rx_ts_record *pTS,
 
 	while (pList->next != &pTS->RxPendingPktList) {
 		if (SN_LESS(pReorderEntry->SeqNum, ((struct rx_reorder_entry *)
-		    list_entry(pList->next, struct rx_reorder_entry,
+		    list_first_entry(pList, struct rx_reorder_entry,
 		    List))->SeqNum))
 			pList = pList->next;
 		else if (SN_EQUAL(pReorderEntry->SeqNum,
-			((struct rx_reorder_entry *)list_entry(pList->next,
+			((struct rx_reorder_entry *)list_first_entry(pList,
 			struct rx_reorder_entry, List))->SeqNum))
 				return false;
 		else
Signature · 1 line
1.9.1
#1 lore raw
Quoted 41 lines · Bhumika Goyal

This patch replaces list_entry with list_first_entry as it makes the code more clear.
Done using coccinelle:

@@
expression e;
@@
(
- list_entry(e->next,
+ list_first_entry(e,
...)
|
- list_entry(e->prev,
+ list_last_entry(e,
...)
)

---
 drivers/staging/rtl8192e/rtl819x_TSProc.c | 2 +-
 drivers/staging/rtl8192e/rtllib_rx.c      | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/staging/rtl8192e/rtl819x_TSProc.c +1 -1
index 2c8a526..22ee936 100644
@@ -371,7 +371,7 @@ bool GetTs(struct rtllib_device *ieee, struct ts_common_info **ppTS,
 				((TxRxSelect == TX_DIR) ? DIR_UP : DIR_DOWN);
 
 	if (!list_empty(pUnusedList)) {
-		(*ppTS) = list_entry(pUnusedList->next,
+		(*ppTS) = list_first_entry(pUnusedList,
 			  struct ts_common_info, List);
 		list_del_init(&(*ppTS)->List);
 		if (TxRxSelect == TX_DIR) {
drivers/staging/rtl8192e/rtllib_rx.c +0 -0
index af64bd3..5893005 100644

drivers/staging/rtl8192e/rtllib_rx.c static bool AddReorderEntry(struct rx_ts_record *pTS, · line 462

Quoted 2 lines
drivers/staging/rtl8192e/rtllib_rx.c +0 -0
@@ -461,11 +461,11 @@ static bool AddReorderEntry(struct rx_ts_record *pTS,
 
 	while (pList->next != &pTS->RxPendingPktList) {

Is this a list_for_each in disguise?

julia

Quoted 21 lines
drivers/staging/rtl8192e/rtllib_rx.c +2 -3
 		if (SN_LESS(pReorderEntry->SeqNum, ((struct rx_reorder_entry *)
-		    list_entry(pList->next, struct rx_reorder_entry,
+		    list_first_entry(pList, struct rx_reorder_entry,
 		    List))->SeqNum))
 			pList = pList->next;
 		else if (SN_EQUAL(pReorderEntry->SeqNum,
-			((struct rx_reorder_entry *)list_entry(pList->next,
+			((struct rx_reorder_entry *)list_first_entry(pList,
 			struct rx_reorder_entry, List))->SeqNum))
 				return false;
 		else
--

1.9.1

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1457278585-16295-1-git-send-email-bhumirks%40gmail.com.
For more options, visit https://groups.google.com/d/optout.