From: Wojciech Bartczak <wbartczak@marvell.com>
To: <linux-mmc@vger.kernel.org>
Cc: <rric@kernel.org>, <ulf.hansson@linaro.org>, <beanhuo@micron.com>,
<tanxiaofei@huawei.com>, <wbartczak@marvell.com>,
<linux-kernel@vger.kernel.org>
Subject: [PATCH v2] mmc: cavium: Improve request handling by proper use of API
Date: Mon, 15 Nov 2021 13:54:26 -0800 [thread overview]
Message-ID: <20211115215426.1554-1-wbartczak@marvell.com> (raw)
In-Reply-To: <20211115211533.6971-1-wbartczak@marvell.com>
The driver for cavium/marvell platforms uses directly mrq->done() callback
to signalize the request completion. This method to finalize request
processing is not correct.
Following fix introduces proper use of mmc_request_done() API for
all paths involved into handling MMC core requests.
Changes v1 => v2:
- Added missing variable slot and functionality to retrive
slot base on bus_id contained in response status register.
Signed-off-by: Wojciech Bartczak <wbartczak@marvell.com>
---
drivers/mmc/host/cavium.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/mmc/host/cavium.c b/drivers/mmc/host/cavium.c
index 95a41983c6c0..674cfaf5d64e 100644
--- a/drivers/mmc/host/cavium.c
+++ b/drivers/mmc/host/cavium.c
@@ -435,8 +435,10 @@ static void cleanup_dma(struct cvm_mmc_host *host, u64 rsp_sts)
irqreturn_t cvm_mmc_interrupt(int irq, void *dev_id)
{
struct cvm_mmc_host *host = dev_id;
+ struct cvm_mmc_slot *slot;
struct mmc_request *req;
u64 emm_int, rsp_sts;
+ int bus_id;
bool host_done;
if (host->need_irq_handler_lock)
@@ -456,6 +458,8 @@ irqreturn_t cvm_mmc_interrupt(int irq, void *dev_id)
goto out;
rsp_sts = readq(host->base + MIO_EMM_RSP_STS(host));
+ bus_id = get_bus_id(rsp_sts);
+ slot = host->slot[bus_id]; /* bus_id is in a range 0..2 */
/*
* dma_val set means DMA is still in progress. Don't touch
* the request and wait for the interrupt indicating that
@@ -493,8 +497,8 @@ irqreturn_t cvm_mmc_interrupt(int irq, void *dev_id)
(rsp_sts & MIO_EMM_RSP_STS_DMA_PEND))
cleanup_dma(host, rsp_sts);
+ mmc_request_done(slot->mmc, req);
host->current_req = NULL;
- req->done(req);
no_req_done:
if (host->dmar_fixup_done)
@@ -699,8 +703,7 @@ static void cvm_mmc_dma_request(struct mmc_host *mmc,
error:
mrq->cmd->error = -EINVAL;
- if (mrq->done)
- mrq->done(mrq);
+ mmc_request_done(mmc, mrq);
host->release_bus(host);
}
--
2.17.1
next prev parent reply other threads:[~2021-11-16 0:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-15 21:15 [PATCH] " Wojciech Bartczak
2021-11-15 21:54 ` Wojciech Bartczak [this message]
2021-11-23 14:00 ` [PATCH v2] " Ulf Hansson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211115215426.1554-1-wbartczak@marvell.com \
--to=wbartczak@marvell.com \
--cc=beanhuo@micron.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=rric@kernel.org \
--cc=tanxiaofei@huawei.com \
--cc=ulf.hansson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®