diff mbox series

iwlwifi: mld: fix building with CONFIG_PM_SLEEP disabled

Message ID 20250325084340.378724-1-arnd@kernel.org (mailing list archive)
State New
Delegated to: Johannes Berg
Headers show
Series iwlwifi: mld: fix building with CONFIG_PM_SLEEP disabled | expand

Checks

Context Check Description
wifibot/fixes_present success Fixes tag not required for -next series
wifibot/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
wifibot/tree_selection success Guessed tree name to be wireless-next
wifibot/ynl success Generated files up to date; no warnings/errors; no diff in generated;
wifibot/build_32bit success Errors and warnings before: 0 this patch: 0
wifibot/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
wifibot/build_clang success Errors and warnings before: 0 this patch: 0
wifibot/build_clang_rust success No Rust files in patch. Skipping build
wifibot/build_tools success No tools touched, skip
wifibot/check_selftest success No net selftest shell script
wifibot/checkpatch success total: 0 errors, 0 warnings, 0 checks, 31 lines checked
wifibot/deprecated_api success None detected
wifibot/header_inline success No static functions without inline keyword in header files
wifibot/kdoc success Errors and warnings before: 0 this patch: 0
wifibot/source_inline success Was 0 now: 0
wifibot/verify_fixes success No Fixes tag
wifibot/verify_signedoff success Signed-off-by tag matches author and committer

Commit Message

Arnd Bergmann March 25, 2025, 8:43 a.m. UTC
From: Arnd Bergmann <arnd@arndb.de>

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.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/net/wireless/intel/iwlwifi/mld/mac80211.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

Korenblit, Miriam Rachel March 30, 2025, 4:49 a.m. UTC | #1
> -----Original Message-----
> From: Arnd Bergmann <arnd@kernel.org>
> Sent: Tuesday, 25 March 2025 10:44
> To: Korenblit, Miriam Rachel <miriam.rachel.korenblit@intel.com>
> Cc: Arnd Bergmann <arnd@arndb.de>; Berg, Johannes
> <johannes.berg@intel.com>; Grumbach, Emmanuel
> <emmanuel.grumbach@intel.com>; Berg, Benjamin <benjamin.berg@intel.com>;
> Anjaneyulu, Pagadala Yesu <pagadala.yesu.anjaneyulu@intel.com>; linux-
> wireless@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: [PATCH] iwlwifi: mld: fix building with CONFIG_PM_SLEEP disabled
> 
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/net/wireless/intel/iwlwifi/mld/mac80211.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/wireless/intel/iwlwifi/mld/mac80211.c
> b/drivers/net/wireless/intel/iwlwifi/mld/mac80211.c
> index 6851064b82da..0b5bc5abb82d 100644
> --- a/drivers/net/wireless/intel/iwlwifi/mld/mac80211.c
> +++ b/drivers/net/wireless/intel/iwlwifi/mld/mac80211.c
> @@ -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?

>  		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,
> --
> 2.39.5
>
diff mbox series

Patch

diff --git a/drivers/net/wireless/intel/iwlwifi/mld/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mld/mac80211.c
index 6851064b82da..0b5bc5abb82d 100644
--- a/drivers/net/wireless/intel/iwlwifi/mld/mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mld/mac80211.c
@@ -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,