scsi: ufs: Use pre-calculated offsets in ufshcd_init_lrb()

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: 26f968d7de82 ("scsi: ufs: Introduce UFSHCD_QUIRK_PRDT_BYTE_GRAN quirk")
Cc: stable@vger.kernel.org
Signed-off-by: Avri Altman <avri.altman@wdc.com>
Link: https://lore.kernel.org/r/20240910044543.3812642-1-avri.altman@wdc.com
Acked-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by Avri Altman and committed by Martin K. Petersen d5130c5a 9852d85e

+2 -3
+2 -3
drivers/ufs/core/ufshcd.c
··· 2933 2933 struct utp_transfer_req_desc *utrdlp = hba->utrdl_base_addr; 2934 2934 dma_addr_t cmd_desc_element_addr = hba->ucdl_dma_addr + 2935 2935 i * ufshcd_get_ucd_size(hba); 2936 - u16 response_offset = offsetof(struct utp_transfer_cmd_desc, 2937 - response_upiu); 2938 - u16 prdt_offset = offsetof(struct utp_transfer_cmd_desc, prd_table); 2936 + u16 response_offset = le16_to_cpu(utrdlp[i].response_upiu_offset); 2937 + u16 prdt_offset = le16_to_cpu(utrdlp[i].prd_table_offset); 2939 2938 2940 2939 lrb->utr_descriptor_ptr = utrdlp + i; 2941 2940 lrb->utrd_dma_addr = hba->utrdl_dma_addr +