Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751952AbdI3HTa (ORCPT ); Sat, 30 Sep 2017 03:19:30 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:36413 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751439AbdI3HT3 (ORCPT ); Sat, 30 Sep 2017 03:19:29 -0400 X-Google-Smtp-Source: AOwi7QBIsJVXmD9x/VaoZWfvk7EKSlljRy8I/2SEtHyBsAEbaxZz64QeIqngKD5ooXxuwiH1OSLDvQ== From: Srishti Sharma To: gregkh@linuxfoundation.org Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, outreachy-kernel@googlegroups.com, Srishti Sharma Subject: [PATCH 1/6] Staging: rtl8188eu: core: Use list_entry instead of container_of Date: Sat, 30 Sep 2017 12:49:23 +0530 Message-Id: <1b48743cd17da785302163fd522e9d2e04710bad.1506755265.git.srishtishar@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3060 Lines: 86 For variables of the struct list_head* use list_entry to access current list element instead of using container_of. Done using the following semantic patch by coccinelle. @r@ struct list_head* l; @@ -container_of +list_entry (l,...) Signed-off-by: Srishti Sharma --- drivers/staging/rtl8188eu/core/rtw_recv.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c b/drivers/staging/rtl8188eu/core/rtw_recv.c index 3fd5f41..af59c16 100644 --- a/drivers/staging/rtl8188eu/core/rtw_recv.c +++ b/drivers/staging/rtl8188eu/core/rtw_recv.c @@ -193,7 +193,7 @@ void rtw_free_recvframe_queue(struct __queue *pframequeue, struct __queue *pfre plist = phead->next; while (phead != plist) { - hdr = container_of(plist, struct recv_frame, list); + hdr = list_entry(plist, struct recv_frame, list); plist = plist->next; @@ -943,7 +943,7 @@ static int validate_recv_ctrl_frame(struct adapter *padapter, 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; @@ -1347,7 +1347,7 @@ static struct recv_frame *recvframe_defrag(struct adapter *adapter, phead = get_list_head(defrag_q); plist = phead->next; - pfhdr = container_of(plist, struct recv_frame, list); + pfhdr = list_entry(plist, struct recv_frame, list); prframe = pfhdr; list_del_init(&(prframe->list)); @@ -1367,7 +1367,7 @@ static struct recv_frame *recvframe_defrag(struct adapter *adapter, plist = plist->next; while (phead != plist) { - pnfhdr = container_of(plist, struct recv_frame, list); + pnfhdr = list_entry(plist, struct recv_frame, list); pnextrframe = pnfhdr; /* check the fragment sequence (2nd ~n fragment frame) */ @@ -1655,7 +1655,7 @@ static int enqueue_reorder_recvframe(struct recv_reorder_ctrl *preorder_ctrl, plist = phead->next; while (phead != plist) { - hdr = container_of(plist, struct recv_frame, list); + hdr = list_entry(plist, struct recv_frame, list); pnextattrib = &hdr->attrib; if (SN_LESS(pnextattrib->seq_num, pattrib->seq_num)) @@ -1690,7 +1690,7 @@ static int recv_indicatepkts_in_order(struct adapter *padapter, struct recv_reor if (list_empty(phead)) return true; - prhdr = container_of(plist, struct recv_frame, list); + prhdr = list_entry(plist, struct recv_frame, list); pattrib = &prhdr->attrib; preorder_ctrl->indicate_seq = pattrib->seq_num; } @@ -1698,7 +1698,7 @@ static int recv_indicatepkts_in_order(struct adapter *padapter, struct recv_reor /* Prepare indication list and indication. */ /* Check if there is any packet need indicate. */ while (!list_empty(phead)) { - prhdr = container_of(plist, struct recv_frame, list); + prhdr = list_entry(plist, struct recv_frame, list); prframe = prhdr; pattrib = &prframe->attrib; -- 2.7.4