lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <c285d5d0b34c3375436724e43644efa5@codeaurora.org>
Date:   Fri, 12 Mar 2021 09:25:14 +0800
From:   Can Guo <cang@...eaurora.org>
To:     Asutosh Das <asutoshd@...eaurora.org>
Cc:     martin.petersen@...cle.com, adrian.hunter@...el.com,
        linux-scsi@...r.kernel.org, linux-arm-msm@...r.kernel.org,
        Alim Akhtar <alim.akhtar@...sung.com>,
        Avri Altman <avri.altman@....com>,
        "James E.J. Bottomley" <jejb@...ux.ibm.com>,
        Stanley Chu <stanley.chu@...iatek.com>,
        Bean Huo <beanhuo@...ron.com>,
        Nitin Rawat <nitirawa@...eaurora.org>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v11 2/2] ufs: sysfs: Resume the proper scsi device

On 2021-03-12 06:19, 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@...eaurora.org>

You lost my reviewed-by:

reviewed-by: Can Guo <cang@...eaurora.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;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ