diff mbox

[U-Boot,6/8] dm: mmc: Check that drivers have operations

Message ID 20170424020211.20690-7-sjg@chromium.org
State Accepted
Delegated to: Simon Glass
Headers show

Commit Message

Simon Glass April 24, 2017, 2:02 a.m. UTC
When binding a new MMC device, make sure that it has the required
operations. Since for now we still support *not* having the operations
(with CONFIG_DM_MMC_OPS not enabled) it makes sense to add this check.

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

 drivers/mmc/mmc-uclass.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Simon Glass May 18, 2017, 4:01 p.m. UTC | #1
When binding a new MMC device, make sure that it has the required
operations. Since for now we still support *not* having the operations
(with CONFIG_DM_MMC_OPS not enabled) it makes sense to add this check.

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

 drivers/mmc/mmc-uclass.c | 4 ++++
 1 file changed, 4 insertions(+)

Applied to u-boot-dm
diff mbox

Patch

diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c
index 1a84a033ae..ae0e22dfeb 100644
--- a/drivers/mmc/mmc-uclass.c
+++ b/drivers/mmc/mmc-uclass.c
@@ -198,6 +198,10 @@  int mmc_bind(struct udevice *dev, struct mmc *mmc, const struct mmc_config *cfg)
 	struct udevice *bdev;
 	int ret, devnum = -1;
 
+#ifdef CONFIG_DM_MMC_OPS
+	if (!mmc_get_ops(dev))
+		return -ENOSYS;
+#endif
 #ifndef CONFIG_SPL_BUILD
 	/* Use the fixed index with aliase node's index */
 	fdtdec_get_alias_seq(gd->fdt_blob, "mmc", dev->of_offset, &devnum);