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

Commit 74e5e468 authored by Avri Altman's avatar Avri Altman Committed by Martin K. Petersen
Browse files

scsi: ufs-bsg: Wake the device before sending raw upiu commands

The scsi async probe process is calling blk_pm_runtime_init for each lun,
and then those request queues are monitored by the block layer pm
engine (blk-pm.c).  This is however, not the case for scsi-passthrough
queues, created by bsg_setup_queue().

So the ufs-bsg driver might send various commands, disregarding the pm
status of the device. This is wrong, regardless if its request queue is
pm-aware or not.

Fixes: df032bf2 (scsi: ufs: Add a bsg endpoint that supports UPIUs)
Link: https://lore.kernel.org/r/1570696267-8487-1-git-send-email-avri.altman@wdc.com


Reported-by: default avatarYuliy Izrailov <yuliy.izrailov@wdc.com>
Signed-off-by: default avatarAvri Altman <avri.altman@wdc.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 535fb49e
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -98,6 +98,8 @@ static int ufs_bsg_request(struct bsg_job *job)


	bsg_reply->reply_payload_rcv_len = 0;
	bsg_reply->reply_payload_rcv_len = 0;


	pm_runtime_get_sync(hba->dev);

	msgcode = bsg_request->msgcode;
	msgcode = bsg_request->msgcode;
	switch (msgcode) {
	switch (msgcode) {
	case UPIU_TRANSACTION_QUERY_REQ:
	case UPIU_TRANSACTION_QUERY_REQ:
@@ -135,6 +137,8 @@ static int ufs_bsg_request(struct bsg_job *job)
		break;
		break;
	}
	}


	pm_runtime_put_sync(hba->dev);

	if (!desc_buff)
	if (!desc_buff)
		goto out;
		goto out;