drivers/mmc/host/dw_mmc.c | 7 ++++++- drivers/mmc/host/dw_mmc.h | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-)
Use vendor drv function to let other vendor can add some vendor function
before and after request
Signed-off-by: ping.gao <ping.gao@samsung.com>
---
drivers/mmc/host/dw_mmc.c | 7 ++++++-
drivers/mmc/host/dw_mmc.h | 2 ++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index c5db92bbb094..5f1353b7f8d6 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_dat
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
Hi ping.gao,
kernel test robot noticed the following build errors:
[auto build test ERROR on linus/master]
[also build test ERROR on ulf-hansson-mmc-mirror/next v6.18 next-20251209]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/ping-gao/mmc-dw_mmc-Use-pre_request-post_request_end-helper/20251209-144626
base: linus/master
patch link: https://lore.kernel.org/r/20251209064910.3643039-1-ping.gao%40samsung.com
patch subject: [PATCH] mmc: dw_mmc: Use pre_request & post_request_end helper
config: riscv-defconfig (https://download.01.org/0day-ci/archive/20251210/202512100224.drEVwdNL-lkp@intel.com/config)
compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project 6ec8c4351cfc1d0627d1633b02ea787bd29c77d8)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251210/202512100224.drEVwdNL-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202512100224.drEVwdNL-lkp@intel.com/
All errors (new ones prefixed by >>):
>> drivers/mmc/host/dw_mmc.c:1902:49: error: no member named 'drv_dat' in 'struct dw_mci'
1902 | const struct dw_mci_drv_data *drv_data = host->drv_dat
| ~~~~ ^
>> drivers/mmc/host/dw_mmc.c:1904:2: error: expected expression
1904 | WARN_ON(host->cmd || host->data);
| ^
include/asm-generic/bug.h:109:29: note: expanded from macro 'WARN_ON'
109 | #define WARN_ON(condition) ({ \
| ^
2 errors generated.
vim +1902 drivers/mmc/host/dw_mmc.c
1895
1896 static void dw_mci_request_end(struct dw_mci *host, struct mmc_request *mrq)
1897 __releases(&host->lock)
1898 __acquires(&host->lock)
1899 {
1900 struct dw_mci_slot *slot;
1901 struct mmc_host *prev_mmc = host->slot->mmc;
> 1902 const struct dw_mci_drv_data *drv_data = host->drv_dat
1903
> 1904 WARN_ON(host->cmd || host->data);
1905
1906 host->slot->mrq = NULL;
1907 host->mrq = NULL;
1908 if (!list_empty(&host->queue)) {
1909 slot = list_entry(host->queue.next,
1910 struct dw_mci_slot, queue_node);
1911 list_del(&slot->queue_node);
1912 dev_vdbg(host->dev, "list not empty: %s is next\n",
1913 mmc_hostname(slot->mmc));
1914 host->state = STATE_SENDING_CMD;
1915 dw_mci_start_request(host, slot);
1916 } else {
1917 dev_vdbg(host->dev, "list empty\n");
1918
1919 if (host->state == STATE_SENDING_CMD11)
1920 host->state = STATE_WAITING_CMD11_DONE;
1921 else
1922 host->state = STATE_IDLE;
1923 }
1924
1925 spin_unlock(&host->lock);
1926 mmc_request_done(prev_mmc, mrq);
1927 if (drv_data && drv_data->post_request_end)
1928 drv_data->post_request_end(host);
1929 spin_lock(&host->lock);
1930 }
1931
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Hi ping.gao,
kernel test robot noticed the following build errors:
[auto build test ERROR on linus/master]
[also build test ERROR on ulf-hansson-mmc-mirror/next v6.18 next-20251209]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/ping-gao/mmc-dw_mmc-Use-pre_request-post_request_end-helper/20251209-144626
base: linus/master
patch link: https://lore.kernel.org/r/20251209064910.3643039-1-ping.gao%40samsung.com
patch subject: [PATCH] mmc: dw_mmc: Use pre_request & post_request_end helper
config: csky-randconfig-002-20251209 (https://download.01.org/0day-ci/archive/20251210/202512100130.DkmKHepR-lkp@intel.com/config)
compiler: csky-linux-gcc (GCC) 15.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251210/202512100130.DkmKHepR-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202512100130.DkmKHepR-lkp@intel.com/
All errors (new ones prefixed by >>):
drivers/mmc/host/dw_mmc.c: In function 'dw_mci_request_end':
>> drivers/mmc/host/dw_mmc.c:1902:56: error: 'struct dw_mci' has no member named 'drv_dat'; did you mean 'drv_data'?
1902 | const struct dw_mci_drv_data *drv_data = host->drv_dat
| ^~~~~~~
| drv_data
In file included from arch/csky/include/asm/bug.h:18,
from include/linux/bug.h:5,
from include/linux/random.h:6,
from include/linux/nodemask.h:94,
from include/linux/list_lru.h:12,
from include/linux/fs/super_types.h:7,
from include/linux/fs/super.h:5,
from include/linux/fs.h:5,
from include/linux/highmem.h:5,
from include/linux/bvec.h:10,
from include/linux/blk_types.h:10,
from include/linux/blkdev.h:9,
from drivers/mmc/host/dw_mmc.c:10:
>> include/asm-generic/bug.h:154:29: error: expected expression before '{' token
154 | #define WARN_ON(condition) ({ \
| ^
drivers/mmc/host/dw_mmc.c:1904:9: note: in expansion of macro 'WARN_ON'
1904 | WARN_ON(host->cmd || host->data);
| ^~~~~~~
vim +1902 drivers/mmc/host/dw_mmc.c
1895
1896 static void dw_mci_request_end(struct dw_mci *host, struct mmc_request *mrq)
1897 __releases(&host->lock)
1898 __acquires(&host->lock)
1899 {
1900 struct dw_mci_slot *slot;
1901 struct mmc_host *prev_mmc = host->slot->mmc;
> 1902 const struct dw_mci_drv_data *drv_data = host->drv_dat
1903
1904 WARN_ON(host->cmd || host->data);
1905
1906 host->slot->mrq = NULL;
1907 host->mrq = NULL;
1908 if (!list_empty(&host->queue)) {
1909 slot = list_entry(host->queue.next,
1910 struct dw_mci_slot, queue_node);
1911 list_del(&slot->queue_node);
1912 dev_vdbg(host->dev, "list not empty: %s is next\n",
1913 mmc_hostname(slot->mmc));
1914 host->state = STATE_SENDING_CMD;
1915 dw_mci_start_request(host, slot);
1916 } else {
1917 dev_vdbg(host->dev, "list empty\n");
1918
1919 if (host->state == STATE_SENDING_CMD11)
1920 host->state = STATE_WAITING_CMD11_DONE;
1921 else
1922 host->state = STATE_IDLE;
1923 }
1924
1925 spin_unlock(&host->lock);
1926 mmc_request_done(prev_mmc, mrq);
1927 if (drv_data && drv_data->post_request_end)
1928 drv_data->post_request_end(host);
1929 spin_lock(&host->lock);
1930 }
1931
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
On Tue, Dec 09, 2025 at 02:49:10PM +0800, ping.gao wrote: > Use vendor drv function to let other vendor can add some vendor function Why would the vendor matter? And where is the user of this?
On 2025/12/09 Tuesday 14:49, ping.gao wrote:
> Use vendor drv function to let other vendor can add some vendor function
> before and after request
>
Without a real user, these are dead code.
Please add a driver using it, and explain how the variant driver use it.
> Signed-off-by: ping.gao <ping.gao@samsung.com>
> ---
> drivers/mmc/host/dw_mmc.c | 7 ++++++-
> drivers/mmc/host/dw_mmc.h | 2 ++
> 2 files changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
> index c5db92bbb094..5f1353b7f8d6 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_dat
>
> 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_ */
© 2016 - 2025 Red Hat, Inc.