Commit aef80fd1 authored by Asutosh Das's avatar Asutosh Das Committed by Martin K. Petersen

scsi: ufs: sysfs: Resume the proper SCSI device

Resume the SCSI device described by the unit descriptor instead of the HBA.

Link: https://lore.kernel.org/r/889bb20c47cc1ae5e40390f533712b704000345b.1619223249.git.asutoshd@codeaurora.orgReviewed-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
Reviewed-by: default avatarCan Guo <cang@codeaurora.org>
Signed-off-by: default avatarAsutosh Das <asutoshd@codeaurora.org>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent b294ff3e
...@@ -245,9 +245,9 @@ static ssize_t wb_on_store(struct device *dev, struct device_attribute *attr, ...@@ -245,9 +245,9 @@ static ssize_t wb_on_store(struct device *dev, struct device_attribute *attr,
goto out; goto out;
} }
pm_runtime_get_sync(hba->dev); ufshcd_rpm_get_sync(hba);
res = ufshcd_wb_toggle(hba, wb_enable); res = ufshcd_wb_toggle(hba, wb_enable);
pm_runtime_put_sync(hba->dev); ufshcd_rpm_put_sync(hba);
out: out:
up(&hba->host_sem); up(&hba->host_sem);
return res < 0 ? res : count; return res < 0 ? res : count;
...@@ -297,10 +297,10 @@ static ssize_t ufs_sysfs_read_desc_param(struct ufs_hba *hba, ...@@ -297,10 +297,10 @@ static ssize_t ufs_sysfs_read_desc_param(struct ufs_hba *hba,
goto out; goto out;
} }
pm_runtime_get_sync(hba->dev); ufshcd_rpm_get_sync(hba);
ret = ufshcd_read_desc_param(hba, desc_id, desc_index, ret = ufshcd_read_desc_param(hba, desc_id, desc_index,
param_offset, desc_buf, param_size); param_offset, desc_buf, param_size);
pm_runtime_put_sync(hba->dev); ufshcd_rpm_put_sync(hba);
if (ret) { if (ret) {
ret = -EINVAL; ret = -EINVAL;
goto out; goto out;
...@@ -678,7 +678,7 @@ static ssize_t _name##_show(struct device *dev, \ ...@@ -678,7 +678,7 @@ static ssize_t _name##_show(struct device *dev, \
up(&hba->host_sem); \ up(&hba->host_sem); \
return -ENOMEM; \ return -ENOMEM; \
} \ } \
pm_runtime_get_sync(hba->dev); \ ufshcd_rpm_get_sync(hba); \
ret = ufshcd_query_descriptor_retry(hba, \ ret = ufshcd_query_descriptor_retry(hba, \
UPIU_QUERY_OPCODE_READ_DESC, QUERY_DESC_IDN_DEVICE, \ UPIU_QUERY_OPCODE_READ_DESC, QUERY_DESC_IDN_DEVICE, \
0, 0, desc_buf, &desc_len); \ 0, 0, desc_buf, &desc_len); \
...@@ -695,7 +695,7 @@ static ssize_t _name##_show(struct device *dev, \ ...@@ -695,7 +695,7 @@ static ssize_t _name##_show(struct device *dev, \
goto out; \ goto out; \
ret = sysfs_emit(buf, "%s\n", desc_buf); \ ret = sysfs_emit(buf, "%s\n", desc_buf); \
out: \ out: \
pm_runtime_put_sync(hba->dev); \ ufshcd_rpm_put_sync(hba); \
kfree(desc_buf); \ kfree(desc_buf); \
up(&hba->host_sem); \ up(&hba->host_sem); \
return ret; \ return ret; \
...@@ -744,10 +744,10 @@ static ssize_t _name##_show(struct device *dev, \ ...@@ -744,10 +744,10 @@ static ssize_t _name##_show(struct device *dev, \
} \ } \
if (ufshcd_is_wb_flags(QUERY_FLAG_IDN##_uname)) \ if (ufshcd_is_wb_flags(QUERY_FLAG_IDN##_uname)) \
index = ufshcd_wb_get_query_index(hba); \ index = ufshcd_wb_get_query_index(hba); \
pm_runtime_get_sync(hba->dev); \ ufshcd_rpm_get_sync(hba); \
ret = ufshcd_query_flag(hba, UPIU_QUERY_OPCODE_READ_FLAG, \ ret = ufshcd_query_flag(hba, UPIU_QUERY_OPCODE_READ_FLAG, \
QUERY_FLAG_IDN##_uname, index, &flag); \ QUERY_FLAG_IDN##_uname, index, &flag); \
pm_runtime_put_sync(hba->dev); \ ufshcd_rpm_put_sync(hba); \
if (ret) { \ if (ret) { \
ret = -EINVAL; \ ret = -EINVAL; \
goto out; \ goto out; \
...@@ -813,10 +813,10 @@ static ssize_t _name##_show(struct device *dev, \ ...@@ -813,10 +813,10 @@ static ssize_t _name##_show(struct device *dev, \
} \ } \
if (ufshcd_is_wb_attrs(QUERY_ATTR_IDN##_uname)) \ if (ufshcd_is_wb_attrs(QUERY_ATTR_IDN##_uname)) \
index = ufshcd_wb_get_query_index(hba); \ index = ufshcd_wb_get_query_index(hba); \
pm_runtime_get_sync(hba->dev); \ ufshcd_rpm_get_sync(hba); \
ret = ufshcd_query_attr(hba, UPIU_QUERY_OPCODE_READ_ATTR, \ ret = ufshcd_query_attr(hba, UPIU_QUERY_OPCODE_READ_ATTR, \
QUERY_ATTR_IDN##_uname, index, 0, &value); \ QUERY_ATTR_IDN##_uname, index, 0, &value); \
pm_runtime_put_sync(hba->dev); \ ufshcd_rpm_put_sync(hba); \
if (ret) { \ if (ret) { \
ret = -EINVAL; \ ret = -EINVAL; \
goto out; \ goto out; \
...@@ -964,10 +964,10 @@ static ssize_t dyn_cap_needed_attribute_show(struct device *dev, ...@@ -964,10 +964,10 @@ static ssize_t dyn_cap_needed_attribute_show(struct device *dev,
goto out; goto out;
} }
pm_runtime_get_sync(hba->dev); ufshcd_rpm_get_sync(hba);
ret = ufshcd_query_attr(hba, UPIU_QUERY_OPCODE_READ_ATTR, ret = ufshcd_query_attr(hba, UPIU_QUERY_OPCODE_READ_ATTR,
QUERY_ATTR_IDN_DYN_CAP_NEEDED, lun, 0, &value); QUERY_ATTR_IDN_DYN_CAP_NEEDED, lun, 0, &value);
pm_runtime_put_sync(hba->dev); ufshcd_rpm_put_sync(hba);
if (ret) { if (ret) {
ret = -EINVAL; ret = -EINVAL;
goto out; goto out;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment