Skip to contentSkip to conversation

iwlwifi: mld: fix building with CONFIG_PM_SLEEP disabled

PATCH In review Arnd Bergmann 3 participants 3 messages Mar 25, 2025 – Apr 6, 2025 Intel wireless wifi link (iwlwifi)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iwlwifi: mld: fix building with CONFIG_PM_SLEEP disabled

From: Arnd Bergmann <[email protected]>

The newly added driver causes multiple build problems when CONFIG_PM_SLEEP is disabled:

drivers/net/wireless/intel/iwlwifi/mld/mac80211.c:1982:12: error: 'iwl_mld_resume' defined but not used [-Werror=unused-function]
1982 | static int iwl_mld_resume(struct ieee80211_hw *hw)

      |            ^~~~~~~~~~~~~~
drivers/net/wireless/intel/iwlwifi/mld/mac80211.c:1960:1: error: 'iwl_mld_suspend' defined but not used [-Werror=unused-function]
 1960 | iwl_mld_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan)
      | ^~~~~~~~~~~~~~~
drivers/net/wireless/intel/iwlwifi/mld/mac80211.c:1946:13: error: 'iwl_mld_set_wakeup' defined but not used [-Werror=unused-function]
 1946 | static void iwl_mld_set_wakeup(struct ieee80211_hw *hw, bool enabled)
      |             ^~~~~~~~~~~~~~~~~~
drivers/net/wireless/intel/iwlwifi/mld/mac80211.c: In function 'iwl_mld_mac80211_start':
drivers/net/wireless/intel/iwlwifi/mld/mac80211.c:504:20: error: 'ret' is used uninitialized [-Werror=uninitialized]
  504 |         if (!in_d3 || ret) {
      |                    ^~

drivers/net/wireless/intel/iwlwifi/mld/mac80211.c:478:13: note: 'ret' was declared here
478 | int ret;
| ^~~

Hide the unused functions and make sure the 'ret' variable is not used before the initialization.

---
 drivers/net/wireless/intel/iwlwifi/mld/mac80211.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/wireless/intel/iwlwifi/mld/mac80211.c +5 -2
index 6851064b82da..0b5bc5abb82d 100644
@@ -501,7 +501,7 @@ int iwl_mld_mac80211_start(struct ieee80211_hw *hw)
 		iwl_mld_restart_cleanup(mld);
 	}
 
-	if (!in_d3 || ret) {
+	if (!in_d3) {
 		ret = iwl_mld_start_fw(mld);
 		if (ret)
 			goto error;
@@ -537,7 +537,8 @@ void iwl_mld_mac80211_stop(struct ieee80211_hw *hw, bool suspend)
 	/* if the suspend flow fails the fw is in error. Stop it here, and it
 	 * will be started upon wakeup
 	 */
-	if (!suspend || iwl_mld_no_wowlan_suspend(mld))
+	if (!suspend ||
+	    (IS_ENABLED(CONFIG_PM_SLEEP) && iwl_mld_no_wowlan_suspend(mld)))
 		iwl_mld_stop_fw(mld);
 
 	/* HW is stopped, no more coming RX. OTOH, the worker can't run as the
@@ -1943,6 +1944,7 @@ static void iwl_mld_sta_rc_update(struct ieee80211_hw *hw,
 	}
 }
 
+#ifdef CONFIG_PM_SLEEP
 static void iwl_mld_set_wakeup(struct ieee80211_hw *hw, bool enabled)
 {
 	struct iwl_mld *mld = IWL_MAC80211_GET_MLD(hw);
@@ -1994,6 +1996,7 @@ static int iwl_mld_resume(struct ieee80211_hw *hw)
 
 	return 0;
 }
+#endif
 
 static int iwl_mld_alloc_ptk_pn(struct iwl_mld *mld,
 				struct iwl_mld_sta *mld_sta,
Signature · 1 line
2.39.5
#1 lore raw
Quoted 57 lines

-----Original Message-----
From: Arnd Bergmann <[email protected]>
Sent: Tuesday, 25 March 2025 10:44
To: Korenblit, Miriam Rachel <[email protected]>
Cc: Arnd Bergmann <[email protected]>; Berg, Johannes <[email protected]>; Grumbach, Emmanuel <[email protected]>; Berg, Benjamin <[email protected]>; Anjaneyulu, Pagadala Yesu <[email protected]>; linux- [email protected]; [email protected]
Subject: [PATCH] iwlwifi: mld: fix building with CONFIG_PM_SLEEP disabled

From: Arnd Bergmann <[email protected]>

The newly added driver causes multiple build problems when CONFIG_PM_SLEEP is
disabled:

drivers/net/wireless/intel/iwlwifi/mld/mac80211.c:1982:12: error:
'iwl_mld_resume' defined but not used [-Werror=unused-function]
1982 | static int iwl_mld_resume(struct ieee80211_hw *hw)

      |            ^~~~~~~~~~~~~~

drivers/net/wireless/intel/iwlwifi/mld/mac80211.c:1960:1: error:
'iwl_mld_suspend' defined but not used [-Werror=unused-function]
1960 | iwl_mld_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan
*wowlan)

      | ^~~~~~~~~~~~~~~
drivers/net/wireless/intel/iwlwifi/mld/mac80211.c:1946:13: error:
'iwl_mld_set_wakeup' defined but not used [-Werror=unused-function]
 1946 | static void iwl_mld_set_wakeup(struct ieee80211_hw *hw, bool enabled)
      |             ^~~~~~~~~~~~~~~~~~

drivers/net/wireless/intel/iwlwifi/mld/mac80211.c: In function 'iwl_mld_mac80211_start':
drivers/net/wireless/intel/iwlwifi/mld/mac80211.c:504:20: error: 'ret' is used uninitialized [-Werror=uninitialized]

  504 |         if (!in_d3 || ret) {
      |                    ^~

drivers/net/wireless/intel/iwlwifi/mld/mac80211.c:478:13: note: 'ret' was declared here
478 | int ret;
| ^~~

Hide the unused functions and make sure the 'ret' variable is not used before the initialization.

---
 drivers/net/wireless/intel/iwlwifi/mld/mac80211.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/wireless/intel/iwlwifi/mld/mac80211.c +0 -0
index 6851064b82da..0b5bc5abb82d 100644

drivers/net/wireless/intel/iwlwifi/mld/mac80211.c int iwl_mld_mac80211_start(struct ieee80211_hw *hw) · line 504

Quoted 5 lines
drivers/net/wireless/intel/iwlwifi/mld/mac80211.c +1 -1
@@ -501,7 +501,7 @@ int iwl_mld_mac80211_start(struct ieee80211_hw *hw)
 		iwl_mld_restart_cleanup(mld);
 	}
 
-	if (!in_d3 || ret) {
+	if (!in_d3) {

Then where do you handle the in_d3 && ret case?

Quoted 34 lines
drivers/net/wireless/intel/iwlwifi/mld/mac80211.c +2 -1
 		ret = iwl_mld_start_fw(mld);
 		if (ret)
 			goto error;
@@ -537,7 +537,8 @@ void iwl_mld_mac80211_stop(struct ieee80211_hw *hw,
 bool suspend)
 	/* if the suspend flow fails the fw is in error. Stop it here, and it
 	 * will be started upon wakeup
 	 */
-	if (!suspend || iwl_mld_no_wowlan_suspend(mld))
+	if (!suspend ||
+	    (IS_ENABLED(CONFIG_PM_SLEEP) &&
 iwl_mld_no_wowlan_suspend(mld)))
 		iwl_mld_stop_fw(mld);
drivers/net/wireless/intel/iwlwifi/mld/mac80211.c +3 -1
 	/* HW is stopped, no more coming RX. OTOH, the worker can't run as the
@@ -1943,6 +1944,7 @@ static void iwl_mld_sta_rc_update(struct
 ieee80211_hw *hw,
 	}
 }
 
+#ifdef CONFIG_PM_SLEEP
 static void iwl_mld_set_wakeup(struct ieee80211_hw *hw, bool enabled)  {
 	struct iwl_mld *mld = IWL_MAC80211_GET_MLD(hw); @@ -1994,6
+1996,7 @@ static int iwl_mld_resume(struct ieee80211_hw *hw)
 
 	return 0;
 }
+#endif
 
 static int iwl_mld_alloc_ptk_pn(struct iwl_mld *mld,
 				struct iwl_mld_sta *mld_sta,
--

2.39.5

#2 lore raw
Quoted 5 lines · Miriam Rachel
Quoted 5 lines

From: Arnd Bergmann <[email protected]>
Sent: Tuesday, 25 March 2025 10:44

The newly added driver causes multiple build problems when CONFIG_PM_SLEEP is disabled:

[...]

Quoted 10 lines

drivers/net/wireless/intel/iwlwifi/mld/mac80211.c int iwl_mld_mac80211_start(struct ieee80211_hw *hw) · line 504

Quoted 8 lines
drivers/net/wireless/intel/iwlwifi/mld/mac80211.c +1 -1
@@ -501,7 +501,7 @@ int iwl_mld_mac80211_start(struct ieee80211_hw *hw)
 		iwl_mld_restart_cleanup(mld);
 	}
 
-	if (!in_d3 || ret) {
+	if (!in_d3) {

Then where do you handle the in_d3 && ret case?

That seems to be a valid objection, yet Arnd's patch is now commit 44605365f935 in wireless.git:

https://git.kernel.org/wireless/wireless/c/44605365f935

I'm proposing this v2:

https://lore.kernel.org/r/f435bd9c8186176ffa12fd3650fac71cacdeebe1.1743946314.git.lukas@wunner.de/

If wireless.git/main is a rebasing branch, consider replacing the above-linked commit with the new version. If it is not a rebasing branch, let me know and I'll send a patch reinstating only the ret in the if-condition.

Thanks,

Lukas