Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp698658rdb; Fri, 22 Dec 2023 02:15:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IGxkV0HAjCx8jglHqT4zEXIUGGfrwPWuIMs+SWs16hlkytKogxa1QuWkT7a1DS9/Mjx+cVj X-Received: by 2002:aa7:8b85:0:b0:6d9:92fc:5679 with SMTP id r5-20020aa78b85000000b006d992fc5679mr87091pfd.47.1703240115104; Fri, 22 Dec 2023 02:15:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703240115; cv=none; d=google.com; s=arc-20160816; b=xaUFvJmtAe3gtG8JpLLakz3FXhSiPkUOJT+3kdbLl5DXhHOnmr7rWKlzZQY8cSPv6q B0IYZv9xnDWZS2ULfWJyWjXhn/IzfB1rx8ECdn75l8pa5lQHED2I1j7ZNupbJ+dXQNkc RQ1LlZr7xbdKs23XsWFdyEXEqc43iYBGw6uOGw4tw9dtFvxejCm/CCLo8lIRTGryTusJ r4sqdi4ENU4cAtu/boHaHrfM0jscxu3wehNiCbZdjGe1/JGPtrYSCsdMWV/HMMEedTLm MRm+cbny9qjOfk+5h7xzAU/5AUGgnZeyqrJTOD2UEmws2PH3Mnt4iZV1n14ltUMCBbY8 OreA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:dkim-signature:dkim-signature:from; bh=YJF8OMXv6zsmzzE/WAkfo8NUsf2ylyf77tp+jhQnMpQ=; fh=KsoNWtazjfstHns8t6UZ1pulwZL69aEO39vRs0LPvyo=; b=d6huVsenlGcjryJpdOzlDhdaFFz3asuO7V3H6mEGyUNFvcPDbkBc3GXQCMb5GiT6ey x6J/qEEdj6BK6qm5Aesh6pbRJgT6xtnfMCi5iIbVhRNwfBs0Pohwc+iMgcPerNyXGBfY 6qUTbaWTHVZT/gcK2+bU2ow5+TOssqGNpc0ppWeQvxqV++RMj7Kw8dKZE56nG/mRW/7K m03aXhQQDulCE40+OI/kMdZFp5C705QS5T42Ro63TYKzcZktD+PF022Vrp2JbvxXRjvm rUJeP8n4Dcklwl05TXuGGGzzpFjXo1yGsnlVKv98TjnOmoVIsR8Qs7MTWjiUt3t1ScA6 T7lQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Hen+lErX; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-wireless+bounces-1226-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-1226-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id n3-20020a634003000000b005cdfc8a73e8si186228pga.287.2023.12.22.02.15.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 02:15:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-1226-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Hen+lErX; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-wireless+bounces-1226-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-1226-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 7E2B2283A32 for ; Fri, 22 Dec 2023 10:15:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D455817735; Fri, 22 Dec 2023 10:14:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Hen+lErX"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="QNPRPYzo" X-Original-To: linux-wireless@vger.kernel.org Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 679D6168BC for ; Fri, 22 Dec 2023 10:14:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de From: Martin Kaistra DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1703240087; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YJF8OMXv6zsmzzE/WAkfo8NUsf2ylyf77tp+jhQnMpQ=; b=Hen+lErXWbdIhirI0u/LzU4R9MdRwE6GcYeMgkPucZgHhqFgiT/aVwttOp10J1ui01slNI T4I99DXptM+mmDKUHnoLf6WZMmeX3py8EKbdsZxnXCmKY70S2wU70gRlio2nr15KocdfvQ qkMNCIOXg6ol7lb+IRhig1ZAMLwvnR6c8/9+jkI0ZLPFAPAs3vRsakcJyhPJQ8iCkC7p3x T3AYoYU96avAZIpUqweux187NDPt5siEWhy4zkm0tQY94EKfzhgRuufGgcHrum9VgctAyJ OENkzTqswyuCk1MRGahSMPfcz6y3KKD0tJGz/7aCR/ZquNPpX+utkKu8xLVNRQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1703240087; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YJF8OMXv6zsmzzE/WAkfo8NUsf2ylyf77tp+jhQnMpQ=; b=QNPRPYzoK19IJ8VhXB3fr56wY8HGAVb1i7RTQ5PMiF5YQpNdY4nN3tRjG4PwGDw2yorJDr NEOAi3Mb4W3KAlCA== To: linux-wireless@vger.kernel.org Cc: Jes Sorensen , Kalle Valo , Ping-Ke Shih , Bitterblue Smith , Sebastian Andrzej Siewior Subject: [PATCH v3 06/21] wifi: rtl8xxxu: extend wifi connected check to both interfaces Date: Fri, 22 Dec 2023 11:14:27 +0100 Message-Id: <20231222101442.626837-7-martin.kaistra@linutronix.de> In-Reply-To: <20231222101442.626837-1-martin.kaistra@linutronix.de> References: <20231222101442.626837-1-martin.kaistra@linutronix.de> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit There are multiple places in the code where the current connection status of wifi is checked. The driver will support two interfaces soon and either one of them (or both) could be connected. Convert all uses of (vif && vif->cfg.assoc) to a new helper function rtl8xxxu_is_assoc() which checks both interfaces. Signed-off-by: Martin Kaistra Reviewed-by: Ping-Ke Shih --- .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c index c2ea8e92cd637..fd6b6e2eba038 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c @@ -6043,18 +6043,20 @@ void rtl8723bu_update_bt_link_info(struct rtl8xxxu_priv *priv, u8 bt_info) btcoex->bt_busy = false; } +static inline bool rtl8xxxu_is_assoc(struct rtl8xxxu_priv *priv) +{ + return (priv->vifs[0] && priv->vifs[0]->cfg.assoc) || + (priv->vifs[1] && priv->vifs[1]->cfg.assoc); +} + static void rtl8723bu_handle_bt_inquiry(struct rtl8xxxu_priv *priv) { - struct ieee80211_vif *vif; struct rtl8xxxu_btcoex *btcoex; - bool wifi_connected; - vif = priv->vif; btcoex = &priv->bt_coex; - wifi_connected = (vif && vif->cfg.assoc); - if (!wifi_connected) { + if (!rtl8xxxu_is_assoc(priv)) { rtl8723bu_set_ps_tdma(priv, 0x8, 0x0, 0x0, 0x0, 0x0); rtl8723bu_set_coex_with_type(priv, 0); } else if (btcoex->has_sco || btcoex->has_hid || btcoex->has_a2dp) { @@ -6072,15 +6074,11 @@ void rtl8723bu_handle_bt_inquiry(struct rtl8xxxu_priv *priv) static void rtl8723bu_handle_bt_info(struct rtl8xxxu_priv *priv) { - struct ieee80211_vif *vif; struct rtl8xxxu_btcoex *btcoex; - bool wifi_connected; - vif = priv->vif; btcoex = &priv->bt_coex; - wifi_connected = (vif && vif->cfg.assoc); - if (wifi_connected) { + if (rtl8xxxu_is_assoc(priv)) { u32 val32 = 0; u32 high_prio_tx = 0, high_prio_rx = 0; @@ -7103,7 +7101,7 @@ static void rtl8xxxu_track_cfo(struct rtl8xxxu_priv *priv) int cfo_khz_a, cfo_khz_b, cfo_average; int crystal_cap; - if (!priv->vif || !priv->vif->cfg.assoc) { + if (!rtl8xxxu_is_assoc(priv)) { /* Reset */ cfo->adjust = true; -- 2.39.2