Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752743AbdI3HUm (ORCPT ); Sat, 30 Sep 2017 03:20:42 -0400 Received: from mail-pg0-f68.google.com ([74.125.83.68]:34059 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750933AbdI3HUl (ORCPT ); Sat, 30 Sep 2017 03:20:41 -0400 X-Google-Smtp-Source: AOwi7QCiLjAoTnCuF1ajHmYfFo2mPbrJKy24C6Rrw+47h6bpc8hNrXLBf22fWP30W+h/n9xmpQHBBw== 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 4/6] Staging: rtl8188eu: core: Use list_entry instead of container_of Date: Sat, 30 Sep 2017 12:50:34 +0530 Message-Id: <4fd2ea2c05b8790717ff37b0d0cb6ecd93ad2b70.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: 2833 Lines: 86 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_ap.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_ap.c b/drivers/staging/rtl8188eu/core/rtw_ap.c index 32a4837..35c03d8 100644 --- a/drivers/staging/rtl8188eu/core/rtw_ap.c +++ b/drivers/staging/rtl8188eu/core/rtw_ap.c @@ -293,7 +293,7 @@ void expire_timeout_chk(struct adapter *padapter) /* check auth_queue */ while (phead != plist) { - psta = container_of(plist, struct sta_info, auth_list); + psta = list_entry(plist, struct sta_info, auth_list); plist = plist->next; if (psta->expire_to > 0) { @@ -327,7 +327,7 @@ void expire_timeout_chk(struct adapter *padapter) /* check asoc_queue */ while (phead != plist) { - psta = container_of(plist, struct sta_info, asoc_list); + psta = list_entry(plist, struct sta_info, asoc_list); plist = plist->next; if (chk_sta_is_alive(psta) || !psta->expire_to) { @@ -1149,7 +1149,7 @@ int rtw_acl_add_sta(struct adapter *padapter, u8 *addr) 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, addr, ETH_ALEN)) { @@ -1209,7 +1209,7 @@ int rtw_acl_remove_sta(struct adapter *padapter, u8 *addr) 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, addr, ETH_ALEN)) { @@ -1456,7 +1456,7 @@ void associated_clients_update(struct adapter *padapter, u8 updated) /* check asoc_queue */ while (phead != plist) { - psta = container_of(plist, struct sta_info, asoc_list); + psta = list_entry(plist, struct sta_info, asoc_list); plist = plist->next; @@ -1728,7 +1728,7 @@ int rtw_sta_flush(struct adapter *padapter) /* free sta asoc_queue */ while (phead != plist) { - psta = container_of(plist, struct sta_info, asoc_list); + psta = list_entry(plist, struct sta_info, asoc_list); plist = plist->next; @@ -1856,7 +1856,7 @@ void stop_ap_mode(struct adapter *padapter) 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 (paclnode->valid) { -- 2.7.4