* [PATCH 1/2] mmc: dw_mmc: Inline dw_mci_queue_request() into dw_mci_request()
2026-03-31 7:54 [PATCH 0/2] Improve request handling code flow and clarify function naming for dw_mmc Shawn Lin
@ 2026-03-31 7:54 ` Shawn Lin
2026-03-31 7:54 ` [PATCH 2/2] mmc: dw_mmc: Remove dw_mci_start_request wrapper and rename core function Shawn Lin
2026-03-31 11:14 ` [PATCH 0/2] Improve request handling code flow and clarify function naming for dw_mmc Ulf Hansson
2 siblings, 0 replies; 4+ messages in thread
From: Shawn Lin @ 2026-03-31 7:54 UTC (permalink / raw)
To: Ulf Hansson, Jaehoon Chung; +Cc: linux-mmc, linux-kernel, Shawn Lin
With the removal of queue support, the function dw_mci_queue_request()
is now just a wrapper with a confusing name that doesn't suggest
anything about queue. Removes the function and moves its body into
dw_mci_request().
No functional changes intended.
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
---
drivers/mmc/host/dw_mmc.c | 46 +++++++++++++++++++---------------------------
1 file changed, 19 insertions(+), 27 deletions(-)
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index bbdd759..8e78faf 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -1293,31 +1293,6 @@ static void dw_mci_start_request(struct dw_mci *host)
__dw_mci_start_request(host, cmd);
}
-/* must be called with host->lock held */
-static void dw_mci_queue_request(struct dw_mci *host, struct mmc_request *mrq)
-{
- dev_vdbg(&host->mmc->class_dev, "queue request: state=%d\n",
- host->state);
-
- host->mrq = mrq;
-
- if (host->state == STATE_WAITING_CMD11_DONE) {
- dev_warn(&host->mmc->class_dev,
- "Voltage change didn't complete\n");
- /*
- * this case isn't expected to happen, so we can
- * either crash here or just try to continue on
- * in the closest possible state
- */
- host->state = STATE_IDLE;
- }
-
- if (host->state == STATE_IDLE) {
- host->state = STATE_SENDING_CMD;
- dw_mci_start_request(host);
- }
-}
-
static void dw_mci_request(struct mmc_host *mmc, struct mmc_request *mrq)
{
struct dw_mci *host = mmc_priv(mmc);
@@ -1329,7 +1304,6 @@ static void dw_mci_request(struct mmc_host *mmc, struct mmc_request *mrq)
* atomic, otherwise the card could be removed in between and the
* request wouldn't fail until another card was inserted.
*/
-
if (!dw_mci_get_cd(mmc)) {
mrq->cmd->error = -ENOMEDIUM;
mmc_request_done(mmc, mrq);
@@ -1338,7 +1312,25 @@ static void dw_mci_request(struct mmc_host *mmc, struct mmc_request *mrq)
spin_lock_bh(&host->lock);
- dw_mci_queue_request(host, mrq);
+ dev_vdbg(&host->mmc->class_dev, "request: state=%d\n",
+ host->state);
+
+ host->mrq = mrq;
+ if (host->state == STATE_WAITING_CMD11_DONE) {
+ dev_warn(&host->mmc->class_dev,
+ "Voltage change didn't complete\n");
+ /*
+ * this case isn't expected to happen, so we can
+ * either crash here or just try to continue on
+ * in the closest possible state
+ */
+ host->state = STATE_IDLE;
+ }
+
+ if (host->state == STATE_IDLE) {
+ host->state = STATE_SENDING_CMD;
+ dw_mci_start_request(host);
+ }
spin_unlock_bh(&host->lock);
}
--
2.7.4
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH 2/2] mmc: dw_mmc: Remove dw_mci_start_request wrapper and rename core function
2026-03-31 7:54 [PATCH 0/2] Improve request handling code flow and clarify function naming for dw_mmc Shawn Lin
2026-03-31 7:54 ` [PATCH 1/2] mmc: dw_mmc: Inline dw_mci_queue_request() into dw_mci_request() Shawn Lin
@ 2026-03-31 7:54 ` Shawn Lin
2026-03-31 11:14 ` [PATCH 0/2] Improve request handling code flow and clarify function naming for dw_mmc Ulf Hansson
2 siblings, 0 replies; 4+ messages in thread
From: Shawn Lin @ 2026-03-31 7:54 UTC (permalink / raw)
To: Ulf Hansson, Jaehoon Chung; +Cc: linux-mmc, linux-kernel, Shawn Lin
The function dw_mci_start_request() was just a thin wrapper around
__dw_mci_start_request(). Since it serves almost no functional purpose,
remove the wrapper to simplify the code flow.
Consequently, rename __dw_mci_start_request() to dw_mci_start_request()
so that the core implementation uses the primary name.
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
---
drivers/mmc/host/dw_mmc.c | 18 +++++-------------
1 file changed, 5 insertions(+), 13 deletions(-)
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 8e78faf..20193ee 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -1224,8 +1224,7 @@ static void dw_mci_set_data_timeout(struct dw_mci *host,
timeout_ns, tmout >> 8);
}
-static void __dw_mci_start_request(struct dw_mci *host,
- struct mmc_command *cmd)
+static void dw_mci_start_request(struct dw_mci *host, struct mmc_command *cmd)
{
struct mmc_request *mrq;
struct mmc_data *data;
@@ -1284,18 +1283,10 @@ static void __dw_mci_start_request(struct dw_mci *host,
host->stop_cmdr = dw_mci_prep_stop_abort(host, cmd);
}
-static void dw_mci_start_request(struct dw_mci *host)
-{
- struct mmc_request *mrq = host->mrq;
- struct mmc_command *cmd;
-
- cmd = mrq->sbc ? mrq->sbc : mrq->cmd;
- __dw_mci_start_request(host, cmd);
-}
-
static void dw_mci_request(struct mmc_host *mmc, struct mmc_request *mrq)
{
struct dw_mci *host = mmc_priv(mmc);
+ struct mmc_command *cmd;
WARN_ON(host->mrq);
@@ -1329,7 +1320,8 @@ static void dw_mci_request(struct mmc_host *mmc, struct mmc_request *mrq)
if (host->state == STATE_IDLE) {
host->state = STATE_SENDING_CMD;
- dw_mci_start_request(host);
+ cmd = mrq->sbc ? mrq->sbc : mrq->cmd;
+ dw_mci_start_request(host, cmd);
}
spin_unlock_bh(&host->lock);
@@ -1949,7 +1941,7 @@ static void dw_mci_work_func(struct work_struct *t)
set_bit(EVENT_CMD_COMPLETE, &host->completed_events);
err = dw_mci_command_complete(host, cmd);
if (cmd == mrq->sbc && !err) {
- __dw_mci_start_request(host, mrq->cmd);
+ dw_mci_start_request(host, mrq->cmd);
goto unlock;
}
--
2.7.4
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH 0/2] Improve request handling code flow and clarify function naming for dw_mmc
2026-03-31 7:54 [PATCH 0/2] Improve request handling code flow and clarify function naming for dw_mmc Shawn Lin
2026-03-31 7:54 ` [PATCH 1/2] mmc: dw_mmc: Inline dw_mci_queue_request() into dw_mci_request() Shawn Lin
2026-03-31 7:54 ` [PATCH 2/2] mmc: dw_mmc: Remove dw_mci_start_request wrapper and rename core function Shawn Lin
@ 2026-03-31 11:14 ` Ulf Hansson
2 siblings, 0 replies; 4+ messages in thread
From: Ulf Hansson @ 2026-03-31 11:14 UTC (permalink / raw)
To: Shawn Lin; +Cc: Jaehoon Chung, linux-mmc, linux-kernel
On Tue, 31 Mar 2026 at 09:54, Shawn Lin <shawn.lin@rock-chips.com> wrote:
>
>
> This patch series aims to simplify the request handling logic and enhance
> code readability in the dw_mmc driver by addressing suboptimal function
> naming and unnecessary abstraction layers.
>
> The dw_mmc's request handling routines currently include multiple functions
> with confusing names and redundant responsibilities:
> - dw_mci_request() serves as the mmc_host_ops entry point.
> - dw_mci_queue_request() was used for queuing requests, but with the removal of
> multi-slot support, it no longer performs any meaningful queuing operations.
> - dw_mci_start_request() acts as a thin wrapper around __dw_mci_start_request(),
> adding unnecessary indirection.
> - __dw_mci_start_request() contains the actual core implementation.
>
> This naming hierarchy not only obscures the true function roles but also creates
> a misleading impression of queuing behavior, which no longer exists. Simplifying
> this flow and aligning names with actual functionality significantly improves
> code clarity and maintainability.
>
>
>
> Shawn Lin (2):
> mmc: dw_mmc: Inline dw_mci_queue_request() into dw_mci_request()
> mmc: dw_mmc: Remove dw_mci_start_request wrapper and rename core
> function
>
> drivers/mmc/host/dw_mmc.c | 58 +++++++++++++++++------------------------------
> 1 file changed, 21 insertions(+), 37 deletions(-)
>
> --
> 2.7.4
>
The series applied for next, thanks!
Kind regards
Uffe
^ permalink raw reply [flat|nested] 4+ messages in thread