Always read the descriptor with QUERY_DESC_MAX_SIZE.
According to the spec, the device returns the actual size
Reviewed-by: Bean Huo <beanhuo@xxxxxxxxxx>
Signed-off-by: Arthur Simchaev <Arthur.Simchaev@xxxxxxx>
---
drivers/ufs/core/ufshcd.c | 53 +++++++++++++----------------------------------
include/ufs/ufs.h | 1 -
include/ufs/ufshcd.h | 1 -
3 files changed, 14 insertions(+), 41 deletions(-)
diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 2e47c69..70e96b6 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -3377,28 +3377,11 @@ int ufshcd_query_descriptor_retry(struct ufs_hba *hba,
void ufshcd_map_desc_id_to_length(struct ufs_hba *hba, enum desc_idn desc_id,
int *desc_len)
{
- if (desc_id >= QUERY_DESC_IDN_MAX || desc_id == QUERY_DESC_IDN_RFU_0 ||
- desc_id == QUERY_DESC_IDN_RFU_1)
- *desc_len = 0;
- else
- *desc_len = hba->desc_size[desc_id];
+ /*Always returns QUERY_DESC_MAX_SIZE*/
+ *desc_len = QUERY_DESC_MAX_SIZE;
}
EXPORT_SYMBOL(ufshcd_map_desc_id_to_length);