All of lore.kernel.org
 help / color / mirror / Atom feed
From: Can Guo <cang@codeaurora.org>
To: Asutosh Das <asutoshd@codeaurora.org>
Cc: martin.petersen@oracle.com, adrian.hunter@intel.com,
	linux-scsi@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	Alim Akhtar <alim.akhtar@samsung.com>,
	Avri Altman <avri.altman@wdc.com>,
	"James E.J. Bottomley" <jejb@linux.ibm.com>,
	Stanley Chu <stanley.chu@mediatek.com>,
	Bean Huo <beanhuo@micron.com>, Jaegeuk Kim <jaegeuk@kernel.org>,
	Nitin Rawat <nitirawa@codeaurora.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v10 2/2] ufs: sysfs: Resume the proper scsi device
Date: Wed, 03 Mar 2021 12:31:46 +0800	[thread overview]
Message-ID: <61ea8834f91d4582c93608d18352686a@codeaurora.org> (raw)
In-Reply-To: <5d7c0cd1ff4bc5295015244f057d252fe9040993.1614725302.git.asutoshd@codeaurora.org>

On 2021-03-03 06:52, Asutosh Das wrote:
> Resumes the actual scsi device the unit descriptor of which
> is being accessed instead of the hba alone.
> 
> Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>

Reviewed-by: Can Guo <cang@codeaurora.org>

> ---
>  drivers/scsi/ufs/ufs-sysfs.c | 30 +++++++++++++++++-------------
>  1 file changed, 17 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/scsi/ufs/ufs-sysfs.c 
> b/drivers/scsi/ufs/ufs-sysfs.c
> index acc54f5..3fc182b 100644
> --- a/drivers/scsi/ufs/ufs-sysfs.c
> +++ b/drivers/scsi/ufs/ufs-sysfs.c
> @@ -245,9 +245,9 @@ static ssize_t wb_on_store(struct device *dev,
> struct device_attribute *attr,
>  		goto out;
>  	}
> 
> -	pm_runtime_get_sync(hba->dev);
> +	scsi_autopm_get_device(hba->sdev_ufs_device);
>  	res = ufshcd_wb_ctrl(hba, wb_enable);
> -	pm_runtime_put_sync(hba->dev);
> +	scsi_autopm_put_device(hba->sdev_ufs_device);
>  out:
>  	up(&hba->host_sem);
>  	return res < 0 ? res : count;
> @@ -297,10 +297,10 @@ static ssize_t ufs_sysfs_read_desc_param(struct
> ufs_hba *hba,
>  		goto out;
>  	}
> 
> -	pm_runtime_get_sync(hba->dev);
> +	scsi_autopm_get_device(hba->sdev_ufs_device);
>  	ret = ufshcd_read_desc_param(hba, desc_id, desc_index,
>  				param_offset, desc_buf, param_size);
> -	pm_runtime_put_sync(hba->dev);
> +	scsi_autopm_put_device(hba->sdev_ufs_device);
>  	if (ret) {
>  		ret = -EINVAL;
>  		goto out;
> @@ -678,7 +678,7 @@ static ssize_t _name##_show(struct device 
> *dev,				\
>  		up(&hba->host_sem);					\
>  		return -ENOMEM;						\
>  	}								\
> -	pm_runtime_get_sync(hba->dev);					\
> +	scsi_autopm_get_device(hba->sdev_ufs_device);			\
>  	ret = ufshcd_query_descriptor_retry(hba,			\
>  		UPIU_QUERY_OPCODE_READ_DESC, QUERY_DESC_IDN_DEVICE,	\
>  		0, 0, desc_buf, &desc_len);				\
> @@ -695,7 +695,7 @@ static ssize_t _name##_show(struct device 
> *dev,				\
>  		goto out;						\
>  	ret = sysfs_emit(buf, "%s\n", desc_buf);			\
>  out:									\
> -	pm_runtime_put_sync(hba->dev);					\
> +	scsi_autopm_put_device(hba->sdev_ufs_device);			\
>  	kfree(desc_buf);						\
>  	up(&hba->host_sem);						\
>  	return ret;							\
> @@ -744,10 +744,10 @@ static ssize_t _name##_show(struct device 
> *dev,				\
>  	}								\
>  	if (ufshcd_is_wb_flags(QUERY_FLAG_IDN##_uname))			\
>  		index = ufshcd_wb_get_query_index(hba);			\
> -	pm_runtime_get_sync(hba->dev);					\
> +	scsi_autopm_get_device(hba->sdev_ufs_device);			\
>  	ret = ufshcd_query_flag(hba, UPIU_QUERY_OPCODE_READ_FLAG,	\
>  		QUERY_FLAG_IDN##_uname, index, &flag);			\
> -	pm_runtime_put_sync(hba->dev);					\
> +	scsi_autopm_put_device(hba->sdev_ufs_device);			\
>  	if (ret) {							\
>  		ret = -EINVAL;						\
>  		goto out;						\
> @@ -813,10 +813,10 @@ static ssize_t _name##_show(struct device 
> *dev,				\
>  	}								\
>  	if (ufshcd_is_wb_attrs(QUERY_ATTR_IDN##_uname))			\
>  		index = ufshcd_wb_get_query_index(hba);			\
> -	pm_runtime_get_sync(hba->dev);					\
> +	scsi_autopm_get_device(hba->sdev_ufs_device);			\
>  	ret = ufshcd_query_attr(hba, UPIU_QUERY_OPCODE_READ_ATTR,	\
>  		QUERY_ATTR_IDN##_uname, index, 0, &value);		\
> -	pm_runtime_put_sync(hba->dev);					\
> +	scsi_autopm_put_device(hba->sdev_ufs_device);			\
>  	if (ret) {							\
>  		ret = -EINVAL;						\
>  		goto out;						\
> @@ -899,11 +899,15 @@ static ssize_t _pname##_show(struct device 
> *dev,			\
>  	struct scsi_device *sdev = to_scsi_device(dev);			\
>  	struct ufs_hba *hba = shost_priv(sdev->host);			\
>  	u8 lun = ufshcd_scsi_to_upiu_lun(sdev->lun);			\
> +	int ret;							\
>  	if (!ufs_is_valid_unit_desc_lun(&hba->dev_info, lun,		\
>  				_duname##_DESC_PARAM##_puname))		\
>  		return -EINVAL;						\
> -	return ufs_sysfs_read_desc_param(hba, QUERY_DESC_IDN_##_duname,	\
> +	scsi_autopm_get_device(sdev);					\
> +	ret = ufs_sysfs_read_desc_param(hba, QUERY_DESC_IDN_##_duname,	\
>  		lun, _duname##_DESC_PARAM##_puname, buf, _size);	\
> +	scsi_autopm_put_device(sdev);					\
> +	return ret;							\
>  }									\
>  static DEVICE_ATTR_RO(_pname)
> 
> @@ -964,10 +968,10 @@ static ssize_t
> dyn_cap_needed_attribute_show(struct device *dev,
>  		goto out;
>  	}
> 
> -	pm_runtime_get_sync(hba->dev);
> +	scsi_autopm_get_device(hba->sdev_ufs_device);
>  	ret = ufshcd_query_attr(hba, UPIU_QUERY_OPCODE_READ_ATTR,
>  		QUERY_ATTR_IDN_DYN_CAP_NEEDED, lun, 0, &value);
> -	pm_runtime_put_sync(hba->dev);
> +	scsi_autopm_put_device(hba->sdev_ufs_device);
>  	if (ret) {
>  		ret = -EINVAL;
>  		goto out;

  reply	other threads:[~2021-03-03 21:42 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-02 22:52 [PATCH v10 0/2] Enable power management for ufs wlun Asutosh Das
2021-03-02 22:52 ` Asutosh Das
2021-03-02 22:52 ` Asutosh Das
2021-03-02 22:52 ` [PATCH v10 1/2] scsi: ufs: Enable power management for wlun Asutosh Das
2021-03-02 22:52   ` Asutosh Das
2021-03-02 22:52   ` Asutosh Das
2021-03-04 15:35   ` Adrian Hunter
2021-03-04 15:35     ` Adrian Hunter
2021-03-04 15:35     ` Adrian Hunter
2021-03-06  2:54     ` Asutosh Das (asd)
2021-03-06  2:54       ` Asutosh Das (asd)
2021-03-06 16:16       ` Alan Stern
2021-03-06 16:16         ` Alan Stern
2021-03-06 16:16         ` Alan Stern
2021-03-08 16:21         ` Rafael J. Wysocki
2021-03-08 16:21           ` Rafael J. Wysocki
2021-03-08 16:21           ` Rafael J. Wysocki
2021-03-08 17:17           ` Rafael J. Wysocki
2021-03-08 17:17             ` Rafael J. Wysocki
2021-03-08 17:17             ` Rafael J. Wysocki
2021-03-09 15:56             ` Asutosh Das (asd)
2021-03-09 15:56               ` Asutosh Das (asd)
2021-03-10  3:04               ` Asutosh Das (asd)
2021-03-10  3:04                 ` Asutosh Das (asd)
2021-03-10  3:14                 ` Alan Stern
2021-03-10  3:14                   ` Alan Stern
2021-03-10  3:14                   ` Alan Stern
2021-03-10  4:04                   ` Asutosh Das (asd)
2021-03-10  4:04                     ` Asutosh Das (asd)
2021-03-10 16:27                     ` Alan Stern
2021-03-10 16:27                       ` Alan Stern
2021-03-10 16:27                       ` Alan Stern
2021-03-10 16:39                       ` Asutosh Das (asd)
2021-03-10 16:39                         ` Asutosh Das (asd)
2021-03-14  9:11                 ` Adrian Hunter
2021-03-14  9:11                   ` Adrian Hunter
2021-03-14  9:11                   ` Adrian Hunter
2021-03-15 22:22                   ` Asutosh Das (asd)
2021-03-15 22:22                     ` Asutosh Das (asd)
2021-03-16  7:48                     ` Adrian Hunter
2021-03-16  7:48                       ` Adrian Hunter
2021-03-16  7:48                       ` Adrian Hunter
2021-03-16 20:35                       ` Asutosh Das (asd)
2021-03-16 20:35                         ` Asutosh Das (asd)
2021-03-17  6:37                         ` Adrian Hunter
2021-03-17  6:37                           ` Adrian Hunter
2021-03-17  6:37                           ` Adrian Hunter
2021-03-18 14:00                           ` Rafael J. Wysocki
2021-03-18 14:00                             ` Rafael J. Wysocki
2021-03-18 14:00                             ` Rafael J. Wysocki
2021-03-18 17:27                             ` Asutosh Das (asd)
2021-03-18 17:27                               ` Asutosh Das (asd)
2021-03-18 17:54                               ` Rafael J. Wysocki
2021-03-18 17:54                                 ` Rafael J. Wysocki
2021-03-18 17:54                                 ` Rafael J. Wysocki
2021-03-18 17:58                                 ` Asutosh Das (asd)
2021-03-18 17:58                                   ` Asutosh Das (asd)
2021-03-18 19:16                                   ` Adrian Hunter
2021-03-18 19:16                                     ` Adrian Hunter
2021-03-18 19:16                                     ` Adrian Hunter
2021-03-19  0:40                                     ` Asutosh Das (asd)
2021-03-19  0:40                                       ` Asutosh Das (asd)
2021-03-02 22:52 ` [PATCH v10 2/2] ufs: sysfs: Resume the proper scsi device Asutosh Das
2021-03-03  4:31   ` Can Guo [this message]
2021-03-04  7:45   ` Adrian Hunter
2021-03-04 15:32     ` Asutosh Das

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=61ea8834f91d4582c93608d18352686a@codeaurora.org \
    --to=cang@codeaurora.org \
    --cc=adrian.hunter@intel.com \
    --cc=alim.akhtar@samsung.com \
    --cc=asutoshd@codeaurora.org \
    --cc=avri.altman@wdc.com \
    --cc=beanhuo@micron.com \
    --cc=jaegeuk@kernel.org \
    --cc=jejb@linux.ibm.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=nitirawa@codeaurora.org \
    --cc=stanley.chu@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.