lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240820-mwifiex-cleanup-v1-28-320d8de4a4b7@pengutronix.de>
Date: Tue, 20 Aug 2024 13:55:53 +0200
From: Sascha Hauer <s.hauer@...gutronix.de>
To: Brian Norris <briannorris@...omium.org>, 
 Francesco Dolcini <francesco@...cini.it>, Kalle Valo <kvalo@...nel.org>
Cc: linux-wireless@...r.kernel.org, linux-kernel@...r.kernel.org, 
 kernel@...gutronix.de, Sascha Hauer <s.hauer@...gutronix.de>
Subject: [PATCH 28/31] wifi: mwifiex: move rx_ant/tx_ant to adapter

The antenna settings are specific to the adapter, not to the priv, so
use adapter as context pointer and use mwifiex_adapter_send_cmd()
instead of mwifiex_send_cmd().

Signed-off-by: Sascha Hauer <s.hauer@...gutronix.de>
---
 drivers/net/wireless/marvell/mwifiex/cfg80211.c    | 11 +++++------
 drivers/net/wireless/marvell/mwifiex/init.c        |  2 --
 drivers/net/wireless/marvell/mwifiex/main.h        |  4 ++--
 drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c | 13 ++++++-------
 4 files changed, 13 insertions(+), 17 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
index b341b36bc7395..a704886049c64 100644
--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
@@ -1867,13 +1867,12 @@ static int
 mwifiex_cfg80211_get_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);
-	mwifiex_send_cmd(priv, HostCmd_CMD_RF_ANTENNA,
-			 HostCmd_ACT_GEN_GET, 0, NULL, true);
 
-	*tx_ant = priv->tx_ant;
-	*rx_ant = priv->rx_ant;
+	mwifiex_adapter_send_cmd(adapter, HostCmd_CMD_RF_ANTENNA,
+				 HostCmd_ACT_GEN_GET, 0, NULL, true);
+
+	*tx_ant = adapter->tx_ant;
+	*rx_ant = adapter->rx_ant;
 
 	return 0;
 }
diff --git a/drivers/net/wireless/marvell/mwifiex/init.c b/drivers/net/wireless/marvell/mwifiex/init.c
index a2296c0d91534..ae79eb500ae13 100644
--- a/drivers/net/wireless/marvell/mwifiex/init.c
+++ b/drivers/net/wireless/marvell/mwifiex/init.c
@@ -105,8 +105,6 @@ int mwifiex_init_priv(struct mwifiex_private *priv)
 	priv->adhoc_channel = DEFAULT_AD_HOC_CHANNEL;
 	priv->atim_window = 0;
 	priv->adhoc_state = ADHOC_IDLE;
-	priv->tx_ant = 0;
-	priv->rx_ant = 0;
 	priv->tx_rate = 0;
 	priv->rxpd_htinfo = 0;
 	priv->rxpd_rate = 0;
diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wireless/marvell/mwifiex/main.h
index c51b9a5766150..0098bae832885 100644
--- a/drivers/net/wireless/marvell/mwifiex/main.h
+++ b/drivers/net/wireless/marvell/mwifiex/main.h
@@ -542,8 +542,6 @@ struct mwifiex_private {
 	u32 curr_pkt_filter;
 	u32 bss_mode;
 	u32 pkt_tx_ctrl;
-	u32 tx_ant;
-	u32 rx_ant;
 	u8 tx_rate;
 	u8 tx_htinfo;
 	u8 rxpd_htinfo;
@@ -950,6 +948,8 @@ struct mwifiex_adapter {
 	u8 max_tx_power_level;
 	u8 min_tx_power_level;
 	u16 tx_power_level;
+	u32 tx_ant;
+	u32 rx_ant;
 	u16 ps_mode;
 	u32 ps_state;
 	u8 need_to_wakeup;
diff --git a/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c b/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c
index 87b4c552c4056..de6a623174701 100644
--- a/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c
+++ b/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c
@@ -444,16 +444,15 @@ static int mwifiex_ret_rf_tx_power(struct mwifiex_adapter *adapter,
 /*
  * This function handles the command response of set rf antenna
  */
-static int mwifiex_ret_rf_antenna(struct mwifiex_private *priv,
+static int mwifiex_ret_rf_antenna(struct mwifiex_adapter *adapter,
 				  struct host_cmd_ds_command *resp)
 {
 	struct host_cmd_ds_rf_ant_mimo *ant_mimo = &resp->params.ant_mimo;
 	struct host_cmd_ds_rf_ant_siso *ant_siso = &resp->params.ant_siso;
-	struct mwifiex_adapter *adapter = priv->adapter;
 
 	if (adapter->hw_dev_mcs_support == HT_STREAM_2X2) {
-		priv->tx_ant = le16_to_cpu(ant_mimo->tx_ant_mode);
-		priv->rx_ant = le16_to_cpu(ant_mimo->rx_ant_mode);
+		adapter->tx_ant = le16_to_cpu(ant_mimo->tx_ant_mode);
+		adapter->rx_ant = le16_to_cpu(ant_mimo->rx_ant_mode);
 		mwifiex_dbg(adapter, INFO,
 			    "RF_ANT_RESP: Tx action = 0x%x, Tx Mode = 0x%04x\t"
 			    "Rx action = 0x%x, Rx Mode = 0x%04x\n",
@@ -462,8 +461,8 @@ static int mwifiex_ret_rf_antenna(struct mwifiex_private *priv,
 			    le16_to_cpu(ant_mimo->action_rx),
 			    le16_to_cpu(ant_mimo->rx_ant_mode));
 	} else {
-		priv->tx_ant = le16_to_cpu(ant_siso->ant_mode);
-		priv->rx_ant = le16_to_cpu(ant_siso->ant_mode);
+		adapter->tx_ant = le16_to_cpu(ant_siso->ant_mode);
+		adapter->rx_ant = le16_to_cpu(ant_siso->ant_mode);
 		mwifiex_dbg(adapter, INFO,
 			    "RF_ANT_RESP: action = 0x%x, Mode = 0x%04x\n",
 			    le16_to_cpu(ant_siso->action),
@@ -1242,7 +1241,7 @@ int mwifiex_process_sta_cmdresp(struct mwifiex_private *priv, u16 cmdresp_no,
 		ret = mwifiex_ret_rf_tx_power(adapter, resp);
 		break;
 	case HostCmd_CMD_RF_ANTENNA:
-		ret = mwifiex_ret_rf_antenna(priv, resp);
+		ret = mwifiex_ret_rf_antenna(adapter, resp);
 		break;
 	case HostCmd_CMD_802_11_PS_MODE_ENH:
 		ret = mwifiex_ret_enh_power_mode(priv, resp, data_buf);

-- 
2.39.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ