[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAPDyKFprYewRzLb3rvWWEVocdbHvZ7o-MWL3K9W5=+X2OE9B1Q@mail.gmail.com>
Date: Wed, 10 Dec 2025 11:45:16 +0100
From: Ulf Hansson <ulf.hansson@...aro.org>
To: "ping.gao" <ping.gao@...sung.com>
Cc: jh80.chung@...sung.com, linux-mmc@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mmc: dw_mmc: Use pre_request & post_request_end helper
On Wed, 10 Dec 2025 at 03:26, ping.gao <ping.gao@...sung.com> wrote:
>
> Use vendor drv function to let other vendor can add some vendor function
> before and after request
>
> Signed-off-by: ping.gao <ping.gao@...sung.com>
> ---
> drivers/mmc/host/dw_mmc.c | 7 ++++++-
> drivers/mmc/host/dw_mmc.h | 2 ++
> 2 files changed, 8 insertions(+), 1 deletion(-)
In general we don't add code to the kernel that isn't being used, for
several reasons.
If you want this to be applied, you also need to provide a user of
these callbacks. In this way, the code will be used, but it also
allows us to understand if the callbacks are the correct way to
implement what you need.
Kind regards
Uffe
>
> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
> index c5db92bbb094..04fb92579509 100644
> --- a/drivers/mmc/host/dw_mmc.c
> +++ b/drivers/mmc/host/dw_mmc.c
> @@ -1416,6 +1416,7 @@ static void dw_mci_request(struct mmc_host *mmc, struct mmc_request *mrq)
> {
> struct dw_mci_slot *slot = mmc_priv(mmc);
> struct dw_mci *host = slot->host;
> + const struct dw_mci_drv_data *drv_data = host->drv_data;
>
> WARN_ON(slot->mrq);
>
> @@ -1430,7 +1431,8 @@ static void dw_mci_request(struct mmc_host *mmc, struct mmc_request *mrq)
> mmc_request_done(mmc, mrq);
> return;
> }
> -
> + if (drv_data && drv_data->pre_request)
> + drv_data->pre_request(host);
> spin_lock_bh(&host->lock);
>
> dw_mci_queue_request(host, slot, mrq);
> @@ -1897,6 +1899,7 @@ static void dw_mci_request_end(struct dw_mci *host, struct mmc_request *mrq)
> {
> struct dw_mci_slot *slot;
> struct mmc_host *prev_mmc = host->slot->mmc;
> + const struct dw_mci_drv_data *drv_data = host->drv_data;
>
> WARN_ON(host->cmd || host->data);
>
> @@ -1921,6 +1924,8 @@ static void dw_mci_request_end(struct dw_mci *host, struct mmc_request *mrq)
>
> spin_unlock(&host->lock);
> mmc_request_done(prev_mmc, mrq);
> + if (drv_data && drv_data->post_request_end)
> + drv_data->post_request_end(host);
> spin_lock(&host->lock);
> }
>
> diff --git a/drivers/mmc/host/dw_mmc.h b/drivers/mmc/host/dw_mmc.h
> index 648b4a5641bf..6c258e0865e7 100644
> --- a/drivers/mmc/host/dw_mmc.h
> +++ b/drivers/mmc/host/dw_mmc.h
> @@ -618,5 +618,7 @@ struct dw_mci_drv_data {
> unsigned int timeout_ns);
> u32 (*get_drto_clks)(struct dw_mci *host);
> void (*hw_reset)(struct dw_mci *host);
> + void (*pre_request)(struct dw_mci *host);
> + void (*post_request_end)(struct dw_mci *host);
> };
> #endif /* _DW_MMC_H_ */
> --
> 2.50.1
>
Powered by blists - more mailing lists