]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
mmc: dw_mmc: Do not export dwmci_send_cmd() and dwmci_set_ios()
authorSam Protsenko <semen.protsenko@linaro.org>
Sun, 26 Oct 2025 01:06:54 +0000 (20:06 -0500)
committerPeng Fan <peng.fan@nxp.com>
Fri, 7 Nov 2025 01:28:28 +0000 (09:28 +0800)
Do not over-expose the private dw_mmc API. The glue layer drivers at
this point shouldn't be aware and shouldn't use the generic
dwmci_send_cmd() and dwmci_set_ios() functions. Making those functions
public causes a "leaky abstraction" issue. It clutters the public
interface of generic dw_mmc driver and possibly leads to improper usage
of those functions, so it's a bad design.

If struct dm_dwmci_ops has to be extended, do so by copying it first
(like it's done for example in snps_dw_mmc driver). That also makes sure
the future changes to struct dm_dwmci_ops in dw_mmc driver will be
automatically reflected in all extended copies, and avoid code
duplication.

This effectively reverts commit ef3b16bb8e73 ("mmc: dw_mmc: export
dwmci_send_cmd() and dwmci_set_ios()").

No functional change.

Fixes: ef3b16bb8e73 ("mmc: dw_mmc: export dwmci_send_cmd() and dwmci_set_ios()")
Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Anand Moon <linux.amoon@gmail.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
drivers/mmc/dw_mmc.c
include/dwmmc.h

index f3c0cc5cd8e5045a870b5d5d2952da21bfba7e4d..d9c05b223d5f55cf30d22e2ebe7c2cd9e68996b5 100644 (file)
@@ -490,8 +490,8 @@ static int dwmci_send_cmd_common(struct dwmci_host *host, struct mmc_cmd *cmd,
 }
 
 #ifdef CONFIG_DM_MMC
-int dwmci_send_cmd(struct udevice *dev, struct mmc_cmd *cmd,
-                  struct mmc_data *data)
+static int dwmci_send_cmd(struct udevice *dev, struct mmc_cmd *cmd,
+                         struct mmc_data *data)
 {
        struct mmc *mmc = mmc_get_mmc_dev(dev);
 #else
@@ -597,7 +597,7 @@ static int dwmci_setup_bus(struct dwmci_host *host, u32 freq)
 }
 
 #ifdef CONFIG_DM_MMC
-int dwmci_set_ios(struct udevice *dev)
+static int dwmci_set_ios(struct udevice *dev)
 {
        struct mmc *mmc = mmc_get_mmc_dev(dev);
 #else
index 47e3220985e900050d9db9d80e0d45efe6c2e545..7e1a664651816872c87024208fc78cbe9ae7b1dc 100644 (file)
@@ -338,9 +338,6 @@ int add_dwmci(struct dwmci_host *host, u32 max_clk, u32 min_clk);
 #ifdef CONFIG_DM_MMC
 /* Export the operations to drivers */
 int dwmci_probe(struct udevice *dev);
-int dwmci_send_cmd(struct udevice *dev, struct mmc_cmd *cmd,
-                  struct mmc_data *data);
-int dwmci_set_ios(struct udevice *dev);
 extern const struct dm_mmc_ops dm_dwmci_ops;
 #endif