Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2d98cfef authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "scsi: ufs: fix race between shutdown and rls handler"

parents cbe74cd8 6dbfcba7
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -1204,8 +1204,8 @@ static int ufsdbg_config_pwr_mode(struct ufs_hba *hba,
	/* let's not get into low power until clock scaling is completed */
	/* let's not get into low power until clock scaling is completed */
	hba->ufs_stats.clk_hold.ctx = DBGFS_CFG_PWR_MODE;
	hba->ufs_stats.clk_hold.ctx = DBGFS_CFG_PWR_MODE;
	ufshcd_hold(hba, false);
	ufshcd_hold(hba, false);
	ufshcd_scsi_block_requests(hba);
	down_write(&hba->lock);
	down_write(&hba->lock);
	ufshcd_scsi_block_requests(hba);
	if (ufshcd_wait_for_doorbell_clr(hba, DOORBELL_CLR_TOUT_US)) {
	if (ufshcd_wait_for_doorbell_clr(hba, DOORBELL_CLR_TOUT_US)) {
		ret = -EBUSY;
		ret = -EBUSY;
		goto out;
		goto out;
+4 −2
Original line number Original line Diff line number Diff line
@@ -1735,8 +1735,8 @@ static int ufshcd_clock_scaling_prepare(struct ufs_hba *hba)
	 * make sure that there are no outstanding requests when
	 * make sure that there are no outstanding requests when
	 * clock scaling is in progress
	 * clock scaling is in progress
	 */
	 */
	ufshcd_scsi_block_requests(hba);
	down_write(&hba->lock);
	down_write(&hba->lock);
	ufshcd_scsi_block_requests(hba);
	if (ufshcd_wait_for_doorbell_clr(hba, DOORBELL_CLR_TOUT_US)) {
	if (ufshcd_wait_for_doorbell_clr(hba, DOORBELL_CLR_TOUT_US)) {
		ret = -EBUSY;
		ret = -EBUSY;
		up_write(&hba->lock);
		up_write(&hba->lock);
@@ -7348,8 +7348,10 @@ static void ufshcd_rls_handler(struct work_struct *work)
	hba = container_of(work, struct ufs_hba, rls_work);
	hba = container_of(work, struct ufs_hba, rls_work);


	pm_runtime_get_sync(hba->dev);
	pm_runtime_get_sync(hba->dev);
	ufshcd_scsi_block_requests(hba);
	down_write(&hba->lock);
	down_write(&hba->lock);
	ufshcd_scsi_block_requests(hba);
	if (ufshcd_is_shutdown_ongoing(hba))
		goto out;
	ret = ufshcd_wait_for_doorbell_clr(hba, U64_MAX);
	ret = ufshcd_wait_for_doorbell_clr(hba, U64_MAX);
	if (ret) {
	if (ret) {
		dev_err(hba->dev,
		dev_err(hba->dev,