diff options
author | Sujit Reddy Thumma <sthumma@codeaurora.org> | 2014-07-23 02:31:12 -0400 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2014-07-25 17:17:06 -0400 |
commit | ea2aab2401576a7a2921f656d4184a0225aa138f (patch) | |
tree | 79827f74afa11831aa0a9661f11c1c3e33ff4383 /drivers/scsi/ufs | |
parent | 7289f983548b24822971d7c3c2997734ff07b2f3 (diff) |
scsi: ufs: fix endianness sparse warnings
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 <sthumma@codeaurora.org>
Signed-off-by: Dolev Raviv <draviv@codeaurora.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers/scsi/ufs')
-rw-r--r-- | drivers/scsi/ufs/ufshcd.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index a450407a56ee..ba27215b8034 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c | |||
@@ -464,7 +464,8 @@ int ufshcd_copy_query_response(struct ufs_hba *hba, struct ufshcd_lrb *lrbp) | |||
464 | /* data segment length */ | 464 | /* data segment length */ |
465 | resp_len = be32_to_cpu(lrbp->ucd_rsp_ptr->header.dword_2) & | 465 | resp_len = be32_to_cpu(lrbp->ucd_rsp_ptr->header.dword_2) & |
466 | MASK_QUERY_DATA_SEG_LEN; | 466 | MASK_QUERY_DATA_SEG_LEN; |
467 | buf_len = hba->dev_cmd.query.request.upiu_req.length; | 467 | buf_len = be16_to_cpu( |
468 | hba->dev_cmd.query.request.upiu_req.length); | ||
468 | if (likely(buf_len >= resp_len)) { | 469 | if (likely(buf_len >= resp_len)) { |
469 | memcpy(hba->dev_cmd.query.descriptor, descp, resp_len); | 470 | memcpy(hba->dev_cmd.query.descriptor, descp, resp_len); |
470 | } else { | 471 | } else { |
@@ -1342,7 +1343,7 @@ static int ufshcd_query_descriptor(struct ufs_hba *hba, | |||
1342 | ufshcd_init_query(hba, &request, &response, opcode, idn, index, | 1343 | ufshcd_init_query(hba, &request, &response, opcode, idn, index, |
1343 | selector); | 1344 | selector); |
1344 | hba->dev_cmd.query.descriptor = desc_buf; | 1345 | hba->dev_cmd.query.descriptor = desc_buf; |
1345 | request->upiu_req.length = *buf_len; | 1346 | request->upiu_req.length = cpu_to_be16(*buf_len); |
1346 | 1347 | ||
1347 | switch (opcode) { | 1348 | switch (opcode) { |
1348 | case UPIU_QUERY_OPCODE_WRITE_DESC: | 1349 | case UPIU_QUERY_OPCODE_WRITE_DESC: |
@@ -1368,7 +1369,7 @@ static int ufshcd_query_descriptor(struct ufs_hba *hba, | |||
1368 | } | 1369 | } |
1369 | 1370 | ||
1370 | hba->dev_cmd.query.descriptor = NULL; | 1371 | hba->dev_cmd.query.descriptor = NULL; |
1371 | *buf_len = response->upiu_res.length; | 1372 | *buf_len = be16_to_cpu(response->upiu_res.length); |
1372 | 1373 | ||
1373 | out_unlock: | 1374 | out_unlock: |
1374 | mutex_unlock(&hba->dev_cmd.lock); | 1375 | mutex_unlock(&hba->dev_cmd.lock); |