diff mbox series

[20/31] wifi: mwifiex: pass adapter to host sleep functions

Message ID 20240820-mwifiex-cleanup-v1-20-320d8de4a4b7@pengutronix.de (mailing list archive)
State Changes Requested
Delegated to: Kalle Valo
Headers show
Series wifi: mwifiex: cleanup driver | expand

Commit Message

Sascha Hauer Aug. 20, 2024, 11:55 a.m. UTC
The host sleep functions have effect on the adapter as a whole and
not to the priv *, so pass the adapter to these functions and use
mwifiex_adapter_send_cmd() to send the commands.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/net/wireless/marvell/mwifiex/cfg80211.c  |  2 +-
 drivers/net/wireless/marvell/mwifiex/cmdevt.c    |  9 ++++-----
 drivers/net/wireless/marvell/mwifiex/debugfs.c   |  8 ++++----
 drivers/net/wireless/marvell/mwifiex/main.c      |  9 +++------
 drivers/net/wireless/marvell/mwifiex/main.h      |  4 ++--
 drivers/net/wireless/marvell/mwifiex/pcie.c      |  3 +--
 drivers/net/wireless/marvell/mwifiex/sdio.c      |  3 +--
 drivers/net/wireless/marvell/mwifiex/sta_ioctl.c | 12 +++++-------
 drivers/net/wireless/marvell/mwifiex/usb.c       |  4 +---
 9 files changed, 22 insertions(+), 32 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
index 8efb3b444cabc..ffdd2b8e5f955 100644
--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
@@ -3392,7 +3392,7 @@  static int mwifiex_cfg80211_suspend(struct wiphy *wiphy,
 	hs_cfg.is_invoke_hostcmd = false;
 	hs_cfg.gpio = adapter->hs_cfg.gpio;
 	hs_cfg.gap = adapter->hs_cfg.gap;
-	ret = mwifiex_set_hs_params(sta_priv, HostCmd_ACT_GEN_SET,
+	ret = mwifiex_set_hs_params(adapter, HostCmd_ACT_GEN_SET,
 				    MWIFIEX_SYNC_CMD, &hs_cfg);
 	if (ret)
 		mwifiex_dbg(adapter, ERROR, "Failed to set HS params\n");
diff --git a/drivers/net/wireless/marvell/mwifiex/cmdevt.c b/drivers/net/wireless/marvell/mwifiex/cmdevt.c
index 445fca5c43a6c..400f1785d0d9e 100644
--- a/drivers/net/wireless/marvell/mwifiex/cmdevt.c
+++ b/drivers/net/wireless/marvell/mwifiex/cmdevt.c
@@ -591,10 +591,10 @@  int mwifiex_send_cmd(struct mwifiex_private *priv, u16 cmd_no,
 		return -1;
 	}
 
-	if (priv->adapter->hs_activated_manually &&
+	if (adapter->hs_activated_manually &&
 	    cmd_no != HostCmd_CMD_802_11_HS_CFG_ENH) {
-		mwifiex_cancel_hs(priv, MWIFIEX_ASYNC_CMD);
-		priv->adapter->hs_activated_manually = false;
+		mwifiex_cancel_hs(adapter, MWIFIEX_ASYNC_CMD);
+		adapter->hs_activated_manually = false;
 	}
 
 	/* Get a new command node */
@@ -1251,8 +1251,7 @@  mwifiex_process_hs_config(struct mwifiex_adapter *adapter)
 	adapter->if_ops.wakeup(adapter);
 
 	if (adapter->hs_activated_manually) {
-		mwifiex_cancel_hs(mwifiex_get_priv (adapter, MWIFIEX_BSS_ROLE_ANY),
-				  MWIFIEX_ASYNC_CMD);
+		mwifiex_cancel_hs(adapter, MWIFIEX_ASYNC_CMD);
 		adapter->hs_activated_manually = false;
 	}
 
diff --git a/drivers/net/wireless/marvell/mwifiex/debugfs.c b/drivers/net/wireless/marvell/mwifiex/debugfs.c
index 9deaf59dcb625..ed6d49418ca6d 100644
--- a/drivers/net/wireless/marvell/mwifiex/debugfs.c
+++ b/drivers/net/wireless/marvell/mwifiex/debugfs.c
@@ -783,12 +783,12 @@  mwifiex_hscfg_write(struct file *file, const char __user *ubuf,
 	}
 
 	if (arg_num >= 1 && arg_num < 3)
-		mwifiex_set_hs_params(priv, HostCmd_ACT_GEN_GET,
+		mwifiex_set_hs_params(priv->adapter, HostCmd_ACT_GEN_GET,
 				      MWIFIEX_SYNC_CMD, &hscfg);
 
 	if (arg_num) {
 		if (conditions == HS_CFG_CANCEL) {
-			mwifiex_cancel_hs(priv, MWIFIEX_ASYNC_CMD);
+			mwifiex_cancel_hs(priv->adapter, MWIFIEX_ASYNC_CMD);
 			ret = count;
 			goto done;
 		}
@@ -800,7 +800,7 @@  mwifiex_hscfg_write(struct file *file, const char __user *ubuf,
 		hscfg.gap = gap;
 
 	hscfg.is_invoke_hostcmd = false;
-	mwifiex_set_hs_params(priv, HostCmd_ACT_GEN_SET,
+	mwifiex_set_hs_params(priv->adapter, HostCmd_ACT_GEN_SET,
 			      MWIFIEX_SYNC_CMD, &hscfg);
 
 	mwifiex_enable_hs(priv->adapter);
@@ -828,7 +828,7 @@  mwifiex_hscfg_read(struct file *file, char __user *ubuf,
 	if (!buf)
 		return -ENOMEM;
 
-	mwifiex_set_hs_params(priv, HostCmd_ACT_GEN_GET,
+	mwifiex_set_hs_params(priv->adapter, HostCmd_ACT_GEN_GET,
 			      MWIFIEX_SYNC_CMD, &hscfg);
 
 	pos = snprintf(buf, PAGE_SIZE, "%u 0x%x 0x%x\n", hscfg.conditions,
diff --git a/drivers/net/wireless/marvell/mwifiex/main.c b/drivers/net/wireless/marvell/mwifiex/main.c
index 6f4815f83af84..f42d537cc6ce0 100644
--- a/drivers/net/wireless/marvell/mwifiex/main.c
+++ b/drivers/net/wireless/marvell/mwifiex/main.c
@@ -401,8 +401,7 @@  int mwifiex_main_process(struct mwifiex_adapter *adapter)
 		    !adapter->data_sent &&
 		    !skb_queue_empty(&adapter->tx_data_q)) {
 			if (adapter->hs_activated_manually) {
-				mwifiex_cancel_hs(mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY),
-						  MWIFIEX_ASYNC_CMD);
+				mwifiex_cancel_hs(adapter, MWIFIEX_ASYNC_CMD);
 				adapter->hs_activated_manually = false;
 			}
 
@@ -420,8 +419,7 @@  int mwifiex_main_process(struct mwifiex_adapter *adapter)
 		    !mwifiex_bypass_txlist_empty(adapter) &&
 		    !mwifiex_is_tdls_chan_switching(adapter)) {
 			if (adapter->hs_activated_manually) {
-				mwifiex_cancel_hs(mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY),
-						  MWIFIEX_ASYNC_CMD);
+				mwifiex_cancel_hs(adapter, MWIFIEX_ASYNC_CMD);
 				adapter->hs_activated_manually = false;
 			}
 
@@ -438,8 +436,7 @@  int mwifiex_main_process(struct mwifiex_adapter *adapter)
 		    !adapter->data_sent && !mwifiex_wmm_lists_empty(adapter) &&
 		    !mwifiex_is_tdls_chan_switching(adapter)) {
 			if (adapter->hs_activated_manually) {
-				mwifiex_cancel_hs(mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY),
-						  MWIFIEX_ASYNC_CMD);
+				mwifiex_cancel_hs(adapter, MWIFIEX_ASYNC_CMD);
 				adapter->hs_activated_manually = false;
 			}
 
diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wireless/marvell/mwifiex/main.h
index bd8bf1f5e2653..8ca770738d08e 100644
--- a/drivers/net/wireless/marvell/mwifiex/main.h
+++ b/drivers/net/wireless/marvell/mwifiex/main.h
@@ -1133,7 +1133,7 @@  int mwifiex_ret_enh_power_mode(struct mwifiex_private *priv,
 void mwifiex_process_hs_config(struct mwifiex_adapter *adapter);
 void mwifiex_hs_activated_event(struct mwifiex_adapter *adapter,
 					u8 activated);
-int mwifiex_set_hs_params(struct mwifiex_private *priv, u16 action,
+int mwifiex_set_hs_params(struct mwifiex_adapter *adapter, u16 action,
 			  int cmd_type, struct mwifiex_ds_hs_cfg *hs_cfg);
 int mwifiex_ret_802_11_hs_cfg(struct mwifiex_private *priv,
 			      struct host_cmd_ds_command *resp);
@@ -1454,7 +1454,7 @@  int mwifiex_wait_queue_complete(struct mwifiex_adapter *adapter,
 				struct cmd_ctrl_node *cmd_queued);
 int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss,
 		      struct cfg80211_ssid *req_ssid);
-int mwifiex_cancel_hs(struct mwifiex_private *priv, int cmd_type);
+int mwifiex_cancel_hs(struct mwifiex_adapter *adapter, int cmd_type);
 int mwifiex_enable_hs(struct mwifiex_adapter *adapter);
 int mwifiex_disable_auto_ds(struct mwifiex_private *priv);
 int mwifiex_drv_get_data_rate(struct mwifiex_private *priv, u32 *rate);
diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c
index 5f997becdbaa2..a25f90034e38d 100644
--- a/drivers/net/wireless/marvell/mwifiex/pcie.c
+++ b/drivers/net/wireless/marvell/mwifiex/pcie.c
@@ -359,8 +359,7 @@  static int mwifiex_pcie_resume(struct device *dev)
 
 	clear_bit(MWIFIEX_IS_SUSPENDED, &adapter->work_flags);
 
-	mwifiex_cancel_hs(mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA),
-			  MWIFIEX_ASYNC_CMD);
+	mwifiex_cancel_hs(adapter, MWIFIEX_ASYNC_CMD);
 	mwifiex_disable_wake(adapter);
 
 	return 0;
diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c b/drivers/net/wireless/marvell/mwifiex/sdio.c
index 490ffd981164d..18ed5015064db 100644
--- a/drivers/net/wireless/marvell/mwifiex/sdio.c
+++ b/drivers/net/wireless/marvell/mwifiex/sdio.c
@@ -654,8 +654,7 @@  static int mwifiex_sdio_resume(struct device *dev)
 	clear_bit(MWIFIEX_IS_SUSPENDED, &adapter->work_flags);
 
 	/* Disable Host Sleep */
-	mwifiex_cancel_hs(mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA),
-			  MWIFIEX_SYNC_CMD);
+	mwifiex_cancel_hs(adapter, MWIFIEX_SYNC_CMD);
 
 	mwifiex_disable_wake(adapter);
 
diff --git a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
index aa138cab7bea9..c01ac5061a05c 100644
--- a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
+++ b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
@@ -395,11 +395,10 @@  int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss,
  * This function prepares the correct firmware command and
  * issues it.
  */
-int mwifiex_set_hs_params(struct mwifiex_private *priv, u16 action,
+int mwifiex_set_hs_params(struct mwifiex_adapter *adapter, u16 action,
 			  int cmd_type, struct mwifiex_ds_hs_cfg *hs_cfg)
 
 {
-	struct mwifiex_adapter *adapter = priv->adapter;
 	int status = 0;
 	u32 prev_cond = 0;
 
@@ -440,7 +439,7 @@  int mwifiex_set_hs_params(struct mwifiex_private *priv, u16 action,
 				break;
 			}
 
-			status = mwifiex_send_cmd(priv,
+			status = mwifiex_adapter_send_cmd(adapter,
 						  HostCmd_CMD_802_11_HS_CFG_ENH,
 						  HostCmd_ACT_GEN_SET, 0,
 						  &adapter->hs_cfg,
@@ -476,14 +475,14 @@  int mwifiex_set_hs_params(struct mwifiex_private *priv, u16 action,
  * This function allocates the IOCTL request buffer, fills it
  * with requisite parameters and calls the IOCTL handler.
  */
-int mwifiex_cancel_hs(struct mwifiex_private *priv, int cmd_type)
+int mwifiex_cancel_hs(struct mwifiex_adapter *adapter, int cmd_type)
 {
 	struct mwifiex_ds_hs_cfg hscfg;
 
 	hscfg.conditions = HS_CFG_CANCEL;
 	hscfg.is_invoke_hostcmd = true;
 
-	return mwifiex_set_hs_params(priv, HostCmd_ACT_GEN_SET,
+	return mwifiex_set_hs_params(adapter, HostCmd_ACT_GEN_SET,
 				    cmd_type, &hscfg);
 }
 EXPORT_SYMBOL_GPL(mwifiex_cancel_hs);
@@ -539,8 +538,7 @@  int mwifiex_enable_hs(struct mwifiex_adapter *adapter)
 	set_bit(MWIFIEX_IS_HS_ENABLING, &adapter->work_flags);
 	mwifiex_cancel_all_pending_cmd(adapter);
 
-	if (mwifiex_set_hs_params(mwifiex_get_priv(adapter,
-						   MWIFIEX_BSS_ROLE_STA),
+	if (mwifiex_set_hs_params(adapter,
 				  HostCmd_ACT_GEN_SET, MWIFIEX_SYNC_CMD,
 				  &hscfg)) {
 		mwifiex_dbg(adapter, ERROR,
diff --git a/drivers/net/wireless/marvell/mwifiex/usb.c b/drivers/net/wireless/marvell/mwifiex/usb.c
index 6085cd50970d4..520ea4bc9a3fb 100644
--- a/drivers/net/wireless/marvell/mwifiex/usb.c
+++ b/drivers/net/wireless/marvell/mwifiex/usb.c
@@ -637,9 +637,7 @@  static int mwifiex_usb_resume(struct usb_interface *intf)
 
 	/* Disable Host Sleep */
 	if (adapter->hs_activated)
-		mwifiex_cancel_hs(mwifiex_get_priv(adapter,
-						   MWIFIEX_BSS_ROLE_ANY),
-				  MWIFIEX_ASYNC_CMD);
+		mwifiex_cancel_hs(adapter, MWIFIEX_ASYNC_CMD);
 
 	return 0;
 }