From patchwork Sat Jun 5 01:11:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 454680 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp889565jae; Fri, 4 Jun 2021 18:11:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyGhlitmbXzfoswplAOVGIAtROSSAeN5wm6CRak95qwjfm+yZsgD9wxnZcrCKjfurvwgWn/ X-Received: by 2002:a05:6402:138c:: with SMTP id b12mr7752427edv.268.1622855471136; Fri, 04 Jun 2021 18:11:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622855471; cv=none; d=google.com; s=arc-20160816; b=ierNnWxyeT+atSq4/kdbG6npxTAc1TEiBousgQsQaG1aonMC6J6jyhYIsXvixaw263 BRzr0ZZyEAu6yYiaNv4lL01yCEBT+OAc27CRQeSX9acBD2rdJu9gonSnccp3NnagnPKk U/qjWvkpTzLn/GbwTVtq8O5307paIVOvhGL8i4YtQEOBG1CW17Dh5CHTqT0BwiJBne/Q /6Se0MkcrE8G4SkCsRy2ItAzw4HczHwrr2ayoMVuDkMU3/ShfgyuYtlUQVn8W3WWPevA dXrKsJ+s3R6jODhjJ4EWaMVGxF4DMNgmBMJ/3rkOaTr9eQY2aFEY7KrxUb7vzN6o5IQY U/xw== 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 :dkim-signature; bh=BDB2CUDPDaolV/e1QpwHthEeMSH5hthfQ21cne8mw4A=; b=iKgefo2duBFu0uEGrnWEvZkjvqXeXHYIbYqDBVVtlm3aF6VCHsQn2DVCo0oj2EfaPZ YjGY/UE8l7h80wd7PPMl+nS6tKqVLm3PpDTpTt0E1kM6OLxkRHKmCNE/h9pFpEtIebIU 2kNxrPRZ/LRoTE8WfXhAcwvtwPJetwuQje+abJWypsmk+6Xn3J2AnOJtuT0R3ObFsWK3 f7OYZUJ0TCzzoR0r5NyZ0JZAkIsNUr2ow/gyVJiIyzm0dXnPCwu64imfzF1xvxdzn9dj 82THepbygfxu2jApwB97w6HLwapSjqyY+bnNqag79nSKmrN1id0uys2j76BHAEzFrrxS 7cCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="NF/cwqZ6"; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dd18si5855665edb.445.2021.06.04.18.11.10; Fri, 04 Jun 2021 18:11:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="NF/cwqZ6"; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231229AbhFEBM4 (ORCPT + 2 others); Fri, 4 Jun 2021 21:12:56 -0400 Received: from mail-wr1-f41.google.com ([209.85.221.41]:35480 "EHLO mail-wr1-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230414AbhFEBM4 (ORCPT ); Fri, 4 Jun 2021 21:12:56 -0400 Received: by mail-wr1-f41.google.com with SMTP id m18so10946281wrv.2 for ; Fri, 04 Jun 2021 18:10:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=BDB2CUDPDaolV/e1QpwHthEeMSH5hthfQ21cne8mw4A=; b=NF/cwqZ6Ubzo4pV7cu65rgWcEdGWB5wymDbcsQuIkGi1LgTpPDlHB6xbU2iNhV5xlV kvM/jq/ftKX/i/VyuGuabC1wuhZUgS5Lpa38uAeYJidXWACYL2od97F+9rwlE/MA/kLf F9TJGKTKDLaeTSm7bAGeNnTdMKcJL92sDZ6Ch1d+IchWYXj6DAnTISWsWOYOF3YhK74z EBXf3JD5MidAa65Ox9hz81o3F/mWNueCDzKbz/znvGghjOwNrVURbm7d1mu9AxVKBLdB kAlC/elIkXNVcIr9kAlvm3np71E+O1FDnY7ZmR6ESSeBjIvAuQXGkZg7iZeLKbOIYQj4 zR/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BDB2CUDPDaolV/e1QpwHthEeMSH5hthfQ21cne8mw4A=; b=pyXiB9kn+7b6X9NARdLPMIeNkUmE63yOtokGkuQ1vgYHZzxKEUYzFczWGoEYV7eDkX 715JGorRXgw8YfiG3WBdMag6+UwpoDZEagZDspUgqmmeBW/ymBKIKKDLbaSjqJMPxZJo D0tHu5BrnWvKZ9dD5qPhKQzSCEfv5KviOsRc7BHb9yyOgOB1uN0rpRxCxqu91wkaFAHx kecxyB7cMb2pgksyJA8wjWQRjLXmEmY5X+j7FYen398ELiMeRbW9mk5rkttzeDavpxeR 2+MBDdnvJksrTMOU4fcoWX5r6v60E5zNXnPJyoR1Bq98aW2+7dokTdjmAGntywKRDs3A HdCQ== X-Gm-Message-State: AOAM531ps9nLFCyEetcFWbwYVbMbmu+AhtAkaZhCw6au/i3OE21CImps rYhLp31QHJ2mvBAVhLw1B2Ctbg== X-Received: by 2002:adf:f346:: with SMTP id e6mr6183011wrp.179.1622855398651; Fri, 04 Jun 2021 18:09:58 -0700 (PDT) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id u8sm9594941wmq.29.2021.06.04.18.09.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Jun 2021 18:09:58 -0700 (PDT) From: Bryan O'Donoghue To: kvalo@codeaurora.org, wcn36xx@lists.infradead.org, linux-wireless@vger.kernel.org Cc: bryan.odonoghue@linaro.org, shawn.guo@linaro.org, benl@squareup.com, loic.poulain@linaro.org, bjorn.andersson@linaro.org Subject: [PATCH v6 02/12] wcn36xx: Run suspend for the first ieee80211_vif Date: Sat, 5 Jun 2021 02:11:30 +0100 Message-Id: <20210605011140.2004643-3-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210605011140.2004643-1-bryan.odonoghue@linaro.org> References: <20210605011140.2004643-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org A subsequent set of patches will extend out suspend/resume support in this driver, we cannot set the firmware up for multiple ipv4/ipv6 addresses and as such we can't iterate through a list of ieee80211_vif. Constrain the interaction with the firmware to the first ieee80211_vif on the suspend/resume/wowlan path. Signed-off-by: Bryan O'Donoghue Tested-by: Benjamin Li --- drivers/net/wireless/ath/wcn36xx/main.c | 31 ++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) -- 2.30.1 diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c index b361e40697a6..9a97a288a96f 100644 --- a/drivers/net/wireless/ath/wcn36xx/main.c +++ b/drivers/net/wireless/ath/wcn36xx/main.c @@ -1088,15 +1088,34 @@ static int wcn36xx_sta_remove(struct ieee80211_hw *hw, #ifdef CONFIG_PM +static struct ieee80211_vif *wcn36xx_get_first_assoc_vif(struct wcn36xx *wcn) +{ + struct wcn36xx_vif *vif_priv = NULL; + struct ieee80211_vif *vif = NULL; + + list_for_each_entry(vif_priv, &wcn->vif_list, list) { + if (vif_priv->sta_assoc) { + vif = wcn36xx_priv_to_vif(vif_priv); + break; + } + } + return vif; +} + static int wcn36xx_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wow) { struct wcn36xx *wcn = hw->priv; - int ret; + struct ieee80211_vif *vif = NULL; + int ret = 0; wcn36xx_dbg(WCN36XX_DBG_MAC, "mac suspend\n"); flush_workqueue(wcn->hal_ind_wq); - ret = wcn36xx_smd_set_power_params(wcn, true); + mutex_lock(&wcn->conf_mutex); + vif = wcn36xx_get_first_assoc_vif(wcn); + if (vif) + ret = wcn36xx_smd_set_power_params(wcn, true); + mutex_unlock(&wcn->conf_mutex); return ret; } @@ -1104,11 +1123,17 @@ static int wcn36xx_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wow) static int wcn36xx_resume(struct ieee80211_hw *hw) { struct wcn36xx *wcn = hw->priv; + struct ieee80211_vif *vif = NULL; wcn36xx_dbg(WCN36XX_DBG_MAC, "mac resume\n"); flush_workqueue(wcn->hal_ind_wq); - wcn36xx_smd_set_power_params(wcn, false); + mutex_lock(&wcn->conf_mutex); + vif = wcn36xx_get_first_assoc_vif(wcn); + if (vif) + wcn36xx_smd_set_power_params(wcn, false); + mutex_unlock(&wcn->conf_mutex); + return 0; }