wifi: iwlwifi: remove fw_running op
authorShahar S Matityahu <shahar.s.matityahu@intel.com>
Fri, 10 May 2024 14:06:40 +0000 (17:06 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Thu, 23 May 2024 08:51:02 +0000 (10:51 +0200)
fw_running assumes that memory can be retrieved only after alive.
This assumption is no longer true as we support dump before alive.
To avoid invalid access to the NIC, check that STATUS_DEVICE_ENABLED
bit in trans status is set before dumping instead of the prior check.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Reviewed-by: Luciano Coelho <luciano.coelho@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240510170500.ca07138cedeb.I090e31d3eaeb4ba19f5f84aba997ccd36927e9ac@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/intel/iwlwifi/fw/debugfs.c
drivers/net/wireless/intel/iwlwifi/fw/runtime.h
drivers/net/wireless/intel/iwlwifi/mvm/ops.c

index 751a125a1566f87c8a734c6cfb55a5a4ea7c7381..893b21fcaf87c6322a7c2df950ab94155274fd63 100644 (file)
@@ -230,8 +230,7 @@ static ssize_t iwl_dbgfs_send_hcmd_write(struct iwl_fw_runtime *fwrt, char *buf,
                .data = { NULL, },
        };
 
-       if (fwrt->ops && fwrt->ops->fw_running &&
-           !fwrt->ops->fw_running(fwrt->ops_ctx))
+       if (!iwl_trans_fw_running(fwrt->trans))
                return -EIO;
 
        if (count < header_size + 1 || count > 1024 * 4)
index 9122f9a1260ae0a505d2bb8f6310dba4bc3ee76c..d201440066ea9f3aa44a6f1af1b7425936cb60b6 100644 (file)
@@ -19,7 +19,6 @@
 struct iwl_fw_runtime_ops {
        void (*dump_start)(void *ctx);
        void (*dump_end)(void *ctx);
-       bool (*fw_running)(void *ctx);
        int (*send_hcmd)(void *ctx, struct iwl_host_cmd *host_cmd);
        bool (*d3_debug_enable)(void *ctx);
 };
index 53283d052e18904c4813147cf04768150cb684ef..f19577474f4be8a0e642b87cac7ac26b8b007252 100644 (file)
@@ -770,11 +770,6 @@ static void iwl_mvm_fwrt_dump_end(void *ctx)
        mutex_unlock(&mvm->mutex);
 }
 
-static bool iwl_mvm_fwrt_fw_running(void *ctx)
-{
-       return iwl_mvm_firmware_running(ctx);
-}
-
 static int iwl_mvm_fwrt_send_hcmd(void *ctx, struct iwl_host_cmd *host_cmd)
 {
        struct iwl_mvm *mvm = (struct iwl_mvm *)ctx;
@@ -795,7 +790,6 @@ static bool iwl_mvm_d3_debug_enable(void *ctx)
 static const struct iwl_fw_runtime_ops iwl_mvm_fwrt_ops = {
        .dump_start = iwl_mvm_fwrt_dump_start,
        .dump_end = iwl_mvm_fwrt_dump_end,
-       .fw_running = iwl_mvm_fwrt_fw_running,
        .send_hcmd = iwl_mvm_fwrt_send_hcmd,
        .d3_debug_enable = iwl_mvm_d3_debug_enable,
 };