2021-09-02 01:35:17

by Daejun Park

[permalink] [raw]
Subject: [PATCH] scsi: ufs: ufshpb: Use proper power management API

In ufshpb, pm_runtime_{get,put}_sync() are used to avoid unwanted runtime
suspend during query requests. In commit b294ff3e3449 ("scsi: ufs: core:
Enable power management for wlun") has been modified to use
ufshcd_rpm_{get,put}_sync() APIs.

This patch has been modified to use these APIs in HPB module.

Signed-off-by: Daejun Park <[email protected]>
---
drivers/scsi/ufs/ufshpb.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/ufs/ufshpb.c b/drivers/scsi/ufs/ufshpb.c
index 02fb51ae8b25..9ea639bf6a59 100644
--- a/drivers/scsi/ufs/ufshpb.c
+++ b/drivers/scsi/ufs/ufshpb.c
@@ -2650,11 +2650,11 @@ static int ufshpb_get_lu_info(struct ufs_hba *hba, int lun,

ufshcd_map_desc_id_to_length(hba, QUERY_DESC_IDN_UNIT, &size);

- pm_runtime_get_sync(hba->dev);
+ ufshcd_rpm_get_sync(hba);
ret = ufshcd_query_descriptor_retry(hba, UPIU_QUERY_OPCODE_READ_DESC,
QUERY_DESC_IDN_UNIT, lun, 0,
desc_buf, &size);
- pm_runtime_put_sync(hba->dev);
+ ufshcd_rpm_put_sync(hba);

if (ret) {
dev_err(hba->dev,
@@ -2877,10 +2877,10 @@ void ufshpb_get_dev_info(struct ufs_hba *hba, u8 *desc_buf)
if (version == HPB_SUPPORT_LEGACY_VERSION)
hpb_dev_info->is_legacy = true;

- pm_runtime_get_sync(hba->dev);
+ ufshcd_rpm_get_sync(hba);
ret = ufshcd_query_attr_retry(hba, UPIU_QUERY_OPCODE_READ_ATTR,
QUERY_ATTR_IDN_MAX_HPB_SINGLE_CMD, 0, 0, &max_hpb_single_cmd);
- pm_runtime_put_sync(hba->dev);
+ ufshcd_rpm_put_sync(hba);

if (ret)
dev_err(hba->dev, "%s: idn: read max size of single hpb cmd query request failed",
--
2.25.1


2021-09-14 08:43:28

by Avri Altman

[permalink] [raw]
Subject: RE: [PATCH] scsi: ufs: ufshpb: Use proper power management API


> In ufshpb, pm_runtime_{get,put}_sync() are used to avoid unwanted runtime
> suspend during query requests. In commit b294ff3e3449 ("scsi: ufs: core:
> Enable power management for wlun") has been modified to use
> ufshcd_rpm_{get,put}_sync() APIs.
>
> This patch has been modified to use these APIs in HPB module.
>
> Signed-off-by: Daejun Park <[email protected]>
Reviewed-by: Avri Altman <[email protected]>


> ---
> drivers/scsi/ufs/ufshpb.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/scsi/ufs/ufshpb.c b/drivers/scsi/ufs/ufshpb.c
> index 02fb51ae8b25..9ea639bf6a59 100644
> --- a/drivers/scsi/ufs/ufshpb.c
> +++ b/drivers/scsi/ufs/ufshpb.c
> @@ -2650,11 +2650,11 @@ static int ufshpb_get_lu_info(struct ufs_hba *hba,
> int lun,
>
> ufshcd_map_desc_id_to_length(hba, QUERY_DESC_IDN_UNIT, &size);
>
> - pm_runtime_get_sync(hba->dev);
> + ufshcd_rpm_get_sync(hba);
> ret = ufshcd_query_descriptor_retry(hba,
> UPIU_QUERY_OPCODE_READ_DESC,
> QUERY_DESC_IDN_UNIT, lun, 0,
> desc_buf, &size);
> - pm_runtime_put_sync(hba->dev);
> + ufshcd_rpm_put_sync(hba);
>
> if (ret) {
> dev_err(hba->dev,
> @@ -2877,10 +2877,10 @@ void ufshpb_get_dev_info(struct ufs_hba *hba, u8
> *desc_buf)
> if (version == HPB_SUPPORT_LEGACY_VERSION)
> hpb_dev_info->is_legacy = true;
>
> - pm_runtime_get_sync(hba->dev);
> + ufshcd_rpm_get_sync(hba);
> ret = ufshcd_query_attr_retry(hba, UPIU_QUERY_OPCODE_READ_ATTR,
> QUERY_ATTR_IDN_MAX_HPB_SINGLE_CMD, 0, 0,
> &max_hpb_single_cmd);
> - pm_runtime_put_sync(hba->dev);
> + ufshcd_rpm_put_sync(hba);
>
> if (ret)
> dev_err(hba->dev, "%s: idn: read max size of single hpb cmd query
> request failed",
> --
> 2.25.1

2021-09-15 03:31:19

by Martin K. Petersen

[permalink] [raw]
Subject: Re: [PATCH] scsi: ufs: ufshpb: Use proper power management API


Daejun,

> In ufshpb, pm_runtime_{get,put}_sync() are used to avoid unwanted
> runtime suspend during query requests. In commit b294ff3e3449 ("scsi:
> ufs: core: Enable power management for wlun") has been modified to use
> ufshcd_rpm_{get,put}_sync() APIs.

Applied to 5.16/scsi-staging, thanks!

--
Martin K. Petersen Oracle Linux Engineering

2021-09-22 04:48:53

by Martin K. Petersen

[permalink] [raw]
Subject: Re: [PATCH] scsi: ufs: ufshpb: Use proper power management API

On Thu, 02 Sep 2021 09:35:34 +0900, Daejun Park wrote:

> In ufshpb, pm_runtime_{get,put}_sync() are used to avoid unwanted runtime
> suspend during query requests. In commit b294ff3e3449 ("scsi: ufs: core:
> Enable power management for wlun") has been modified to use
> ufshcd_rpm_{get,put}_sync() APIs.
>
> This patch has been modified to use these APIs in HPB module.
>
> [...]

Applied to 5.16/scsi-queue, thanks!

[1/1] scsi: ufs: ufshpb: Use proper power management API
https://git.kernel.org/mkp/scsi/c/351b3a849ac7

--
Martin K. Petersen Oracle Linux Engineering