[U-Boot] [PATCH 02/93] dm: mmc: Use CONFIG_IS_ENABLED to check for BLK

Simon Glass
2018-11-19T15:52:42Z

This code can be used from SPL and SPL may have a different setting for
CONFIG_BLK that U-Boot proper. Use the correct macro.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

drivers/mmc/dw_mmc.c | 2 +-
drivers/mmc/mmc-uclass.c | 2 +-
drivers/mmc/mmc_write.c | 8 ++++----
include/dwmmc.h | 6 +++---
4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c
index 7544b84ab61..cf86b125c6c 100644
--- a/drivers/mmc/dw_mmc.c
+++ b/drivers/mmc/dw_mmc.c
@@ -544,7 +544,7 @@ void dwmci_setup_cfg(struct mmc_config *cfg, struct dwmci_host *host,
cfg->b_max = CONFIG_SYS_MMC_MAX_BLK_COUNT;
}

-#ifdef CONFIG_BLK
+#if CONFIG_IS_ENABLED(BLK)
int dwmci_bind(struct udevice *dev, struct mmc *mmc, struct mmc_config *cfg)
{
return mmc_bind(dev, mmc, cfg);
diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c
index f73f07254be..34dfe13fe2c 100644
--- a/drivers/mmc/mmc-uclass.c
+++ b/drivers/mmc/mmc-uclass.c
@@ -379,7 +379,7 @@ U_BOOT_DRIVER(mmc_blk) = {
.ops = &mmc_blk_ops,
.probe = mmc_blk_probe,
};
-#endif /* CONFIG_BLK */
+#endif /* CONFIG_IS_ENABLED(BLK) */

U_BOOT_DRIVER(mmc) = {
.name = "mmc",
diff --git a/drivers/mmc/mmc_write.c b/drivers/mmc/mmc_write.c
index b8acc33c76d..c8c83c9188e 100644
--- a/drivers/mmc/mmc_write.c
+++ b/drivers/mmc/mmc_write.c
@@ -65,13 +65,13 @@ err_out:
return err;
}

-#ifdef CONFIG_BLK
+#if CONFIG_IS_ENABLED(BLK)
ulong mmc_berase(struct udevice *dev, lbaint_t start, lbaint_t blkcnt)
#else
ulong mmc_berase(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt)
#endif
{
-#ifdef CONFIG_BLK
+#if CONFIG_IS_ENABLED(BLK)
struct blk_desc *block_dev = dev_get_uclass_platdata(dev);
#endif
int dev_num = block_dev->devnum;
@@ -183,7 +183,7 @@ static ulong mmc_write_blocks(struct mmc *mmc, lbaint_t start,
return blkcnt;
}

-#ifdef CONFIG_BLK
+#if CONFIG_IS_ENABLED(BLK)
ulong mmc_bwrite(struct udevice *dev, lbaint_t start, lbaint_t blkcnt,
const void *src)
#else
@@ -191,7 +191,7 @@ ulong mmc_bwrite(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt,
const void *src)
#endif
{
-#ifdef CONFIG_BLK
+#if CONFIG_IS_ENABLED(BLK)
struct blk_desc *block_dev = dev_get_uclass_platdata(dev);
#endif
int dev_num = block_dev->devnum;
diff --git a/include/dwmmc.h b/include/dwmmc.h
index 4ceda5e43c5..0cc155290da 100644
--- a/include/dwmmc.h
+++ b/include/dwmmc.h
@@ -182,7 +182,7 @@ struct dwmci_host {
* @freq: Frequency the host is trying to achieve
*/
unsigned int (*get_mmc_clk)(struct dwmci_host *host, uint freq);
-#ifndef CONFIG_BLK
+#if !CONFIG_IS_ENABLED(BLK)
struct mmc_config cfg;
#endif

@@ -226,7 +226,7 @@ static inline u8 dwmci_readb(struct dwmci_host *host, int reg)
return readb(host->ioaddr + reg);
}

-#ifdef CONFIG_BLK
+#if CONFIG_IS_ENABLED(BLK)
/**
* dwmci_setup_cfg() - Set up the configuration for DWMMC
*
@@ -291,7 +291,7 @@ int dwmci_bind(struct udevice *dev, struct mmc *mmc, struct mmc_config *cfg);
* @return 0 if OK, -ve on error
*/
int add_dwmci(struct dwmci_host *host, u32 max_clk, u32 min_clk);
-#endif /* !CONFIG_BLK */
+#endif /* CONFIG_IS_ENABLED(BLK) */

#ifdef CONFIG_DM_MMC
/* Export the operations to drivers */
--
2.19.1.1215.g8438c0b245-goog