Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752632AbdI3HTw (ORCPT ); Sat, 30 Sep 2017 03:19:52 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:36487 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752240AbdI3HTv (ORCPT ); Sat, 30 Sep 2017 03:19:51 -0400 X-Google-Smtp-Source: AOwi7QC62Ge1PdBv0VhmrCcQ/zZ0M5gLCLFf841Gxkighknmul7eqkWDgKX4KmBNNigw4BD2uYwfyg== 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 2/6] Staging: rtl8188eu: core: Use list_entry instead of container_of Date: Sat, 30 Sep 2017 12:49:45 +0530 Message-Id: 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: 2282 Lines: 70 For variables of the type 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_sta_mgt.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c index 22cf362..f9df4ac 100644 --- a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c +++ b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c @@ -152,8 +152,8 @@ u32 _rtw_free_sta_priv(struct sta_priv *pstapriv) while (phead != plist) { int i; - psta = container_of(plist, struct sta_info, - hash_list); + psta = list_entry(plist, struct sta_info, + hash_list); plist = plist->next; for (i = 0; i < 16; i++) { @@ -323,7 +323,7 @@ u32 rtw_free_stainfo(struct adapter *padapter, struct sta_info *psta) plist = phead->next; while (!list_empty(phead)) { - prframe = container_of(plist, struct recv_frame, list); + prframe = list_entry(plist, struct recv_frame, list); plist = plist->next; @@ -399,7 +399,7 @@ void rtw_free_all_stainfo(struct adapter *padapter) plist = phead->next; while (phead != plist) { - psta = container_of(plist, struct sta_info, hash_list); + psta = list_entry(plist, struct sta_info, hash_list); plist = plist->next; @@ -435,7 +435,7 @@ struct sta_info *rtw_get_stainfo(struct sta_priv *pstapriv, u8 *hwaddr) plist = phead->next; while (phead != plist) { - psta = container_of(plist, struct sta_info, hash_list); + psta = list_entry(plist, struct sta_info, hash_list); if ((!memcmp(psta->hwaddr, addr, ETH_ALEN)) == true) { /* if found the matched address */ @@ -493,7 +493,7 @@ u8 rtw_access_ctrl(struct adapter *padapter, u8 *mac_addr) phead = get_list_head(pacl_node_q); plist = phead->next; while (phead != plist) { - paclnode = container_of(plist, struct rtw_wlan_acl_node, list); + paclnode = list_entry(plist, struct rtw_wlan_acl_node, list); plist = plist->next; if (!memcmp(paclnode->addr, mac_addr, ETH_ALEN)) { -- 2.7.4