wifi: mwifiex: use adapter as context pointer for mwifiex_hs_activated_event()
authorSascha Hauer <s.hauer@pengutronix.de>
Thu, 10 Apr 2025 10:24:26 +0000 (12:24 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 23 Apr 2025 13:34:22 +0000 (15:34 +0200)
mwifiex_hs_activated_event() takes a struct mwifiex_private * as
context pointer which this function doesn't need directly and the callers
don't have. Use struct mwifiex_adapter * instead to simplify both the
function and the callers.

Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Brian Norris <briannorris@chromium.org>
Link: https://patch.msgid.link/20250410-mwifiex-cleanup-1-v6-2-a6bbd4ac4d37@pengutronix.de
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/marvell/mwifiex/cmdevt.c
drivers/net/wireless/marvell/mwifiex/main.c
drivers/net/wireless/marvell/mwifiex/main.h

index 5573e2d..ee3ec80 100644 (file)
@@ -367,8 +367,7 @@ static int mwifiex_dnld_sleep_confirm_cmd(struct mwifiex_adapter *adapter)
            (test_bit(MWIFIEX_IS_HS_CONFIGURED, &adapter->work_flags) &&
             !adapter->sleep_period.period)) {
                adapter->pm_wakeup_card_req = true;
-               mwifiex_hs_activated_event(mwifiex_get_priv
-                               (adapter, MWIFIEX_BSS_ROLE_ANY), true);
+               mwifiex_hs_activated_event(adapter, true);
        }
 
        return ret;
@@ -784,17 +783,16 @@ int mwifiex_exec_next_cmd(struct mwifiex_adapter *adapter)
 
        spin_unlock_bh(&adapter->mwifiex_cmd_lock);
        ret = mwifiex_dnld_cmd_to_fw(priv, cmd_node);
-       priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY);
+
        /* Any command sent to the firmware when host is in sleep
         * mode should de-configure host sleep. We should skip the
         * host sleep configuration command itself though
         */
-       if (priv && (host_cmd->command !=
-            cpu_to_le16(HostCmd_CMD_802_11_HS_CFG_ENH))) {
+       if (host_cmd->command != cpu_to_le16(HostCmd_CMD_802_11_HS_CFG_ENH)) {
                if (adapter->hs_activated) {
                        clear_bit(MWIFIEX_IS_HS_CONFIGURED,
                                  &adapter->work_flags);
-                       mwifiex_hs_activated_event(priv, false);
+                       mwifiex_hs_activated_event(adapter, false);
                }
        }
 
@@ -1160,27 +1158,27 @@ mwifiex_check_ps_cond(struct mwifiex_adapter *adapter)
  * This event is generated by the driver, with a blank event body.
  */
 void
-mwifiex_hs_activated_event(struct mwifiex_private *priv, u8 activated)
+mwifiex_hs_activated_event(struct mwifiex_adapter *adapter, u8 activated)
 {
        if (activated) {
                if (test_bit(MWIFIEX_IS_HS_CONFIGURED,
-                            &priv->adapter->work_flags)) {
-                       priv->adapter->hs_activated = true;
-                       mwifiex_update_rxreor_flags(priv->adapter,
+                            &adapter->work_flags)) {
+                       adapter->hs_activated = true;
+                       mwifiex_update_rxreor_flags(adapter,
                                                    RXREOR_FORCE_NO_DROP);
-                       mwifiex_dbg(priv->adapter, EVENT,
+                       mwifiex_dbg(adapter, EVENT,
                                    "event: hs_activated\n");
-                       priv->adapter->hs_activate_wait_q_woken = true;
+                       adapter->hs_activate_wait_q_woken = true;
                        wake_up_interruptible(
-                               &priv->adapter->hs_activate_wait_q);
+                               &adapter->hs_activate_wait_q);
                } else {
-                       mwifiex_dbg(priv->adapter, EVENT,
+                       mwifiex_dbg(adapter, EVENT,
                                    "event: HS not configured\n");
                }
        } else {
-               mwifiex_dbg(priv->adapter, EVENT,
+               mwifiex_dbg(adapter, EVENT,
                            "event: hs_deactivated\n");
-               priv->adapter->hs_activated = false;
+               adapter->hs_activated = false;
        }
 }
 
@@ -1204,7 +1202,7 @@ int mwifiex_ret_802_11_hs_cfg(struct mwifiex_private *priv,
 
        if (phs_cfg->action == cpu_to_le16(HS_ACTIVATE) &&
            adapter->iface_type != MWIFIEX_USB) {
-               mwifiex_hs_activated_event(priv, true);
+               mwifiex_hs_activated_event(adapter, true);
                return 0;
        } else {
                mwifiex_dbg(adapter, CMD,
@@ -1217,11 +1215,11 @@ int mwifiex_ret_802_11_hs_cfg(struct mwifiex_private *priv,
        if (conditions != HS_CFG_CANCEL) {
                set_bit(MWIFIEX_IS_HS_CONFIGURED, &adapter->work_flags);
                if (adapter->iface_type == MWIFIEX_USB)
-                       mwifiex_hs_activated_event(priv, true);
+                       mwifiex_hs_activated_event(adapter, true);
        } else {
                clear_bit(MWIFIEX_IS_HS_CONFIGURED, &adapter->work_flags);
                if (adapter->hs_activated)
-                       mwifiex_hs_activated_event(priv, false);
+                       mwifiex_hs_activated_event(adapter, false);
        }
 
        return 0;
@@ -1250,9 +1248,7 @@ mwifiex_process_hs_config(struct mwifiex_adapter *adapter)
        adapter->hs_activated = false;
        clear_bit(MWIFIEX_IS_HS_CONFIGURED, &adapter->work_flags);
        clear_bit(MWIFIEX_IS_SUSPENDED, &adapter->work_flags);
-       mwifiex_hs_activated_event(mwifiex_get_priv(adapter,
-                                                   MWIFIEX_BSS_ROLE_ANY),
-                                  false);
+       mwifiex_hs_activated_event(adapter, false);
 }
 EXPORT_SYMBOL_GPL(mwifiex_process_hs_config);
 
@@ -1302,9 +1298,7 @@ mwifiex_process_sleep_confirm_resp(struct mwifiex_adapter *adapter,
        }
        adapter->pm_wakeup_card_req = true;
        if (test_bit(MWIFIEX_IS_HS_CONFIGURED, &adapter->work_flags))
-               mwifiex_hs_activated_event(mwifiex_get_priv
-                                               (adapter, MWIFIEX_BSS_ROLE_ANY),
-                                          true);
+               mwifiex_hs_activated_event(adapter, true);
        adapter->ps_state = PS_STATE_SLEEP;
        cmd->command = cpu_to_le16(command);
        cmd->seq_num = cpu_to_le16(seq_num);
index 40b4838..7bf29f9 100644 (file)
@@ -416,10 +416,7 @@ process_start:
                        if (adapter->hs_activated) {
                                clear_bit(MWIFIEX_IS_HS_CONFIGURED,
                                          &adapter->work_flags);
-                               mwifiex_hs_activated_event
-                                       (mwifiex_get_priv
-                                       (adapter, MWIFIEX_BSS_ROLE_ANY),
-                                       false);
+                               mwifiex_hs_activated_event(adapter, false);
                        }
                }
 
@@ -439,10 +436,7 @@ process_start:
                        if (adapter->hs_activated) {
                                clear_bit(MWIFIEX_IS_HS_CONFIGURED,
                                          &adapter->work_flags);
-                               mwifiex_hs_activated_event
-                                       (mwifiex_get_priv
-                                        (adapter, MWIFIEX_BSS_ROLE_ANY),
-                                        false);
+                               mwifiex_hs_activated_event(adapter, false);
                        }
                }
 
@@ -461,10 +455,7 @@ process_start:
                        if (adapter->hs_activated) {
                                clear_bit(MWIFIEX_IS_HS_CONFIGURED,
                                          &adapter->work_flags);
-                               mwifiex_hs_activated_event
-                                       (mwifiex_get_priv
-                                        (adapter, MWIFIEX_BSS_ROLE_ANY),
-                                        false);
+                               mwifiex_hs_activated_event(adapter, false);
                        }
                }
 
index 63f1c90..88bd21f 100644 (file)
@@ -1125,7 +1125,7 @@ int mwifiex_ret_enh_power_mode(struct mwifiex_private *priv,
                               struct host_cmd_ds_command *resp,
                               struct mwifiex_ds_pm_cfg *pm_cfg);
 void mwifiex_process_hs_config(struct mwifiex_adapter *adapter);
-void mwifiex_hs_activated_event(struct mwifiex_private *priv,
+void mwifiex_hs_activated_event(struct mwifiex_adapter *adapter,
                                        u8 activated);
 int mwifiex_set_hs_params(struct mwifiex_private *priv, u16 action,
                          int cmd_type, struct mwifiex_ds_hs_cfg *hs_cfg);