Skip to content

Commit f695b03

Browse files
avri-altman-sndkgregkh
authored andcommitted
scsi: ufs: Use pre-calculated offsets in ufshcd_init_lrb()
commit d5130c5 upstream. Replace manual offset calculations for response_upiu and prd_table in ufshcd_init_lrb() with pre-calculated offsets already stored in the utp_transfer_req_desc structure. The pre-calculated offsets are set differently in ufshcd_host_memory_configure() based on the UFSHCD_QUIRK_PRDT_BYTE_GRAN quirk, ensuring correct alignment and access. Fixes: 26f968d ("scsi: ufs: Introduce UFSHCD_QUIRK_PRDT_BYTE_GRAN quirk") Cc: [email protected] Signed-off-by: Avri Altman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Acked-by: Bart Van Assche <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 4b5f73a commit f695b03

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

drivers/ufs/core/ufshcd.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2804,9 +2804,8 @@ static void ufshcd_init_lrb(struct ufs_hba *hba, struct ufshcd_lrb *lrb, int i)
28042804
struct utp_transfer_req_desc *utrdlp = hba->utrdl_base_addr;
28052805
dma_addr_t cmd_desc_element_addr = hba->ucdl_dma_addr +
28062806
i * ufshcd_get_ucd_size(hba);
2807-
u16 response_offset = offsetof(struct utp_transfer_cmd_desc,
2808-
response_upiu);
2809-
u16 prdt_offset = offsetof(struct utp_transfer_cmd_desc, prd_table);
2807+
u16 response_offset = le16_to_cpu(utrdlp[i].response_upiu_offset);
2808+
u16 prdt_offset = le16_to_cpu(utrdlp[i].prd_table_offset);
28102809

28112810
lrb->utr_descriptor_ptr = utrdlp + i;
28122811
lrb->utrd_dma_addr = hba->utrdl_dma_addr +

0 commit comments

Comments
 (0)