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

Commit 6cc7a1b3 authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "scsi: ufs: Release rw_sem while sending device management requests"

parents ec0df75a 5fa13e17
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -4044,6 +4044,7 @@ static int ufshcd_exec_dev_cmd(struct ufs_hba *hba,
	int tag;
	struct completion wait;
	unsigned long flags;
	bool has_read_lock = false;

	/*
	 * May get invoked from shutdown and IOCTL contexts.
@@ -4051,8 +4052,10 @@ static int ufshcd_exec_dev_cmd(struct ufs_hba *hba,
	 * In error recovery context, it may come with lock acquired.
	 */

	if (!ufshcd_is_shutdown_ongoing(hba) && !ufshcd_eh_in_progress(hba))
	if (!ufshcd_is_shutdown_ongoing(hba) && !ufshcd_eh_in_progress(hba)) {
		down_read(&hba->lock);
		has_read_lock = true;
	}

	/*
	 * Get free slot, sleep if slots are unavailable.
@@ -4090,7 +4093,7 @@ static int ufshcd_exec_dev_cmd(struct ufs_hba *hba,
out_put_tag:
	ufshcd_put_dev_cmd_tag(hba, tag);
	wake_up(&hba->dev_cmd.tag_wq);
	if (!ufshcd_is_shutdown_ongoing(hba) && !ufshcd_eh_in_progress(hba))
	if (has_read_lock)
		up_read(&hba->lock);
	return err;
}