Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1742549

[PATCH 6/6] Staging: rtl8188eu: core: Use list_entry instead of container_of

From Srishti Sharma <srishtishar@gmail.com>
Newsgroups linux.kernel
Subject [PATCH 6/6] Staging: rtl8188eu: core: Use list_entry instead of container_of
Date 2017-09-30 09:30 +0200
Message-ID <uvknM-12H-29@gated-at.bofh.it> (permalink)
References <uvke5-YT-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


For variables of type struct list_head* use list_entry to access
current list element instead of using container_of. Done by the
following semantic patch by coccinelle.

@r@
struct list_head* l;
@@

-container_of
+list_entry
  (l,...)

Signed-off-by: Srishti Sharma <srishtishar@gmail.com>
---
 drivers/staging/rtl8188eu/core/rtw_xmit.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c b/drivers/staging/rtl8188eu/core/rtw_xmit.c
index be2f46e..29e9ee9 100644
--- a/drivers/staging/rtl8188eu/core/rtw_xmit.c
+++ b/drivers/staging/rtl8188eu/core/rtw_xmit.c
@@ -1401,7 +1401,7 @@ void rtw_free_xmitframe_queue(struct xmit_priv *pxmitpriv, struct __queue *pfram
 	plist = phead->next;
 
 	while (phead != plist) {
-		pxmitframe = container_of(plist, struct xmit_frame, list);
+		pxmitframe = list_entry(plist, struct xmit_frame, list);
 
 		plist = plist->next;
 
@@ -1432,7 +1432,7 @@ static struct xmit_frame *dequeue_one_xmitframe(struct xmit_priv *pxmitpriv, str
 	xmitframe_plist = xmitframe_phead->next;
 
 	if (xmitframe_phead != xmitframe_plist) {
-		pxmitframe = container_of(xmitframe_plist, struct xmit_frame, list);
+		pxmitframe = list_entry(xmitframe_plist, struct xmit_frame, list);
 
 		xmitframe_plist = xmitframe_plist->next;
 
@@ -1473,7 +1473,7 @@ struct xmit_frame *rtw_dequeue_xframe(struct xmit_priv *pxmitpriv, struct hw_xmi
 		sta_plist = sta_phead->next;
 
 		while (sta_phead != sta_plist) {
-			ptxservq = container_of(sta_plist, struct tx_servq, tx_pending);
+			ptxservq = list_entry(sta_plist, struct tx_servq, tx_pending);
 
 			pframe_queue = &ptxservq->sta_pending;
 
@@ -1811,7 +1811,7 @@ static void dequeue_xmitframes_to_sleeping_queue(struct adapter *padapter, struc
 	plist = phead->next;
 
 	while (phead != plist) {
-		pxmitframe = container_of(plist, struct xmit_frame, list);
+		pxmitframe = list_entry(plist, struct xmit_frame, list);
 
 		plist = plist->next;
 
@@ -1878,7 +1878,7 @@ void wakeup_sta_to_xmit(struct adapter *padapter, struct sta_info *psta)
 	xmitframe_plist = xmitframe_phead->next;
 
 	while (xmitframe_phead != xmitframe_plist) {
-		pxmitframe = container_of(xmitframe_plist, struct xmit_frame, list);
+		pxmitframe = list_entry(xmitframe_plist, struct xmit_frame, list);
 
 		xmitframe_plist = xmitframe_plist->next;
 
@@ -1959,7 +1959,7 @@ void wakeup_sta_to_xmit(struct adapter *padapter, struct sta_info *psta)
 		xmitframe_plist = xmitframe_phead->next;
 
 		while (xmitframe_phead != xmitframe_plist) {
-			pxmitframe = container_of(xmitframe_plist, struct xmit_frame, list);
+			pxmitframe = list_entry(xmitframe_plist, struct xmit_frame, list);
 
 			xmitframe_plist = xmitframe_plist->next;
 
@@ -2006,7 +2006,7 @@ void xmit_delivery_enabled_frames(struct adapter *padapter, struct sta_info *pst
 	xmitframe_plist = xmitframe_phead->next;
 
 	while (xmitframe_phead != xmitframe_plist) {
-		pxmitframe = container_of(xmitframe_plist, struct xmit_frame, list);
+		pxmitframe = list_entry(xmitframe_plist, struct xmit_frame, list);
 
 		xmitframe_plist = xmitframe_plist->next;
 
-- 
2.7.4

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/6] Replace container_of with list_entry Srishti Sharma <srishtishar@gmail.com> - 2017-09-30 09:20 +0200
  [PATCH 1/6] Staging: rtl8188eu: core: Use list_entry instead of container_of Srishti Sharma <srishtishar@gmail.com> - 2017-09-30 09:20 +0200
  [PATCH 2/6] Staging: rtl8188eu: core: Use list_entry instead of container_of Srishti Sharma <srishtishar@gmail.com> - 2017-09-30 09:20 +0200
  [PATCH 3/6] Staging: rtl8188eu: core: Use list_entry instead of container_of Srishti Sharma <srishtishar@gmail.com> - 2017-09-30 09:30 +0200
  [PATCH 4/6] Staging: rtl8188eu: core: Use list_entry instead of container_of Srishti Sharma <srishtishar@gmail.com> - 2017-09-30 09:30 +0200
  [PATCH 6/6] Staging: rtl8188eu: core: Use list_entry instead of container_of Srishti Sharma <srishtishar@gmail.com> - 2017-09-30 09:30 +0200
    Re: [Outreachy kernel] [PATCH 6/6] Staging: rtl8188eu: core: Use  list_entry instead of container_of Julia Lawall <julia.lawall@lip6.fr> - 2017-09-30 10:40 +0200
  [PATCH 5/6] Staging: rtl8188eu: core: Use list_entry instead of container_of Srishti Sharma <srishtishar@gmail.com> - 2017-09-30 09:30 +0200
  Re: [PATCH 0/6] Replace container_of with list_entry "Tobin C. Harding" <me@tobin.cc> - 2017-09-30 13:20 +0200

csiph-web