Skip to content

Commit 18ec23b

Browse files
bvanasschemartinkpetersen
authored andcommitted
scsi: ufs: core: Introduce ufshcd_process_probe_result()
Prepare for moving a ufshcd_device_init() call from inside ufshcd_probe_hba() into the ufshcd_probe_hba() callers by introducing the function ufshcd_process_probe_result(). No functionality has been changed. Signed-off-by: Bart Van Assche <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 7702c7f commit 18ec23b

File tree

1 file changed

+24
-11
lines changed

1 file changed

+24
-11
lines changed

drivers/ufs/core/ufshcd.c

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7638,6 +7638,29 @@ static int ufshcd_abort(struct scsi_cmnd *cmd)
76387638
return err;
76397639
}
76407640

7641+
/**
7642+
* ufshcd_process_probe_result - Process the ufshcd_probe_hba() result.
7643+
* @hba: UFS host controller instance.
7644+
* @probe_start: time when the ufshcd_probe_hba() call started.
7645+
* @ret: ufshcd_probe_hba() return value.
7646+
*/
7647+
static void ufshcd_process_probe_result(struct ufs_hba *hba,
7648+
ktime_t probe_start, int ret)
7649+
{
7650+
unsigned long flags;
7651+
7652+
spin_lock_irqsave(hba->host->host_lock, flags);
7653+
if (ret)
7654+
hba->ufshcd_state = UFSHCD_STATE_ERROR;
7655+
else if (hba->ufshcd_state == UFSHCD_STATE_RESET)
7656+
hba->ufshcd_state = UFSHCD_STATE_OPERATIONAL;
7657+
spin_unlock_irqrestore(hba->host->host_lock, flags);
7658+
7659+
trace_ufshcd_init(dev_name(hba->dev), ret,
7660+
ktime_to_us(ktime_sub(ktime_get(), probe_start)),
7661+
hba->curr_dev_pwr_mode, hba->uic_link_state);
7662+
}
7663+
76417664
/**
76427665
* ufshcd_host_reset_and_restore - reset and restore host controller
76437666
* @hba: per-adapter instance
@@ -8804,7 +8827,6 @@ static int ufshcd_device_init(struct ufs_hba *hba, bool init_dev_params)
88048827
static int ufshcd_probe_hba(struct ufs_hba *hba, bool init_dev_params)
88058828
{
88068829
ktime_t start = ktime_get();
8807-
unsigned long flags;
88088830
int ret;
88098831

88108832
ret = ufshcd_device_init(hba, init_dev_params);
@@ -8850,16 +8872,7 @@ static int ufshcd_probe_hba(struct ufs_hba *hba, bool init_dev_params)
88508872
ufshcd_configure_auto_hibern8(hba);
88518873

88528874
out:
8853-
spin_lock_irqsave(hba->host->host_lock, flags);
8854-
if (ret)
8855-
hba->ufshcd_state = UFSHCD_STATE_ERROR;
8856-
else if (hba->ufshcd_state == UFSHCD_STATE_RESET)
8857-
hba->ufshcd_state = UFSHCD_STATE_OPERATIONAL;
8858-
spin_unlock_irqrestore(hba->host->host_lock, flags);
8859-
8860-
trace_ufshcd_init(dev_name(hba->dev), ret,
8861-
ktime_to_us(ktime_sub(ktime_get(), start)),
8862-
hba->curr_dev_pwr_mode, hba->uic_link_state);
8875+
ufshcd_process_probe_result(hba, start, ret);
88638876
return ret;
88648877
}
88658878

0 commit comments

Comments
 (0)