scsi: ufs: core: Pass a SCSI pointer instead of an LRB pointer
Pass a pointer to a SCSI command between functions instead of an LRB pointer. This change prepares for removing the ufshcd_lrb task_tag member. Signed-off-by: Bart Van Assche <bvanassche@acm.org> Link: https://patch.msgid.link/20251031204029.2883185-25-bvanassche@acm.org Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
committed by
Martin K. Petersen
parent
22089c2180
commit
176b93004c
@@ -2822,12 +2822,13 @@ static void ufshcd_prepare_utp_scsi_cmd_upiu(struct scsi_cmnd *cmd,
|
|||||||
/**
|
/**
|
||||||
* ufshcd_prepare_utp_query_req_upiu() - fill the utp_transfer_req_desc for query request
|
* ufshcd_prepare_utp_query_req_upiu() - fill the utp_transfer_req_desc for query request
|
||||||
* @hba: UFS hba
|
* @hba: UFS hba
|
||||||
* @lrbp: local reference block pointer
|
* @cmd: SCSI command pointer
|
||||||
* @upiu_flags: flags
|
* @upiu_flags: flags
|
||||||
*/
|
*/
|
||||||
static void ufshcd_prepare_utp_query_req_upiu(struct ufs_hba *hba,
|
static void ufshcd_prepare_utp_query_req_upiu(struct ufs_hba *hba,
|
||||||
struct ufshcd_lrb *lrbp, u8 upiu_flags)
|
struct scsi_cmnd *cmd, u8 upiu_flags)
|
||||||
{
|
{
|
||||||
|
struct ufshcd_lrb *lrbp = scsi_cmd_priv(cmd);
|
||||||
struct utp_upiu_req *ucd_req_ptr = lrbp->ucd_req_ptr;
|
struct utp_upiu_req *ucd_req_ptr = lrbp->ucd_req_ptr;
|
||||||
struct ufs_query *query = &hba->dev_cmd.query;
|
struct ufs_query *query = &hba->dev_cmd.query;
|
||||||
u16 len = be16_to_cpu(query->request.upiu_req.length);
|
u16 len = be16_to_cpu(query->request.upiu_req.length);
|
||||||
@@ -2856,8 +2857,9 @@ static void ufshcd_prepare_utp_query_req_upiu(struct ufs_hba *hba,
|
|||||||
memcpy(ucd_req_ptr + 1, query->descriptor, len);
|
memcpy(ucd_req_ptr + 1, query->descriptor, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void ufshcd_prepare_utp_nop_upiu(struct ufshcd_lrb *lrbp)
|
static inline void ufshcd_prepare_utp_nop_upiu(struct scsi_cmnd *cmd)
|
||||||
{
|
{
|
||||||
|
struct ufshcd_lrb *lrbp = scsi_cmd_priv(cmd);
|
||||||
struct utp_upiu_req *ucd_req_ptr = lrbp->ucd_req_ptr;
|
struct utp_upiu_req *ucd_req_ptr = lrbp->ucd_req_ptr;
|
||||||
|
|
||||||
memset(ucd_req_ptr, 0, sizeof(struct utp_upiu_req));
|
memset(ucd_req_ptr, 0, sizeof(struct utp_upiu_req));
|
||||||
@@ -2872,22 +2874,23 @@ static inline void ufshcd_prepare_utp_nop_upiu(struct ufshcd_lrb *lrbp)
|
|||||||
* ufshcd_compose_devman_upiu - UFS Protocol Information Unit(UPIU)
|
* ufshcd_compose_devman_upiu - UFS Protocol Information Unit(UPIU)
|
||||||
* for Device Management Purposes
|
* for Device Management Purposes
|
||||||
* @hba: per adapter instance
|
* @hba: per adapter instance
|
||||||
* @lrbp: pointer to local reference block
|
* @cmd: SCSI command pointer
|
||||||
*
|
*
|
||||||
* Return: 0 upon success; < 0 upon failure.
|
* Return: 0 upon success; < 0 upon failure.
|
||||||
*/
|
*/
|
||||||
static int ufshcd_compose_devman_upiu(struct ufs_hba *hba,
|
static int ufshcd_compose_devman_upiu(struct ufs_hba *hba,
|
||||||
struct ufshcd_lrb *lrbp)
|
struct scsi_cmnd *cmd)
|
||||||
{
|
{
|
||||||
|
struct ufshcd_lrb *lrbp = scsi_cmd_priv(cmd);
|
||||||
u8 upiu_flags;
|
u8 upiu_flags;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
ufshcd_prepare_req_desc_hdr(hba, lrbp, &upiu_flags, DMA_NONE, 0);
|
ufshcd_prepare_req_desc_hdr(hba, lrbp, &upiu_flags, DMA_NONE, 0);
|
||||||
|
|
||||||
if (hba->dev_cmd.type == DEV_CMD_TYPE_QUERY)
|
if (hba->dev_cmd.type == DEV_CMD_TYPE_QUERY)
|
||||||
ufshcd_prepare_utp_query_req_upiu(hba, lrbp, upiu_flags);
|
ufshcd_prepare_utp_query_req_upiu(hba, cmd, upiu_flags);
|
||||||
else if (hba->dev_cmd.type == DEV_CMD_TYPE_NOP)
|
else if (hba->dev_cmd.type == DEV_CMD_TYPE_NOP)
|
||||||
ufshcd_prepare_utp_nop_upiu(lrbp);
|
ufshcd_prepare_utp_nop_upiu(cmd);
|
||||||
else
|
else
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
|
|
||||||
@@ -3126,11 +3129,9 @@ static void ufshcd_setup_dev_cmd(struct ufs_hba *hba, struct scsi_cmnd *cmd,
|
|||||||
static int ufshcd_compose_dev_cmd(struct ufs_hba *hba, struct scsi_cmnd *cmd,
|
static int ufshcd_compose_dev_cmd(struct ufs_hba *hba, struct scsi_cmnd *cmd,
|
||||||
enum dev_cmd_type cmd_type, int tag)
|
enum dev_cmd_type cmd_type, int tag)
|
||||||
{
|
{
|
||||||
struct ufshcd_lrb *lrbp = scsi_cmd_priv(cmd);
|
|
||||||
|
|
||||||
ufshcd_setup_dev_cmd(hba, cmd, cmd_type, 0, tag);
|
ufshcd_setup_dev_cmd(hba, cmd, cmd_type, 0, tag);
|
||||||
|
|
||||||
return ufshcd_compose_devman_upiu(hba, lrbp);
|
return ufshcd_compose_devman_upiu(hba, cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user