From 1c1d0f75d62aaacac5b9ee72663632f4355ef11e Mon Sep 17 00:00:00 2001 From: Yue Ma Date: Thu, 1 Aug 2019 19:21:05 -0700 Subject: [PATCH] qcacld-3.0: Do sync runtime resume/suspend for get station stats API Get station stats API will be periodically called from upper layer so in order to save power, instead of waiting for inactive timer to fire, suspend right after everything is done. Change-Id: I452ac3631d6799ffdcb1d09ff71afb2730b92b59 CRs-fixed: 2502391 --- core/hdd/src/wlan_hdd_stats.c | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/core/hdd/src/wlan_hdd_stats.c b/core/hdd/src/wlan_hdd_stats.c index 0ea7ec99f5aa..5b569e89f7ee 100644 --- a/core/hdd/src/wlan_hdd_stats.c +++ b/core/hdd/src/wlan_hdd_stats.c @@ -4654,6 +4654,38 @@ static int __wlan_hdd_cfg80211_get_station(struct wiphy *wiphy, } } +/** + * _wlan_hdd_cfg80211_get_station() - get station statistics + * + * @wiphy: Pointer to wiphy + * @dev: Pointer to network device + * @mac: Pointer to mac + * @sinfo: Pointer to station info + * + * This API tries runtime PM suspend right away after getting station + * statistics. + * + * Return: 0 for success, non-zero for failure + */ +static int _wlan_hdd_cfg80211_get_station(struct wiphy *wiphy, + struct net_device *dev, + const uint8_t *mac, + struct station_info *sinfo) +{ + void *hif_ctx = cds_get_context(QDF_MODULE_ID_HIF); + int errno; + + errno = hif_pm_runtime_get_sync(hif_ctx); + if (errno) + return errno; + + errno = __wlan_hdd_cfg80211_get_station(wiphy, dev, mac, sinfo); + + hif_pm_runtime_put_sync_suspend(hif_ctx); + + return errno; +} + /** * wlan_hdd_cfg80211_get_station() - get station statistics * @wiphy: Pointer to wiphy @@ -4674,7 +4706,7 @@ int wlan_hdd_cfg80211_get_station(struct wiphy *wiphy, if (errno) return errno; - errno = __wlan_hdd_cfg80211_get_station(wiphy, dev, mac, sinfo); + errno = _wlan_hdd_cfg80211_get_station(wiphy, dev, mac, sinfo); osif_vdev_sync_op_stop(vdev_sync);