[U-Boot] [PATCH 07/29] dm: core: Remove unbind operations when not required
Simon Glass
sjg at chromium.org
Sat Feb 28 06:06:31 CET 2015
The CONFIG_DM_DEVICE_REMOVE option takes out code related to removing
devices. It should also remove the 'unbind' code since if we cannot
remove we probably don't need to unbind.
Signed-off-by: Simon Glass <sjg at chromium.org>
---
drivers/core/uclass.c | 4 ++++
include/dm/uclass-internal.h | 8 ++++++++
2 files changed, 12 insertions(+)
diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c
index 289a5d2..e8282d2 100644
--- a/drivers/core/uclass.c
+++ b/drivers/core/uclass.c
@@ -344,6 +344,7 @@ err:
return ret;
}
+#ifdef CONFIG_DM_DEVICE_REMOVE
int uclass_unbind_device(struct udevice *dev)
{
struct uclass *uc;
@@ -359,6 +360,7 @@ int uclass_unbind_device(struct udevice *dev)
list_del(&dev->uclass_node);
return 0;
}
+#endif
int uclass_resolve_seq(struct udevice *dev)
{
@@ -414,6 +416,7 @@ int uclass_post_probe_device(struct udevice *dev)
return 0;
}
+#ifdef CONFIG_DM_DEVICE_REMOVE
int uclass_pre_remove_device(struct udevice *dev)
{
struct uclass_driver *uc_drv;
@@ -435,3 +438,4 @@ int uclass_pre_remove_device(struct udevice *dev)
return 0;
}
+#endif
diff --git a/include/dm/uclass-internal.h b/include/dm/uclass-internal.h
index f2f254a..4a492d6 100644
--- a/include/dm/uclass-internal.h
+++ b/include/dm/uclass-internal.h
@@ -41,7 +41,11 @@ int uclass_bind_device(struct udevice *dev);
* @dev: Pointer to the device
* #return 0 on success, -ve on error
*/
+#ifdef CONFIG_DM_DEVICE_REMOVE
int uclass_unbind_device(struct udevice *dev);
+#else
+static inline int uclass_unbind_device(struct udevice *dev) { return 0; }
+#endif
/**
* uclass_pre_probe_child() - Deal with a child that is about to be probed
@@ -73,7 +77,11 @@ int uclass_post_probe_device(struct udevice *dev);
* @dev: Pointer to the device
* #return 0 on success, -ve on error
*/
+#ifdef CONFIG_DM_DEVICE_REMOVE
int uclass_pre_remove_device(struct udevice *dev);
+#else
+static inline int uclass_pre_remove_device(struct udevice *dev) { return 0; }
+#endif
/**
* uclass_find() - Find uclass by its id
--
2.2.0.rc0.207.ga3a616c
More information about the U-Boot
mailing list