Search Linux Wireless

[PATCH 19/31] wifi: mwifiex: add function to send command specific to the adapter

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Current mwifiex_send_command() takes a struct mwifiex_private * as
context pointer. There are several commands though that are specific
to the whole adapter and not to priv *. For these commands introduce
a mwifiex_adapter_send_command() function that takes the adapter as
context pointer. Some users are updated to use this function, more
will be converted in followup patches.

Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
---
 drivers/net/wireless/marvell/mwifiex/cfg80211.c | 13 ++++---------
 drivers/net/wireless/marvell/mwifiex/cmdevt.c   | 14 ++++++++++++++
 drivers/net/wireless/marvell/mwifiex/main.c     | 11 ++++-------
 drivers/net/wireless/marvell/mwifiex/main.h     |  4 ++++
 4 files changed, 26 insertions(+), 16 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
index 4c63b849e3809..8efb3b444cabc 100644
--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
@@ -562,7 +562,6 @@ int mwifiex_send_domain_info_cmd_fw(struct wiphy *wiphy)
 	struct ieee80211_supported_band *sband;
 	struct ieee80211_channel *ch;
 	struct mwifiex_adapter *adapter = mwifiex_cfg80211_get_adapter(wiphy);
-	struct mwifiex_private *priv;
 	struct mwifiex_802_11d_domain_reg *domain_info = &adapter->domain_reg;
 
 	/* Set country code */
@@ -620,9 +619,7 @@ int mwifiex_send_domain_info_cmd_fw(struct wiphy *wiphy)
 
 	domain_info->no_of_triplet = no_of_triplet;
 
-	priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY);
-
-	if (mwifiex_send_cmd(priv, HostCmd_CMD_802_11D_DOMAIN_INFO,
+	if (mwifiex_adapter_send_cmd(adapter, HostCmd_CMD_802_11D_DOMAIN_INFO,
 			     HostCmd_ACT_GEN_SET, 0, NULL, false)) {
 		mwifiex_dbg(adapter, INFO,
 			    "11D: setting domain info in FW\n");
@@ -1814,8 +1811,6 @@ static int
 mwifiex_cfg80211_set_antenna(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant)
 {
 	struct mwifiex_adapter *adapter = mwifiex_cfg80211_get_adapter(wiphy);
-	struct mwifiex_private *priv = mwifiex_get_priv(adapter,
-							MWIFIEX_BSS_ROLE_ANY);
 	struct mwifiex_ds_ant_cfg ant_cfg;
 
 	if (!tx_ant || !rx_ant)
@@ -1833,7 +1828,7 @@ mwifiex_cfg80211_set_antenna(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant)
 			return -EOPNOTSUPP;
 
 		if ((tx_ant == BIT(adapter->number_of_antenna) - 1) &&
-		    (priv->adapter->number_of_antenna > 1)) {
+		    (adapter->number_of_antenna > 1)) {
 			tx_ant = RF_ANTENNA_AUTO;
 			rx_ant = RF_ANTENNA_AUTO;
 		}
@@ -1869,8 +1864,8 @@ mwifiex_cfg80211_set_antenna(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant)
 	ant_cfg.tx_ant = tx_ant;
 	ant_cfg.rx_ant = rx_ant;
 
-	return mwifiex_send_cmd(priv, HostCmd_CMD_RF_ANTENNA,
-				HostCmd_ACT_GEN_SET, 0, &ant_cfg, true);
+	return mwifiex_adapter_send_cmd(adapter, HostCmd_CMD_RF_ANTENNA,
+					HostCmd_ACT_GEN_SET, 0, &ant_cfg, true);
 }
 
 static int
diff --git a/drivers/net/wireless/marvell/mwifiex/cmdevt.c b/drivers/net/wireless/marvell/mwifiex/cmdevt.c
index 34e2dcb77c14d..445fca5c43a6c 100644
--- a/drivers/net/wireless/marvell/mwifiex/cmdevt.c
+++ b/drivers/net/wireless/marvell/mwifiex/cmdevt.c
@@ -670,6 +670,20 @@ int mwifiex_send_cmd(struct mwifiex_private *priv, u16 cmd_no,
 	return ret;
 }
 
+/*
+ * This function prepares a command and send it to the firmware.
+ *
+ * This function is meant to be used when a command is not specific
+ * to a struct mwifiex_private *priv, but globally to the adapter.
+ */
+int mwifiex_adapter_send_cmd(struct mwifiex_adapter *adapter, u16 cmd_no,
+			     u16 cmd_action, u32 cmd_oid, void *data_buf, bool sync)
+{
+	struct mwifiex_private *priv = adapter->priv[0];
+
+	return mwifiex_send_cmd(priv, cmd_no, cmd_action, cmd_oid, data_buf, sync);
+}
+
 /*
  * This function queues a command to the command pending queue.
  *
diff --git a/drivers/net/wireless/marvell/mwifiex/main.c b/drivers/net/wireless/marvell/mwifiex/main.c
index c1f9b483cb5da..6f4815f83af84 100644
--- a/drivers/net/wireless/marvell/mwifiex/main.c
+++ b/drivers/net/wireless/marvell/mwifiex/main.c
@@ -215,7 +215,6 @@ static int mwifiex_process_rx(struct mwifiex_adapter *adapter)
 
 static void maybe_quirk_fw_disable_ds(struct mwifiex_adapter *adapter)
 {
-	struct mwifiex_private *priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA);
 	struct mwifiex_ver_ext ver_ext;
 
 	if (test_and_set_bit(MWIFIEX_IS_REQUESTING_FW_VEREXT, &adapter->work_flags))
@@ -223,9 +222,9 @@ static void maybe_quirk_fw_disable_ds(struct mwifiex_adapter *adapter)
 
 	memset(&ver_ext, 0, sizeof(ver_ext));
 	ver_ext.version_str_sel = 1;
-	if (mwifiex_send_cmd(priv, HostCmd_CMD_VERSION_EXT,
+	if (mwifiex_adapter_send_cmd(adapter, HostCmd_CMD_VERSION_EXT,
 			     HostCmd_ACT_GEN_GET, 0, &ver_ext, false)) {
-		mwifiex_dbg(priv->adapter, MSG,
+		mwifiex_dbg(adapter, MSG,
 			    "Checking hardware revision failed.\n");
 	}
 }
@@ -1054,7 +1053,6 @@ mwifiex_tx_timeout(struct net_device *dev, unsigned int txqueue)
 void mwifiex_multi_chan_resync(struct mwifiex_adapter *adapter)
 {
 	struct usb_card_rec *card = adapter->card;
-	struct mwifiex_private *priv;
 	u16 tx_buf_size;
 	int i, ret;
 
@@ -1068,9 +1066,8 @@ void mwifiex_multi_chan_resync(struct mwifiex_adapter *adapter)
 
 	card->mc_resync_flag = false;
 	tx_buf_size = 0xffff;
-	priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY);
-	ret = mwifiex_send_cmd(priv, HostCmd_CMD_RECONFIGURE_TX_BUFF,
-			       HostCmd_ACT_GEN_SET, 0, &tx_buf_size, false);
+	ret = mwifiex_adapter_send_cmd(adapter, HostCmd_CMD_RECONFIGURE_TX_BUFF,
+				       HostCmd_ACT_GEN_SET, 0, &tx_buf_size, false);
 	if (ret)
 		mwifiex_dbg(adapter, ERROR,
 			    "send reconfig tx buf size cmd err\n");
diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wireless/marvell/mwifiex/main.h
index d3c04402a4f22..bd8bf1f5e2653 100644
--- a/drivers/net/wireless/marvell/mwifiex/main.h
+++ b/drivers/net/wireless/marvell/mwifiex/main.h
@@ -1086,6 +1086,10 @@ int mwifiex_complete_cmd(struct mwifiex_adapter *adapter,
 int mwifiex_send_cmd(struct mwifiex_private *priv, u16 cmd_no,
 		     u16 cmd_action, u32 cmd_oid, void *data_buf, bool sync);
 
+int mwifiex_adapter_send_cmd(struct mwifiex_adapter *adapter, u16 cmd_no,
+			     u16 cmd_action, u32 cmd_oid, void *data_buf,
+			     bool sync);
+
 void mwifiex_cmd_timeout_func(struct timer_list *t);
 
 int mwifiex_get_debug_info(struct mwifiex_private *,

-- 
2.39.2





[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux