Skip to content

Commit 0fca331

Browse files
bvanasschemartinkpetersen
authored andcommitted
scsi: ufs: core: Inline is_mcq_enabled()
Improve code readability by inlining is_mcq_enabled(). Cc: Peter Wang <[email protected]> Cc: Manivannan Sadhasivam <[email protected]> Signed-off-by: Bart Van Assche <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Manivannan Sadhasivam <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent f4750af commit 0fca331

File tree

3 files changed

+17
-22
lines changed

3 files changed

+17
-22
lines changed

drivers/ufs/core/ufshcd.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ static void ufshcd_add_command_trace(struct ufs_hba *hba, unsigned int tag,
453453

454454
intr = ufshcd_readl(hba, REG_INTERRUPT_STATUS);
455455

456-
if (is_mcq_enabled(hba)) {
456+
if (hba->mcq_enabled) {
457457
struct ufs_hw_queue *hwq = ufshcd_mcq_req_to_hwq(hba, rq);
458458

459459
hwq_id = hwq->id;
@@ -2301,7 +2301,7 @@ void ufshcd_send_command(struct ufs_hba *hba, unsigned int task_tag,
23012301
if (unlikely(ufshcd_should_inform_monitor(hba, lrbp)))
23022302
ufshcd_start_monitor(hba, lrbp);
23032303

2304-
if (is_mcq_enabled(hba)) {
2304+
if (hba->mcq_enabled) {
23052305
int utrd_size = sizeof(struct utp_transfer_req_desc);
23062306
struct utp_transfer_req_desc *src = lrbp->utr_descriptor_ptr;
23072307
struct utp_transfer_req_desc *dest;
@@ -3000,7 +3000,7 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
30003000
goto out;
30013001
}
30023002

3003-
if (is_mcq_enabled(hba))
3003+
if (hba->mcq_enabled)
30043004
hwq = ufshcd_mcq_req_to_hwq(hba, scsi_cmd_to_rq(cmd));
30053005

30063006
ufshcd_send_command(hba, tag, hwq);
@@ -3059,7 +3059,7 @@ static int ufshcd_clear_cmd(struct ufs_hba *hba, u32 task_tag)
30593059
unsigned long flags;
30603060
int err;
30613061

3062-
if (is_mcq_enabled(hba)) {
3062+
if (hba->mcq_enabled) {
30633063
/*
30643064
* MCQ mode. Clean up the MCQ resources similar to
30653065
* what the ufshcd_utrl_clear() does for SDB mode.
@@ -3169,7 +3169,7 @@ static int ufshcd_wait_for_dev_cmd(struct ufs_hba *hba,
31693169
__func__, lrbp->task_tag);
31703170

31713171
/* MCQ mode */
3172-
if (is_mcq_enabled(hba)) {
3172+
if (hba->mcq_enabled) {
31733173
/* successfully cleared the command, retry if needed */
31743174
if (ufshcd_clear_cmd(hba, lrbp->task_tag) == 0)
31753175
err = -EAGAIN;
@@ -5560,7 +5560,7 @@ static int ufshcd_poll(struct Scsi_Host *shost, unsigned int queue_num)
55605560
u32 tr_doorbell;
55615561
struct ufs_hw_queue *hwq;
55625562

5563-
if (is_mcq_enabled(hba)) {
5563+
if (hba->mcq_enabled) {
55645564
hwq = &hba->uhq[queue_num];
55655565

55665566
return ufshcd_mcq_poll_cqe_lock(hba, hwq);
@@ -6201,7 +6201,7 @@ static void ufshcd_exception_event_handler(struct work_struct *work)
62016201
/* Complete requests that have door-bell cleared */
62026202
static void ufshcd_complete_requests(struct ufs_hba *hba, bool force_compl)
62036203
{
6204-
if (is_mcq_enabled(hba))
6204+
if (hba->mcq_enabled)
62056205
ufshcd_mcq_compl_pending_transfer(hba, force_compl);
62066206
else
62076207
ufshcd_transfer_req_compl(hba);
@@ -6458,7 +6458,7 @@ static bool ufshcd_abort_one(struct request *rq, void *priv)
64586458
*ret ? "failed" : "succeeded");
64596459

64606460
/* Release cmd in MCQ mode if abort succeeds */
6461-
if (is_mcq_enabled(hba) && (*ret == 0)) {
6461+
if (hba->mcq_enabled && (*ret == 0)) {
64626462
hwq = ufshcd_mcq_req_to_hwq(hba, scsi_cmd_to_rq(lrbp->cmd));
64636463
spin_lock_irqsave(&hwq->cq_lock, flags);
64646464
if (ufshcd_cmd_inflight(lrbp->cmd))
@@ -7389,7 +7389,7 @@ static int ufshcd_eh_device_reset_handler(struct scsi_cmnd *cmd)
73897389
goto out;
73907390
}
73917391

7392-
if (is_mcq_enabled(hba)) {
7392+
if (hba->mcq_enabled) {
73937393
for (pos = 0; pos < hba->nutrs; pos++) {
73947394
lrbp = &hba->lrb[pos];
73957395
if (ufshcd_cmd_inflight(lrbp->cmd) &&
@@ -7485,7 +7485,7 @@ int ufshcd_try_to_abort_task(struct ufs_hba *hba, int tag)
74857485
*/
74867486
dev_err(hba->dev, "%s: cmd at tag %d not pending in the device.\n",
74877487
__func__, tag);
7488-
if (is_mcq_enabled(hba)) {
7488+
if (hba->mcq_enabled) {
74897489
/* MCQ mode */
74907490
if (ufshcd_cmd_inflight(lrbp->cmd)) {
74917491
/* sleep for max. 200us same delay as in SDB mode */
@@ -7563,7 +7563,7 @@ static int ufshcd_abort(struct scsi_cmnd *cmd)
75637563

75647564
ufshcd_hold(hba);
75657565

7566-
if (!is_mcq_enabled(hba)) {
7566+
if (!hba->mcq_enabled) {
75677567
reg = ufshcd_readl(hba, REG_UTP_TRANSFER_REQ_DOOR_BELL);
75687568
if (!test_bit(tag, &hba->outstanding_reqs)) {
75697569
/* If command is already aborted/completed, return FAILED. */
@@ -7596,7 +7596,7 @@ static int ufshcd_abort(struct scsi_cmnd *cmd)
75967596
}
75977597
hba->req_abort_count++;
75987598

7599-
if (!is_mcq_enabled(hba) && !(reg & (1 << tag))) {
7599+
if (!hba->mcq_enabled && !(reg & (1 << tag))) {
76007600
/* only execute this code in single doorbell mode */
76017601
dev_err(hba->dev,
76027602
"%s: cmd was completed, but without a notifying intr, tag = %d",
@@ -7623,7 +7623,7 @@ static int ufshcd_abort(struct scsi_cmnd *cmd)
76237623
goto release;
76247624
}
76257625

7626-
if (is_mcq_enabled(hba)) {
7626+
if (hba->mcq_enabled) {
76277627
/* MCQ mode. Branch off to handle abort for mcq mode */
76287628
err = ufshcd_mcq_abort(cmd);
76297629
goto release;
@@ -8732,7 +8732,7 @@ static int ufshcd_device_init(struct ufs_hba *hba, bool init_dev_params)
87328732
ufshcd_set_link_active(hba);
87338733

87348734
/* Reconfigure MCQ upon reset */
8735-
if (is_mcq_enabled(hba) && !init_dev_params)
8735+
if (hba->mcq_enabled && !init_dev_params)
87368736
ufshcd_config_mcq(hba);
87378737

87388738
/* Verify device initialization by sending NOP OUT UPIU */

drivers/ufs/host/ufs-mediatek.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,7 @@ static void ufs_mtk_mcq_disable_irq(struct ufs_hba *hba)
693693
struct ufs_mtk_host *host = ufshcd_get_variant(hba);
694694
u32 irq, i;
695695

696-
if (!is_mcq_enabled(hba))
696+
if (!hba->mcq_enabled)
697697
return;
698698

699699
if (host->mcq_nr_intr == 0)
@@ -711,7 +711,7 @@ static void ufs_mtk_mcq_enable_irq(struct ufs_hba *hba)
711711
struct ufs_mtk_host *host = ufshcd_get_variant(hba);
712712
u32 irq, i;
713713

714-
if (!is_mcq_enabled(hba))
714+
if (!hba->mcq_enabled)
715715
return;
716716

717717
if (host->mcq_nr_intr == 0)
@@ -1308,7 +1308,7 @@ static int ufs_mtk_link_set_hpm(struct ufs_hba *hba)
13081308
if (err)
13091309
return err;
13101310

1311-
if (is_mcq_enabled(hba)) {
1311+
if (hba->mcq_enabled) {
13121312
ufs_mtk_config_mcq(hba, false);
13131313
ufshcd_mcq_make_queues_operational(hba);
13141314
ufshcd_mcq_config_mac(hba, hba->nutrs);

include/ufs/ufshcd.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,11 +1132,6 @@ struct ufs_hw_queue {
11321132

11331133
#define MCQ_QCFG_SIZE 0x40
11341134

1135-
static inline bool is_mcq_enabled(struct ufs_hba *hba)
1136-
{
1137-
return hba->mcq_enabled;
1138-
}
1139-
11401135
static inline unsigned int ufshcd_mcq_opr_offset(struct ufs_hba *hba,
11411136
enum ufshcd_mcq_opr opr, int idx)
11421137
{

0 commit comments

Comments
 (0)