@@ -2899,7 +2899,6 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
28992899 ufshcd_hold (hba );
29002900
29012901 lrbp = & hba -> lrb [tag ];
2902- WARN_ON (lrbp -> cmd );
29032902 lrbp -> cmd = cmd ;
29042903 lrbp -> task_tag = tag ;
29052904 lrbp -> lun = ufshcd_scsi_to_upiu_lun (cmd -> device -> lun );
@@ -2915,7 +2914,6 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
29152914
29162915 err = ufshcd_map_sg (hba , lrbp );
29172916 if (err ) {
2918- lrbp -> cmd = NULL ;
29192917 ufshcd_release (hba );
29202918 goto out ;
29212919 }
@@ -3178,7 +3176,7 @@ static int ufshcd_exec_dev_cmd(struct ufs_hba *hba,
31783176 down_read (& hba -> clk_scaling_lock );
31793177
31803178 lrbp = & hba -> lrb [tag ];
3181- WARN_ON ( lrbp -> cmd ) ;
3179+ lrbp -> cmd = NULL ;
31823180 err = ufshcd_compose_dev_cmd (hba , lrbp , cmd_type , tag );
31833181 if (unlikely (err ))
31843182 goto out ;
@@ -5418,7 +5416,6 @@ void ufshcd_release_scsi_cmd(struct ufs_hba *hba,
54185416 struct scsi_cmnd * cmd = lrbp -> cmd ;
54195417
54205418 scsi_dma_unmap (cmd );
5421- lrbp -> cmd = NULL ; /* Mark the command as completed. */
54225419 ufshcd_release (hba );
54235420 ufshcd_clk_scaling_update_busy (hba );
54245421}
@@ -7106,7 +7103,6 @@ static int ufshcd_issue_devman_upiu_cmd(struct ufs_hba *hba,
71067103 down_read (& hba -> clk_scaling_lock );
71077104
71087105 lrbp = & hba -> lrb [tag ];
7109- WARN_ON (lrbp -> cmd );
71107106 lrbp -> cmd = NULL ;
71117107 lrbp -> task_tag = tag ;
71127108 lrbp -> lun = 0 ;
@@ -7278,7 +7274,6 @@ int ufshcd_advanced_rpmb_req_handler(struct ufs_hba *hba, struct utp_upiu_req *r
72787274 down_read (& hba -> clk_scaling_lock );
72797275
72807276 lrbp = & hba -> lrb [tag ];
7281- WARN_ON (lrbp -> cmd );
72827277 lrbp -> cmd = NULL ;
72837278 lrbp -> task_tag = tag ;
72847279 lrbp -> lun = UFS_UPIU_RPMB_WLUN ;
@@ -9296,7 +9291,8 @@ static int ufshcd_execute_start_stop(struct scsi_device *sdev,
92969291 };
92979292
92989293 return scsi_execute_cmd (sdev , cdb , REQ_OP_DRV_IN , /*buffer=*/ NULL ,
9299- /*bufflen=*/ 0 , /*timeout=*/ HZ , /*retries=*/ 0 , & args );
9294+ /*bufflen=*/ 0 , /*timeout=*/ 10 * HZ , /*retries=*/ 0 ,
9295+ & args );
93009296}
93019297
93029298/**
@@ -9879,28 +9875,6 @@ static int ufshcd_wl_resume(struct device *dev)
98799875}
98809876#endif
98819877
9882- static void ufshcd_wl_shutdown (struct device * dev )
9883- {
9884- struct scsi_device * sdev = to_scsi_device (dev );
9885- struct ufs_hba * hba ;
9886-
9887- hba = shost_priv (sdev -> host );
9888-
9889- down (& hba -> host_sem );
9890- hba -> shutting_down = true;
9891- up (& hba -> host_sem );
9892-
9893- /* Turn on everything while shutting down */
9894- ufshcd_rpm_get_sync (hba );
9895- scsi_device_quiesce (sdev );
9896- shost_for_each_device (sdev , hba -> host ) {
9897- if (sdev == hba -> ufs_device_wlun )
9898- continue ;
9899- scsi_device_quiesce (sdev );
9900- }
9901- __ufshcd_wl_suspend (hba , UFS_SHUTDOWN_PM );
9902- }
9903-
99049878/**
99059879 * ufshcd_suspend - helper function for suspend operations
99069880 * @hba: per adapter instance
@@ -10085,25 +10059,34 @@ int ufshcd_runtime_resume(struct device *dev)
1008510059EXPORT_SYMBOL (ufshcd_runtime_resume );
1008610060#endif /* CONFIG_PM */
1008710061
10088- /**
10089- * ufshcd_shutdown - shutdown routine
10090- * @hba: per adapter instance
10091- *
10092- * This function would turn off both UFS device and UFS hba
10093- * regulators. It would also disable clocks.
10094- *
10095- * Returns 0 always to allow force shutdown even in case of errors.
10096- */
10097- int ufshcd_shutdown (struct ufs_hba * hba )
10062+ static void ufshcd_wl_shutdown (struct device * dev )
1009810063{
10064+ struct scsi_device * sdev = to_scsi_device (dev );
10065+ struct ufs_hba * hba = shost_priv (sdev -> host );
10066+
10067+ down (& hba -> host_sem );
10068+ hba -> shutting_down = true;
10069+ up (& hba -> host_sem );
10070+
10071+ /* Turn on everything while shutting down */
10072+ ufshcd_rpm_get_sync (hba );
10073+ scsi_device_quiesce (sdev );
10074+ shost_for_each_device (sdev , hba -> host ) {
10075+ if (sdev == hba -> ufs_device_wlun )
10076+ continue ;
10077+ scsi_device_quiesce (sdev );
10078+ }
10079+ __ufshcd_wl_suspend (hba , UFS_SHUTDOWN_PM );
10080+
10081+ /*
10082+ * Next, turn off the UFS controller and the UFS regulators. Disable
10083+ * clocks.
10084+ */
1009910085 if (ufshcd_is_ufs_dev_poweroff (hba ) && ufshcd_is_link_off (hba ))
1010010086 ufshcd_suspend (hba );
1010110087
1010210088 hba -> is_powered = false;
10103- /* allow force shutdown even in case of errors */
10104- return 0 ;
1010510089}
10106- EXPORT_SYMBOL (ufshcd_shutdown );
1010710090
1010810091/**
1010910092 * ufshcd_remove - de-allocate SCSI host and host memory space
0 commit comments