Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dfb89c56 authored by Johannes Berg's avatar Johannes Berg
Browse files

cfg80211: don't allow WoWLAN support without CONFIG_PM



When CONFIG_PM is disabled, no device can possibly
support WoWLAN since it can't go to sleep to start
with. Due to this, mac80211 had even rejected the
hardware registration. By making all the code and
data for WoWLAN depend on CONFIG_PM we can promote
this runtime error to a compile-time error.

Add #ifdef around all WoWLAN code to remove it in
systems that don't need it as they never suspend.

Cc: Kalle Valo <kvalo@qca.qualcomm.com>
Acked-by: default avatarLuciano Coelho <coelho@ti.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent cc45ae54
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -3487,6 +3487,7 @@ int ath6kl_cfg80211_init(struct ath6kl *ar)
	wiphy->cipher_suites = cipher_suites;
	wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);

#ifdef CONFIG_PM
	wiphy->wowlan.flags = WIPHY_WOWLAN_MAGIC_PKT |
			      WIPHY_WOWLAN_DISCONNECT |
			      WIPHY_WOWLAN_GTK_REKEY_FAILURE  |
@@ -3496,6 +3497,7 @@ int ath6kl_cfg80211_init(struct ath6kl *ar)
	wiphy->wowlan.n_patterns = WOW_MAX_FILTERS_PER_LIST;
	wiphy->wowlan.pattern_min_len = 1;
	wiphy->wowlan.pattern_max_len = WOW_PATTERN_SIZE;
#endif

	wiphy->max_sched_scan_ssids = MAX_PROBED_SSID_INDEX;

+2 −0
Original line number Diff line number Diff line
@@ -5321,6 +5321,7 @@ int __devinit wlcore_probe(struct wl1271 *wl, struct platform_device *pdev)
		goto out_free_hw;
	}

#ifdef CONFIG_PM
	ret = enable_irq_wake(wl->irq);
	if (!ret) {
		wl->irq_wake_enabled = true;
@@ -5334,6 +5335,7 @@ int __devinit wlcore_probe(struct wl1271 *wl, struct platform_device *pdev)
				WL1271_RX_FILTER_MAX_PATTERN_SIZE;
		}
	}
#endif
	disable_irq(wl->irq);

	ret = wl12xx_get_hw_info(wl);
+2 −0
Original line number Diff line number Diff line
@@ -2153,7 +2153,9 @@ struct wiphy {
	char fw_version[ETHTOOL_BUSINFO_LEN];
	u32 hw_version;

#ifdef CONFIG_PM
	struct wiphy_wowlan_support wowlan;
#endif

	u16 max_remain_on_channel_duration;

+3 −4
Original line number Diff line number Diff line
@@ -706,12 +706,11 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
	     local->hw.offchannel_tx_hw_queue >= local->hw.queues))
		return -EINVAL;

	if ((hw->wiphy->wowlan.flags || hw->wiphy->wowlan.n_patterns)
#ifdef CONFIG_PM
	    && (!local->ops->suspend || !local->ops->resume)
#endif
	    )
	if ((hw->wiphy->wowlan.flags || hw->wiphy->wowlan.n_patterns) &&
	    (!local->ops->suspend || !local->ops->resume))
		return -EINVAL;
#endif

	if ((hw->flags & IEEE80211_HW_SCAN_WHILE_IDLE) && !local->ops->hw_scan)
		return -EINVAL;
+4 −0
Original line number Diff line number Diff line
@@ -421,9 +421,11 @@ int wiphy_register(struct wiphy *wiphy)
	int i;
	u16 ifmodes = wiphy->interface_modes;

#ifdef CONFIG_PM
	if (WARN_ON((wiphy->wowlan.flags & WIPHY_WOWLAN_GTK_REKEY_FAILURE) &&
		    !(wiphy->wowlan.flags & WIPHY_WOWLAN_SUPPORTS_GTK_REKEY)))
		return -EINVAL;
#endif

	if (WARN_ON(wiphy->ap_sme_capa &&
		    !(wiphy->flags & WIPHY_FLAG_HAVE_AP_SME)))
@@ -500,12 +502,14 @@ int wiphy_register(struct wiphy *wiphy)
		return -EINVAL;
	}

#ifdef CONFIG_PM
	if (rdev->wiphy.wowlan.n_patterns) {
		if (WARN_ON(!rdev->wiphy.wowlan.pattern_min_len ||
			    rdev->wiphy.wowlan.pattern_min_len >
			    rdev->wiphy.wowlan.pattern_max_len))
			return -EINVAL;
	}
#endif

	/* check and set up bitrates */
	ieee80211_set_bitrate_flags(wiphy);
Loading