mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-22 09:45:08 -04:00
wifi: iwlwifi: simplify iwl_trans_pcie_d3_resume
If iwl_trans_d3_resume succeeded but the hw requested a reset, this will be indicated to the opmode via the iwl_d3_status parameter while the return value will be 0. But the opmode doesn't really care if the resume failed or if a restart is required. It acts the same in both cases (beside different logs, but this can be done in iwl_trans_pcie_d3_resume) This complicates the code for no good reason. Change the iwl_trans_pcie_d3_resume to return an error value also in the case that everything went successfully but a restart is required, and add more logs so we can differentiate between the cases. This makes iwl_d3_status redundant. Remove it as well. Reviewed-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com> Link: https://patch.msgid.link/20250826184046.5fa2d909c75d.Ida19d8d8d73eddf12b30f1d473ea675f415778b2@changeid
This commit is contained in:
@@ -422,7 +422,6 @@ static int iwlagn_mac_resume(struct ieee80211_hw *hw)
|
||||
struct ieee80211_vif *vif;
|
||||
u32 base;
|
||||
int ret;
|
||||
enum iwl_d3_status d3_status;
|
||||
struct error_table_start {
|
||||
/* cf. struct iwl_error_event_table */
|
||||
u32 valid;
|
||||
@@ -451,15 +450,10 @@ static int iwlagn_mac_resume(struct ieee80211_hw *hw)
|
||||
/* we'll clear ctx->vif during iwlagn_prepare_restart() */
|
||||
vif = ctx->vif;
|
||||
|
||||
ret = iwl_trans_d3_resume(priv->trans, &d3_status, true);
|
||||
ret = iwl_trans_d3_resume(priv->trans, true);
|
||||
if (ret)
|
||||
goto out_unlock;
|
||||
|
||||
if (d3_status != IWL_D3_STATUS_ALIVE) {
|
||||
IWL_INFO(priv, "Device was reset during suspend\n");
|
||||
goto out_unlock;
|
||||
}
|
||||
|
||||
/* uCode is no longer operating by itself */
|
||||
iwl_write32(priv->trans, CSR_UCODE_DRV_GP1_CLR,
|
||||
CSR_UCODE_DRV_GP1_BIT_D3_CFG_COMPLETE);
|
||||
|
||||
@@ -510,12 +510,11 @@ int iwl_trans_d3_suspend(struct iwl_trans *trans, bool reset)
|
||||
}
|
||||
IWL_EXPORT_SYMBOL(iwl_trans_d3_suspend);
|
||||
|
||||
int iwl_trans_d3_resume(struct iwl_trans *trans, enum iwl_d3_status *status,
|
||||
bool reset)
|
||||
int iwl_trans_d3_resume(struct iwl_trans *trans, bool reset)
|
||||
{
|
||||
might_sleep();
|
||||
|
||||
return iwl_trans_pcie_d3_resume(trans, status, reset);
|
||||
return iwl_trans_pcie_d3_resume(trans, reset);
|
||||
}
|
||||
IWL_EXPORT_SYMBOL(iwl_trans_d3_resume);
|
||||
|
||||
|
||||
@@ -274,16 +274,6 @@ static inline void iwl_free_rxb(struct iwl_rx_cmd_buffer *r)
|
||||
#define IWL_MAX_RX_HW_QUEUES 16
|
||||
#define IWL_9000_MAX_RX_HW_QUEUES 1
|
||||
|
||||
/**
|
||||
* enum iwl_d3_status - WoWLAN image/device status
|
||||
* @IWL_D3_STATUS_ALIVE: firmware is still running after resume
|
||||
* @IWL_D3_STATUS_RESET: device was reset while suspended
|
||||
*/
|
||||
enum iwl_d3_status {
|
||||
IWL_D3_STATUS_ALIVE,
|
||||
IWL_D3_STATUS_RESET,
|
||||
};
|
||||
|
||||
/**
|
||||
* enum iwl_trans_status: transport status flags
|
||||
* @STATUS_SYNC_HCMD_ACTIVE: a SYNC command is being processed
|
||||
@@ -951,8 +941,7 @@ void iwl_trans_stop_device(struct iwl_trans *trans);
|
||||
|
||||
int iwl_trans_d3_suspend(struct iwl_trans *trans, bool reset);
|
||||
|
||||
int iwl_trans_d3_resume(struct iwl_trans *trans, enum iwl_d3_status *status,
|
||||
bool reset);
|
||||
int iwl_trans_d3_resume(struct iwl_trans *trans, bool reset);
|
||||
|
||||
struct iwl_trans_dump_data *
|
||||
iwl_trans_dump_data(struct iwl_trans *trans, u32 dump_mask,
|
||||
|
||||
@@ -1195,7 +1195,6 @@ static int iwl_mld_wait_d3_notif(struct iwl_mld *mld,
|
||||
WIDE_ID(PROT_OFFLOAD_GROUP, D3_END_NOTIFICATION)
|
||||
};
|
||||
struct iwl_notification_wait wait_d3_notif;
|
||||
enum iwl_d3_status d3_status;
|
||||
int ret;
|
||||
|
||||
if (with_wowlan)
|
||||
@@ -1211,14 +1210,8 @@ static int iwl_mld_wait_d3_notif(struct iwl_mld *mld,
|
||||
iwl_mld_handle_d3_notif,
|
||||
resume_data);
|
||||
|
||||
ret = iwl_trans_d3_resume(mld->trans, &d3_status, false);
|
||||
if (ret || d3_status != IWL_D3_STATUS_ALIVE) {
|
||||
if (d3_status != IWL_D3_STATUS_ALIVE) {
|
||||
IWL_INFO(mld, "Device was reset during suspend\n");
|
||||
ret = -ENOENT;
|
||||
} else {
|
||||
IWL_ERR(mld, "Transport resume failed\n");
|
||||
}
|
||||
ret = iwl_trans_d3_resume(mld->trans, false);
|
||||
if (ret) {
|
||||
iwl_remove_notification(&mld->notif_wait, &wait_d3_notif);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -2984,7 +2984,6 @@ static bool iwl_mvm_wait_d3_notif(struct iwl_notif_wait_data *notif_wait,
|
||||
static int iwl_mvm_resume_firmware(struct iwl_mvm *mvm)
|
||||
{
|
||||
int ret;
|
||||
enum iwl_d3_status d3_status;
|
||||
struct iwl_host_cmd cmd = {
|
||||
.id = D0I3_END_CMD,
|
||||
.flags = CMD_WANT_SKB,
|
||||
@@ -2992,15 +2991,10 @@ static int iwl_mvm_resume_firmware(struct iwl_mvm *mvm)
|
||||
bool reset = fw_has_capa(&mvm->fw->ucode_capa,
|
||||
IWL_UCODE_TLV_CAPA_CNSLDTD_D3_D0_IMG);
|
||||
|
||||
ret = iwl_trans_d3_resume(mvm->trans, &d3_status, !reset);
|
||||
ret = iwl_trans_d3_resume(mvm->trans, !reset);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (d3_status != IWL_D3_STATUS_ALIVE) {
|
||||
IWL_INFO(mvm, "Device was reset during suspend\n");
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
/*
|
||||
* We should trigger resume flow using command only for 22000 family
|
||||
* AX210 and above don't need the command since they have
|
||||
|
||||
@@ -1064,7 +1064,6 @@ iwl_trans_pcie_dump_data(struct iwl_trans *trans, u32 dump_mask,
|
||||
const struct iwl_dump_sanitize_ops *sanitize_ops,
|
||||
void *sanitize_ctx);
|
||||
int iwl_trans_pcie_d3_resume(struct iwl_trans *trans,
|
||||
enum iwl_d3_status *status,
|
||||
bool reset);
|
||||
int iwl_trans_pcie_d3_suspend(struct iwl_trans *trans, bool reset);
|
||||
void iwl_trans_pci_interrupts(struct iwl_trans *trans, bool enable);
|
||||
|
||||
@@ -1530,7 +1530,6 @@ int iwl_trans_pcie_d3_suspend(struct iwl_trans *trans, bool reset)
|
||||
}
|
||||
|
||||
int iwl_trans_pcie_d3_resume(struct iwl_trans *trans,
|
||||
enum iwl_d3_status *status,
|
||||
bool reset)
|
||||
{
|
||||
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
|
||||
@@ -1545,8 +1544,11 @@ int iwl_trans_pcie_d3_resume(struct iwl_trans *trans,
|
||||
CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
|
||||
|
||||
ret = iwl_finish_nic_init(trans);
|
||||
if (ret)
|
||||
if (ret) {
|
||||
IWL_ERR(trans, "Failed to init nic upon resume. err = %d\n",
|
||||
ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Reconfigure IVAR table in case of MSIX or reset ict table in
|
||||
@@ -1581,14 +1583,12 @@ int iwl_trans_pcie_d3_resume(struct iwl_trans *trans,
|
||||
|
||||
val = iwl_read32(trans, CSR_RESET);
|
||||
if (val & CSR_RESET_REG_FLAG_NEVO_RESET) {
|
||||
*status = IWL_D3_STATUS_RESET;
|
||||
IWL_INFO(trans, "Device was reset during suspend\n");
|
||||
trans->state = IWL_TRANS_NO_FW;
|
||||
} else {
|
||||
*status = IWL_D3_STATUS_ALIVE;
|
||||
return iwl_pcie_d3_handshake(trans, false);
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return iwl_pcie_d3_handshake(trans, false);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
Reference in New Issue
Block a user