dm: core: Remove unbind operations when not required

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@chromium.org>
diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c
index 9fec8c9..04e939d 100644
--- a/drivers/core/uclass.c
+++ b/drivers/core/uclass.c
@@ -386,6 +386,7 @@
 	return ret;
 }
 
+#ifdef CONFIG_DM_DEVICE_REMOVE
 int uclass_unbind_device(struct udevice *dev)
 {
 	struct uclass *uc;
@@ -401,6 +402,7 @@
 	list_del(&dev->uclass_node);
 	return 0;
 }
+#endif
 
 int uclass_resolve_seq(struct udevice *dev)
 {
@@ -464,6 +466,7 @@
 	return 0;
 }
 
+#ifdef CONFIG_DM_DEVICE_REMOVE
 int uclass_pre_remove_device(struct udevice *dev)
 {
 	struct uclass_driver *uc_drv;
@@ -485,3 +488,4 @@
 
 	return 0;
 }
+#endif
diff --git a/include/dm/uclass-internal.h b/include/dm/uclass-internal.h
index a9b2fbe..9b68508 100644
--- a/include/dm/uclass-internal.h
+++ b/include/dm/uclass-internal.h
@@ -116,7 +116,11 @@
  * @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_device() - Deal with a device that is about to be probed
@@ -149,7 +153,11 @@
  * @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