wifi: iwlwifi: pcie: don't allow hw-rfkill to stop device on gen2
authorJohannes Berg <johannes.berg@intel.com>
Sun, 4 Feb 2024 22:06:05 +0000 (00:06 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Thu, 8 Feb 2024 14:00:45 +0000 (15:00 +0100)
On new devices the HW rfkill shutdown doesn't need to be handled
"as fast as possible", so disallow the immediate shutdown mode
here via documentation and a warning.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240204235836.794c5387e67e.I064365428815ec3135afa345fbbde78449b60203@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/intel/iwlwifi/iwl-op-mode.h
drivers/net/wireless/intel/iwlwifi/pcie/trans.c

index 3dc618a7c70feb9d9cc3dff2877fdd5569b0db71..1ca82f3e4ebf4da2e95a1a3b8d2257987c7cbfaf 100644 (file)
@@ -68,9 +68,11 @@ struct iwl_cfg;
  *     Must be atomic and called with BH disabled.
  * @queue_not_full: notifies that a HW queue is not full any more.
  *     Must be atomic and called with BH disabled.
- * @hw_rf_kill:notifies of a change in the HW rf kill switch. True means that
+ * @hw_rf_kill: notifies of a change in the HW rf kill switch. True means that
  *     the radio is killed. Return %true if the device should be stopped by
  *     the transport immediately after the call. May sleep.
+ *     Note that this must not return %true for newer devices using gen2 PCIe
+ *     transport.
  * @free_skb: allows the transport layer to free skbs that haven't been
  *     reclaimed by the op_mode. This can happen when the driver is freed and
  *     there are Tx packets pending in the transport layer.
index b5756e168f49f141a96d2d2d7f20879f0f313b26..6c76b2dd6878f5a8a69d3fba44650da86442afe9 100644 (file)
@@ -1484,12 +1484,9 @@ void iwl_trans_pcie_rf_kill(struct iwl_trans *trans, bool state, bool from_irq)
 
        IWL_WARN(trans, "reporting RF_KILL (radio %s)\n",
                 state ? "disabled" : "enabled");
-       if (iwl_op_mode_hw_rf_kill(trans->op_mode, state)) {
-               if (trans->trans_cfg->gen2)
-                       _iwl_trans_pcie_gen2_stop_device(trans);
-               else
-                       _iwl_trans_pcie_stop_device(trans, from_irq);
-       }
+       if (iwl_op_mode_hw_rf_kill(trans->op_mode, state) &&
+           !WARN_ON(trans->trans_cfg->gen2))
+               _iwl_trans_pcie_stop_device(trans, from_irq);
 }
 
 void iwl_pcie_d3_complete_suspend(struct iwl_trans *trans,