Commit 12bc2f13 authored by Martin K. Petersen's avatar Martin K. Petersen

scsi: ufs: ufshpb: Use scsi_cmd_to_rq() instead of scsi_cmnd.request

Prepare for removal of the request pointer by using scsi_cmd_to_rq()
instead. This patch does not change any functionality.

Link: https://lore.kernel.org/r/20210809230355.8186-1-bvanassche@acm.orgSigned-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent c5bf198c
...@@ -70,13 +70,13 @@ static int ufshpb_is_valid_srgn(struct ufshpb_region *rgn, ...@@ -70,13 +70,13 @@ static int ufshpb_is_valid_srgn(struct ufshpb_region *rgn,
static bool ufshpb_is_read_cmd(struct scsi_cmnd *cmd) static bool ufshpb_is_read_cmd(struct scsi_cmnd *cmd)
{ {
return req_op(cmd->request) == REQ_OP_READ; return req_op(scsi_cmd_to_rq(cmd)) == REQ_OP_READ;
} }
static bool ufshpb_is_write_or_discard(struct scsi_cmnd *cmd) static bool ufshpb_is_write_or_discard(struct scsi_cmnd *cmd)
{ {
return op_is_write(req_op(cmd->request)) || return op_is_write(req_op(scsi_cmd_to_rq(cmd))) ||
op_is_discard(req_op(cmd->request)); op_is_discard(req_op(scsi_cmd_to_rq(cmd)));
} }
static bool ufshpb_is_supported_chunk(struct ufshpb_lu *hpb, int transfer_len) static bool ufshpb_is_supported_chunk(struct ufshpb_lu *hpb, int transfer_len)
...@@ -526,9 +526,9 @@ static int ufshpb_execute_pre_req(struct ufshpb_lu *hpb, struct scsi_cmnd *cmd, ...@@ -526,9 +526,9 @@ static int ufshpb_execute_pre_req(struct ufshpb_lu *hpb, struct scsi_cmnd *cmd,
pre_req->hpb = hpb; pre_req->hpb = hpb;
pre_req->wb.lpn = sectors_to_logical(cmd->device, pre_req->wb.lpn = sectors_to_logical(cmd->device,
blk_rq_pos(cmd->request)); blk_rq_pos(scsi_cmd_to_rq(cmd)));
pre_req->wb.len = sectors_to_logical(cmd->device, pre_req->wb.len = sectors_to_logical(cmd->device,
blk_rq_sectors(cmd->request)); blk_rq_sectors(scsi_cmd_to_rq(cmd)));
if (ufshpb_pre_req_add_bio_page(hpb, q, pre_req)) if (ufshpb_pre_req_add_bio_page(hpb, q, pre_req))
return -ENOMEM; return -ENOMEM;
...@@ -626,17 +626,17 @@ int ufshpb_prep(struct ufs_hba *hba, struct ufshcd_lrb *lrbp) ...@@ -626,17 +626,17 @@ int ufshpb_prep(struct ufs_hba *hba, struct ufshcd_lrb *lrbp)
return -ENODEV; return -ENODEV;
} }
if (blk_rq_is_passthrough(cmd->request) || if (blk_rq_is_passthrough(scsi_cmd_to_rq(cmd)) ||
(!ufshpb_is_write_or_discard(cmd) && (!ufshpb_is_write_or_discard(cmd) &&
!ufshpb_is_read_cmd(cmd))) !ufshpb_is_read_cmd(cmd)))
return 0; return 0;
transfer_len = sectors_to_logical(cmd->device, transfer_len = sectors_to_logical(cmd->device,
blk_rq_sectors(cmd->request)); blk_rq_sectors(scsi_cmd_to_rq(cmd)));
if (unlikely(!transfer_len)) if (unlikely(!transfer_len))
return 0; return 0;
lpn = sectors_to_logical(cmd->device, blk_rq_pos(cmd->request)); lpn = sectors_to_logical(cmd->device, blk_rq_pos(scsi_cmd_to_rq(cmd)));
ufshpb_get_pos_from_lpn(hpb, lpn, &rgn_idx, &srgn_idx, &srgn_offset); ufshpb_get_pos_from_lpn(hpb, lpn, &rgn_idx, &srgn_idx, &srgn_offset);
rgn = hpb->rgn_tbl + rgn_idx; rgn = hpb->rgn_tbl + rgn_idx;
srgn = rgn->srgn_tbl + srgn_idx; srgn = rgn->srgn_tbl + srgn_idx;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment