From: Sujit Reddy Thumma <[email protected]>

Fix many warnings with incorrect endian assumptions
which makes the code unportable to new architectures.

The UFS specification defines the byte order as big-endian
for UPIU structure and little-endian for the host controller
transfer/task management descriptors.

Signed-off-by: Sujit Reddy Thumma <[email protected]>
Signed-off-by: Dolev Raviv <[email protected]>
---
 drivers/scsi/ufs/ufshcd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 694c8cc..514f65a 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -1325,7 +1325,7 @@ static int ufshcd_query_descriptor(struct ufs_hba *hba,
        ufshcd_init_query(hba, &request, &response, opcode, idn, index,
                        selector);
        hba->dev_cmd.query.descriptor = desc_buf;
-       request->upiu_req.length = *buf_len;
+       request->upiu_req.length = cpu_to_be16(*buf_len);
 
        switch (opcode) {
        case UPIU_QUERY_OPCODE_WRITE_DESC:
@@ -1351,7 +1351,7 @@ static int ufshcd_query_descriptor(struct ufs_hba *hba,
        }
 
        hba->dev_cmd.query.descriptor = NULL;
-       *buf_len = response->upiu_res.length;
+       *buf_len = be16_to_cpu(response->upiu_res.length);
 
 out_unlock:
        mutex_unlock(&hba->dev_cmd.lock);
-- 
1.8.5.2

--
QUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center, Inc. is a member of 
Code Aurora Forum, hosted by The Linux Foundation

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to