diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 53393e0135..8a13846d01 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -11861,6 +11861,23 @@ const struct wiphy_vendor_command hdd_wiphy_vendor_commands[] = { }, }; +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0) +static inline void +hdd_wiphy_set_max_sched_scans(struct wiphy *wiphy, uint8_t max_scans) +{ + if (max_scans == 0) + wiphy->flags &= ~WIPHY_FLAG_SUPPORTS_SCHED_SCAN; + else + wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN; +} +#else +static inline void +hdd_wiphy_set_max_sched_scans(struct wiphy *wiphy, uint8_t max_scans) +{ + wiphy->max_sched_scan_reqs = max_scans; +} +#endif /* KERNEL_VERSION(4, 12, 0) */ + #if ((LINUX_VERSION_CODE > KERNEL_VERSION(4, 4, 0)) || \ defined(CFG80211_MULTI_SCAN_PLAN_BACKPORT)) && \ defined(FEATURE_WLAN_SCAN_PNO) @@ -11875,7 +11892,7 @@ static void hdd_config_sched_scan_plans_to_wiphy(struct wiphy *wiphy, struct hdd_config *config) { if (config->configPNOScanSupport) { - wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN; + hdd_wiphy_set_max_sched_scans(wiphy, 1); wiphy->max_sched_scan_ssids = SCAN_PNO_MAX_SUPP_NETWORKS; wiphy->max_match_sets = SCAN_PNO_MAX_SUPP_NETWORKS; wiphy->max_sched_scan_ie_len = SIR_MAC_MAX_IE_LENGTH; @@ -12374,7 +12391,7 @@ void wlan_hdd_cfg80211_update_wiphy_caps(struct wiphy *wiphy) * have PNO support. */ if (!pCfg->PnoOffload) { - wiphy->flags &= ~WIPHY_FLAG_SUPPORTS_SCHED_SCAN; + hdd_wiphy_set_max_sched_scans(wiphy, 0); wiphy->max_sched_scan_ssids = 0; wiphy->max_match_sets = 0; wiphy->max_sched_scan_ie_len = 0;