[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20210525093510.1373-1-zbestahu@gmail.com>
Date: Tue, 25 May 2021 17:35:10 +0800
From: Yue Hu <zbestahu@...il.com>
To: ulf.hansson@...aro.org
Cc: linux-mmc@...r.kernel.org, linux-kernel@...r.kernel.org,
huyue2@...ong.com, zbestahu@....com
Subject: [PATCH] mmc: core: Use host instead of mq parameter from mmc_issue_type()
From: Yue Hu <huyue2@...ong.com>
Note that the role of 'mq' parameter is just to get 'host' in
mmc_issue_type(). And all callers to this API have already 'host'
except mmc_blk_mq_dec_in_flight(). So, let's use existing 'host'
directly to make code simpler. Update related code at the same time.
Signed-off-by: Yue Hu <huyue2@...ong.com>
---
drivers/mmc/core/block.c | 6 +++---
drivers/mmc/core/queue.c | 8 +++-----
drivers/mmc/core/queue.h | 2 +-
3 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
index 689eb9a..4b6d4b0 100644
--- a/drivers/mmc/core/block.c
+++ b/drivers/mmc/core/block.c
@@ -1382,7 +1382,7 @@ static void mmc_blk_cqe_complete_rq(struct mmc_queue *mq, struct request *req)
struct mmc_request *mrq = &mqrq->brq.mrq;
struct request_queue *q = req->q;
struct mmc_host *host = mq->card->host;
- enum mmc_issue_type issue_type = mmc_issue_type(mq, req);
+ enum mmc_issue_type issue_type = mmc_issue_type(host, req);
unsigned long flags;
bool put_card;
int err;
@@ -1977,7 +1977,7 @@ static void mmc_blk_mq_dec_in_flight(struct mmc_queue *mq, struct request *req)
spin_lock_irqsave(&mq->lock, flags);
- mq->in_flight[mmc_issue_type(mq, req)] -= 1;
+ mq->in_flight[mmc_issue_type(mq->card->host, req)] -= 1;
put_card = (mmc_tot_in_flight(mq) == 0);
@@ -2209,7 +2209,7 @@ enum mmc_issued mmc_blk_mq_issue_rq(struct mmc_queue *mq, struct request *req)
if (ret)
return MMC_REQ_FAILED_TO_START;
- switch (mmc_issue_type(mq, req)) {
+ switch (mmc_issue_type(host, req)) {
case MMC_ISSUE_SYNC:
ret = mmc_blk_wait_for_idle(mq, host);
if (ret)
diff --git a/drivers/mmc/core/queue.c b/drivers/mmc/core/queue.c
index d600e0a..3478f0a 100644
--- a/drivers/mmc/core/queue.c
+++ b/drivers/mmc/core/queue.c
@@ -56,10 +56,8 @@ static enum mmc_issue_type mmc_cqe_issue_type(struct mmc_host *host,
}
}
-enum mmc_issue_type mmc_issue_type(struct mmc_queue *mq, struct request *req)
+enum mmc_issue_type mmc_issue_type(struct mmc_host *host, struct request *req)
{
- struct mmc_host *host = mq->card->host;
-
if (host->cqe_enabled && !host->hsq_enabled)
return mmc_cqe_issue_type(host, req);
@@ -97,7 +95,7 @@ static enum blk_eh_timer_return mmc_cqe_timed_out(struct request *req)
struct mmc_request *mrq = &mqrq->brq.mrq;
struct mmc_queue *mq = req->q->queuedata;
struct mmc_host *host = mq->card->host;
- enum mmc_issue_type issue_type = mmc_issue_type(mq, req);
+ enum mmc_issue_type issue_type = mmc_issue_type(host, req);
bool recovery_needed = false;
switch (issue_type) {
@@ -259,7 +257,7 @@ static blk_status_t mmc_mq_queue_rq(struct blk_mq_hw_ctx *hctx,
return BLK_STS_IOERR;
}
- issue_type = mmc_issue_type(mq, req);
+ issue_type = mmc_issue_type(host, req);
spin_lock_irq(&mq->lock);
diff --git a/drivers/mmc/core/queue.h b/drivers/mmc/core/queue.h
index 3319d8a..d41bacb 100644
--- a/drivers/mmc/core/queue.h
+++ b/drivers/mmc/core/queue.h
@@ -104,7 +104,7 @@ extern unsigned int mmc_queue_map_sg(struct mmc_queue *,
void mmc_cqe_check_busy(struct mmc_queue *mq);
void mmc_cqe_recovery_notifier(struct mmc_request *mrq);
-enum mmc_issue_type mmc_issue_type(struct mmc_queue *mq, struct request *req);
+enum mmc_issue_type mmc_issue_type(struct mmc_host *host, struct request *req);
static inline int mmc_tot_in_flight(struct mmc_queue *mq)
{
--
1.9.1
Powered by blists - more mailing lists