Re: [PATCH v2 4/4] scsi: ufs: Re-use compose_devman_upiu
From: Bean Huo
Date: Thu Mar 07 2024 - 08:06:54 EST
On Tue, 2024-03-05 at 23:00 +0200, Avri Altman wrote:
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index c9c2b7f99758..a39a2b34ee2b 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -2710,18 +2710,27 @@ static void ufshcd_disable_intr(struct
> ufs_hba *hba, u32 intrs)
> /**
> * ufshcd_prepare_req_desc_hdr - Fill UTP Transfer request
> descriptor header according to request
> * descriptor according to request
> + * @hba: per adapter instance
> * @lrbp: pointer to local reference block
> * @upiu_flags: flags required in the header
> * @cmd_dir: requests data direction
> * @ehs_length: Total EHS Length (in 32‐bytes units of all Extra
> Header Segments)
> + * @scsi: scsi or device management`
^ '`'
> */
> -static void ufshcd_prepare_req_desc_hdr(struct ufshcd_lrb *lrbp, u8
> *upiu_flags,
> - enum dma_data_direction
> cmd_dir, int ehs_length)
> +static void
> +ufshcd_prepare_req_desc_hdr(struct ufs_hba *hba, struct ufshcd_lrb
> *lrbp,
> + u8 *upiu_flags, enum dma_data_direction
> cmd_dir,
> + int ehs_length, bool scsi)
Why not directly pass UTP_CMD_TYPE_SCSI or UTP_CMD_TYPE_DEV_MANAGE
instead of using below ?: logic?
> {
> struct utp_transfer_req_desc *req_desc = lrbp-
> >utr_descriptor_ptr;
> struct request_desc_header *h = &req_desc->header;
> enum utp_data_direction data_direction;
>
> + if (hba->ufs_version <= ufshci_version(1, 1))
> + lrbp->command_type = scsi ? UTP_CMD_TYPE_SCSI :
> UTP_CMD_TYPE_DEV_MANAGE;