@@ -298,6 +298,7 @@ static int ufshcd_reset_and_restore(struct ufs_hba *hba);
298
298
static int ufshcd_eh_host_reset_handler (struct scsi_cmnd * cmd );
299
299
static int ufshcd_clear_tm_cmd (struct ufs_hba * hba , int tag );
300
300
static void ufshcd_hba_exit (struct ufs_hba * hba );
301
+ static int ufshcd_device_init (struct ufs_hba * hba , bool init_dev_params );
301
302
static int ufshcd_probe_hba (struct ufs_hba * hba , bool init_dev_params );
302
303
static int ufshcd_setup_clocks (struct ufs_hba * hba , bool on );
303
304
static inline void ufshcd_add_delay_before_dme_cmd (struct ufs_hba * hba );
@@ -7690,8 +7691,14 @@ static int ufshcd_host_reset_and_restore(struct ufs_hba *hba)
7690
7691
err = ufshcd_hba_enable (hba );
7691
7692
7692
7693
/* Establish the link again and restore the device */
7693
- if (!err )
7694
- err = ufshcd_probe_hba (hba , false);
7694
+ if (!err ) {
7695
+ ktime_t probe_start = ktime_get ();
7696
+
7697
+ err = ufshcd_device_init (hba , /*init_dev_params=*/ false);
7698
+ if (!err )
7699
+ err = ufshcd_probe_hba (hba , false);
7700
+ ufshcd_process_probe_result (hba , probe_start , err );
7701
+ }
7695
7702
7696
7703
if (err )
7697
7704
dev_err (hba -> dev , "%s: Host init failed %d\n" , __func__ , err );
@@ -8827,13 +8834,8 @@ static int ufshcd_device_init(struct ufs_hba *hba, bool init_dev_params)
8827
8834
*/
8828
8835
static int ufshcd_probe_hba (struct ufs_hba * hba , bool init_dev_params )
8829
8836
{
8830
- ktime_t start = ktime_get ();
8831
8837
int ret ;
8832
8838
8833
- ret = ufshcd_device_init (hba , init_dev_params );
8834
- if (ret )
8835
- goto out ;
8836
-
8837
8839
if (!hba -> pm_op_in_progress &&
8838
8840
(hba -> quirks & UFSHCD_QUIRK_REINIT_AFTER_MAX_GEAR_SWITCH )) {
8839
8841
/* Reset the device and controller before doing reinit */
@@ -8846,13 +8848,13 @@ static int ufshcd_probe_hba(struct ufs_hba *hba, bool init_dev_params)
8846
8848
dev_err (hba -> dev , "Host controller enable failed\n" );
8847
8849
ufshcd_print_evt_hist (hba );
8848
8850
ufshcd_print_host_state (hba );
8849
- goto out ;
8851
+ return ret ;
8850
8852
}
8851
8853
8852
8854
/* Reinit the device */
8853
8855
ret = ufshcd_device_init (hba , init_dev_params );
8854
8856
if (ret )
8855
- goto out ;
8857
+ return ret ;
8856
8858
}
8857
8859
8858
8860
ufshcd_print_pwr_info (hba );
@@ -8872,9 +8874,7 @@ static int ufshcd_probe_hba(struct ufs_hba *hba, bool init_dev_params)
8872
8874
ufshcd_write_ee_control (hba );
8873
8875
ufshcd_configure_auto_hibern8 (hba );
8874
8876
8875
- out :
8876
- ufshcd_process_probe_result (hba , start , ret );
8877
- return ret ;
8877
+ return 0 ;
8878
8878
}
8879
8879
8880
8880
/**
@@ -8885,11 +8885,16 @@ static int ufshcd_probe_hba(struct ufs_hba *hba, bool init_dev_params)
8885
8885
static void ufshcd_async_scan (void * data , async_cookie_t cookie )
8886
8886
{
8887
8887
struct ufs_hba * hba = (struct ufs_hba * )data ;
8888
+ ktime_t probe_start ;
8888
8889
int ret ;
8889
8890
8890
8891
down (& hba -> host_sem );
8891
8892
/* Initialize hba, detect and initialize UFS device */
8892
- ret = ufshcd_probe_hba (hba , true);
8893
+ probe_start = ktime_get ();
8894
+ ret = ufshcd_device_init (hba , /*init_dev_params=*/ true);
8895
+ if (ret == 0 )
8896
+ ret = ufshcd_probe_hba (hba , true);
8897
+ ufshcd_process_probe_result (hba , probe_start , ret );
8893
8898
up (& hba -> host_sem );
8894
8899
if (ret )
8895
8900
goto out ;
0 commit comments