From patchwork Tue Nov 29 20:51:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 27503 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp567315wrr; Tue, 29 Nov 2022 13:06:22 -0800 (PST) X-Google-Smtp-Source: AA0mqf4VppYJf5qO7cVg07vyIqmBTsERo9eUuUfUo3S6lHUDbN9rpD0uEx9vIF7P8vroPD5bGfPJ X-Received: by 2002:a17:902:b40b:b0:188:75bb:36d4 with SMTP id x11-20020a170902b40b00b0018875bb36d4mr40170098plr.55.1669755982308; Tue, 29 Nov 2022 13:06:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669755982; cv=none; d=google.com; s=arc-20160816; b=Xh9zJ4Vfm8QQWjIecsbWwj+Er1iYi4qnEsXqivt9K+BSKz1FnIfgu//nq+QWXu72Ld VkfQ1Ma3BEJceSI4orGMqv5Ni5OYjsJoTiU7BGww3opTe5EwgOJvod6fZiVWz2o+Yhxl DpwfaKRhkW9rCJOHutZHvBIm7BSumrJwPEVr87FEhOHHTfji6zQ7vkkiKoqlQj7emrYT T2D1UL5F1bfOym+xBNQsFaOeR1WsRRZbo8ME4jdR8LHdyce3k25aMtxwp49cOsNOB/u8 ggW4sTROJX8pMMjteqzqkiov59rt4/ZRN7Jan2K5Faq5RVUljxtjZjVaWWb8utHmMXT6 uyzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=BNA1E/NA02d1ETmTBkm/Ggf9scxIq2GGBJ6E/n0Vc4c=; b=jOcu+8Kb65JHnIKH3+k4Ib/+Qrw+ZdrDojXCdrLhST4Yd3m/iSekw3VuGej3JCWJOU j6xN+5cg6Vr4ayY0dDPnXi06HhlClAYA9ZVTZaJkP881znTVwCLHx3cBFSYee0fh67KX kybYVHKxH+zsbPydQAqLVzhe5XFypBTEBPw66Vq/ityWLg3rJjeRRUhlB/j/CdIH1Bzv 3gQMLNbYdz1uyxYlO/XGbFiciqv7knre7Xly6vHzk8ZaCIwfqzWIMbtP7dn66op5JM7y bX38H9ap1RSlZdBuX6ffDu57NvxogAyMAsE8H8iOY7zyWJfEhOAcN57cgSCKIRkMSL++ OyrQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e128-20020a636986000000b00476e62744a8si15675505pgc.388.2022.11.29.13.06.07; Tue, 29 Nov 2022 13:06:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236689AbiK2Uwb (ORCPT + 99 others); Tue, 29 Nov 2022 15:52:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236509AbiK2UwX (ORCPT ); Tue, 29 Nov 2022 15:52:23 -0500 Received: from viti.kaiser.cx (viti.kaiser.cx [IPv6:2a01:238:43fe:e600:cd0c:bd4a:7a3:8e9f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C29B5FE7 for ; Tue, 29 Nov 2022 12:52:22 -0800 (PST) Received: from dslb-188-104-061-001.188.104.pools.vodafone-ip.de ([188.104.61.1] helo=martin-debian-2.paytec.ch) by viti.kaiser.cx with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1p07aT-0001pO-0u; Tue, 29 Nov 2022 21:52:17 +0100 From: Martin Kaiser To: Greg Kroah-Hartman Cc: Larry Finger , Phillip Potter , Michael Straube , Pavel Skripkin , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH 4/5] staging: r8188eu: handle the non-ap case first Date: Tue, 29 Nov 2022 21:51:51 +0100 Message-Id: <20221129205152.128172-5-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221129205152.128172-1-martin@kaiser.cx> References: <20221129205152.128172-1-martin@kaiser.cx> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750866048433898093?= X-GMAIL-MSGID: =?utf-8?q?1750866048433898093?= The OnDisassoc function hasn't got much to do if we're not working as an access point. Move this case out of the large if statement to simplify the code. Signed-off-by: Martin Kaiser --- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 36 ++++++++++----------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c index dd1e0b4fc5a0..d5c9eb52fb0e 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -1433,6 +1433,8 @@ static void OnDisassoc(struct adapter *padapter, struct recv_frame *precv_frame) struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; struct wifidirect_info *pwdinfo = &padapter->wdinfo; + struct sta_info *psta; + struct sta_priv *pstapriv = &padapter->stapriv; if (memcmp(mgmt->bssid, get_my_bssid(&pmlmeinfo->network), ETH_ALEN)) return; @@ -1444,29 +1446,25 @@ static void OnDisassoc(struct adapter *padapter, struct recv_frame *precv_frame) reason = le16_to_cpu(mgmt->u.disassoc.reason_code); - if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { - struct sta_info *psta; - struct sta_priv *pstapriv = &padapter->stapriv; - - psta = rtw_get_stainfo(pstapriv, mgmt->sa); - if (psta) { - u8 updated = 0; + if (!check_fwstate(pmlmepriv, WIFI_AP_STATE)) { + receive_disconnect(padapter, mgmt->bssid, reason); + pmlmepriv->LinkDetectInfo.bBusyTraffic = false; + return; + } - spin_lock_bh(&pstapriv->asoc_list_lock); - if (!list_empty(&psta->asoc_list)) { - list_del_init(&psta->asoc_list); - pstapriv->asoc_list_cnt--; - updated = ap_free_sta(padapter, psta, false, reason); - } - spin_unlock_bh(&pstapriv->asoc_list_lock); + psta = rtw_get_stainfo(pstapriv, mgmt->sa); + if (psta) { + u8 updated = 0; - associated_clients_update(padapter, updated); + spin_lock_bh(&pstapriv->asoc_list_lock); + if (!list_empty(&psta->asoc_list)) { + list_del_init(&psta->asoc_list); + pstapriv->asoc_list_cnt--; + updated = ap_free_sta(padapter, psta, false, reason); } + spin_unlock_bh(&pstapriv->asoc_list_lock); - return; - } else { - receive_disconnect(padapter, mgmt->bssid, reason); - pmlmepriv->LinkDetectInfo.bBusyTraffic = false; + associated_clients_update(padapter, updated); } }