Message ID | 20210601024920.1424144-3-bryan.odonoghue@linaro.org |
---|---|
State | Superseded |
Headers | show |
Series | wcn36xx: Enable downstream consistent Wake on Lan | expand |
Hi Bryan, On Tue, 1 Jun 2021 at 04:47, Bryan O'Donoghue <bryan.odonoghue@linaro.org> 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 <bryan.odonoghue@linaro.org> > Tested-by: Benjamin Li <benl@squareup.com> > --- > 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
On 01/06/2021 08:09, Loic Poulain wrote:
> Where is the balanced mutex_unlock?
Ah - I've mixed patch #2 and patch #3
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); + return 0; }