]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
iwlwifi: add an extra firmware state in the transport
authorJohannes Berg <johannes.berg@intel.com>
Wed, 9 Dec 2020 21:16:42 +0000 (23:16 +0200)
committerLuca Coelho <luciano.coelho@intel.com>
Wed, 9 Dec 2020 22:16:03 +0000 (00:16 +0200)
Start tracking not just if the firmware is dead or alive,
but also if it's starting.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20201209231352.33e50d40b688.I8bbd41af7aa5e769273a6fc1c06fbf548dd2eb26@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/iwl-trans.h

index 7b244cdeb1856f6ab5d25162c4e44af1be50886a..2c9dd3ff21ebbdb5553d374910cb573a07c54abf 100644 (file)
@@ -590,12 +590,14 @@ struct iwl_trans_ops {
 /**
  * enum iwl_trans_state - state of the transport layer
  *
- * @IWL_TRANS_NO_FW: no fw has sent an alive response
- * @IWL_TRANS_FW_ALIVE: a fw has sent an alive response
+ * @IWL_TRANS_NO_FW: firmware wasn't started yet, or crashed
+ * @IWL_TRANS_FW_STARTED: FW was started, but not alive yet
+ * @IWL_TRANS_FW_ALIVE: FW has sent an alive response
  */
 enum iwl_trans_state {
-       IWL_TRANS_NO_FW = 0,
-       IWL_TRANS_FW_ALIVE      = 1,
+       IWL_TRANS_NO_FW,
+       IWL_TRANS_FW_STARTED,
+       IWL_TRANS_FW_ALIVE,
 };
 
 /**
@@ -1025,12 +1027,18 @@ static inline int iwl_trans_start_fw(struct iwl_trans *trans,
                                     const struct fw_img *fw,
                                     bool run_in_rfkill)
 {
+       int ret;
+
        might_sleep();
 
        WARN_ON_ONCE(!trans->rx_mpdu_cmd);
 
        clear_bit(STATUS_FW_ERROR, &trans->status);
-       return trans->ops->start_fw(trans, fw, run_in_rfkill);
+       ret = trans->ops->start_fw(trans, fw, run_in_rfkill);
+       if (ret == 0)
+               trans->state = IWL_TRANS_FW_STARTED;
+
+       return ret;
 }
 
 static inline void iwl_trans_stop_device(struct iwl_trans *trans)