Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3227808pxj; Tue, 1 Jun 2021 00:03:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwTR2usduIkhxWyh0aqzSasRkJ79foKHwfOKTF7kMSYPYBjYnstOusKPKLq9ruy4Qk1KgLM X-Received: by 2002:a17:906:274d:: with SMTP id a13mr27772853ejd.51.1622531012945; Tue, 01 Jun 2021 00:03:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622531012; cv=none; d=google.com; s=arc-20160816; b=EPmzUhIRD304g+fOBYcnUO/lRkVwgU7LsHpzG7XMZmnryORqpROzQ/tyZEq77r+qSZ 1Fd1rLrUCOp8o6vj9kdgGh1GWeOc8Qa21O2eUJzWdmTpkrhnEsZKQrKKz64gK5R7wQ5i 8L/co/7Oe50Rgy5okININJXtqOIxq3JpFv8rF5+tYyrWs5HXbIVxj+i/v+lC6oehSE8S LNMaDh7bn5rI1JykXQtvB90i0goTpStRr7z81LCroUPKemOf0qdVJJhSdN0GSLs1hqgI W9b9nwLTtkVuSSUDYEH9DmySKraDtdHuhEvl7xd9hrrmp1V4ar6GDA/EgMxwiem6Kkcd kGag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=8tTsQuQCsLwRpJgFfs++8bxo0SlKt39W/n7IJcrblXA=; b=mMHYZA3DbtQYkNUtf8CVY8THqbHcc/UQIXAluSgGbeFzTOBvYUyEkPEYvJJYTlJLB8 bXLEeDXK3slfQUhvJv8ZsG6fDUM8BBWJT5R9I6sTIisDKckCvVge+1H1yfnXRCsgO2Nk +Gn8znolaQa7519vlsX+e5wkbHaWtH77Zb78GcwOI9ItsSweVA4CtaiaNVtvO4F9n0Rf I+EKULfCJobP3dyIhDu1xWnj2d+cNH/Wmhvpu/2ufJD5yrQ5LsFMrvl4ifd3Zlztumkf 3D3z57AbZjbiHOmp+lqeifOivj/xx5fIjIbxUOKZNVxIG8r3/vubgqZINIdb88jZ9AoI el7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JpnA24Op; 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 bi14si15321015ejb.441.2021.06.01.00.03.06; Tue, 01 Jun 2021 00:03:32 -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=JpnA24Op; 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 S232915AbhFAHBm (ORCPT + 99 others); Tue, 1 Jun 2021 03:01:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230326AbhFAHBl (ORCPT ); Tue, 1 Jun 2021 03:01:41 -0400 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BA69C061574 for ; Tue, 1 Jun 2021 00:00:00 -0700 (PDT) Received: by mail-pj1-x1031.google.com with SMTP id k5so7821874pjj.1 for ; Tue, 01 Jun 2021 00:00:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=8tTsQuQCsLwRpJgFfs++8bxo0SlKt39W/n7IJcrblXA=; b=JpnA24OpoKoXGgpBj1h4n/1yfjU+rM5ob/xduk5M4rCAHCAz3Bkqay5UV/lx02KuIk Ed8gkP9L2H/G9fuEwCq0DmgERIFkgEHbBN82OhVHiXyJx7WOKGihSbUBWm7MuX8vNWAm VpgVROusZQz9wueweMpsQqpTf7Bq7kFHLZW0/ndv7GNLnM573oup+sMM5SKI+uQMpoAK zk1k2Rc+ZzefzJNbtUycKqsqa5QTQ80NWh1TsqsOeYyaEBrjMR8JV6jQoJXgXq2L0jwC 8zuMGXrk7Jm9O+pk+i/HgqAQ+4WDr5xMAIn1XiA5oIPZ2Ik4ZlK49BEVQx+GeX5mNNwt nKCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=8tTsQuQCsLwRpJgFfs++8bxo0SlKt39W/n7IJcrblXA=; b=VO3gk1NPQfHhawAXXcsRrMwDcnchnyWLgehFkEP0ACCVrLWOZvObYoA6PYi9UnweNn 2b+fNKY4kSXY7a68DGpKgoeYjmTS/Ot0OFMlDFcce2O43vkdC0pF48tF7Cp1zO+5HYTC ElrgRxTPEBmayagHsiPRs2IPdTu5lx+dD5jqLLg1YzU7sKO6zHmgWGmGFuUx8d55/b2/ A0IsDLxA0YXsa+qlCp8HJWzwHidRAAhqxq4PhAHcP1U5t8PQhyfvFyIQ1HULDMH0Dr/n NwklTRmP76d3bH5dl9XIWQLEl9LAj6n1ASyPldqiOrFKjZl57Ulq4OVJ38LZuRb6JLdO sXpw== X-Gm-Message-State: AOAM532gjyCHy40SNs9XMnPQdf2r6yURR6GIcvb/LP9Rid0iKcwsphsf J43qMSHZWvg+84+G2o4+6UVjahEGD1mPerN3sXehuw== X-Received: by 2002:a17:90b:1b04:: with SMTP id nu4mr23943311pjb.18.1622530799858; Mon, 31 May 2021 23:59:59 -0700 (PDT) MIME-Version: 1.0 References: <20210601024920.1424144-1-bryan.odonoghue@linaro.org> <20210601024920.1424144-3-bryan.odonoghue@linaro.org> In-Reply-To: <20210601024920.1424144-3-bryan.odonoghue@linaro.org> From: Loic Poulain Date: Tue, 1 Jun 2021 09:09:19 +0200 Message-ID: Subject: Re: [PATCH v4 02/12] wcn36xx: Run suspend for the first ieee80211_vif To: "Bryan O'Donoghue" Cc: Kalle Valo , wcn36xx@lists.infradead.org, linux-wireless@vger.kernel.org, Shawn Guo , Benjamin Li , Bjorn Andersson Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Hi Bryan, On Tue, 1 Jun 2021 at 04:47, Bryan O'Donoghue wrote: > > 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 | 30 ++++++++++++++++++++++--- > 1 file changed, 27 insertions(+), 3 deletions(-) > > diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c > index b361e40697a6..6802dce2a02b 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,16 @@ 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); > + Where is the balanced mutex_unlock? > return 0; > } Regards, Loic