summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-01-24 14:32:45 -0700
committerSimon Glass <sjg@chromium.org>2021-02-03 03:38:41 -0700
commitc51d2e704a1c89d504b379b133bd552c3387fa6c (patch)
tree419e3d4ec2f5dd7a95640e1d51472df9d678105b /include
parentb1f25fcfefc4c8e05f91d948f316c7bdbb4cd527 (diff)
downloadu-boot-c51d2e704a1c89d504b379b133bd552c3387fa6c.tar.gz
dm: core: Avoid partially removing devices
At present if device_remove() decides that the device should not actually be removed, it still calls the uclass pre_remove() method and powers the device down. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/dm/device-internal.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/include/dm/device-internal.h b/include/dm/device-internal.h
index 639bbd293d..b513b6861a 100644
--- a/include/dm/device-internal.h
+++ b/include/dm/device-internal.h
@@ -123,7 +123,8 @@ int device_probe(struct udevice *dev);
*
* @dev: Pointer to device to remove
* @flags: Flags for selective device removal (DM_REMOVE_...)
- * @return 0 if OK, -ve on error (an error here is normally a very bad thing)
+ * @return 0 if OK, -EKEYREJECTED if not removed due to flags, other -ve on
+ * error (such an error here is normally a very bad thing)
*/
#if CONFIG_IS_ENABLED(DM_DEVICE_REMOVE)
int device_remove(struct udevice *dev, uint flags);
@@ -173,6 +174,12 @@ static inline int device_chld_unbind(struct udevice *dev, struct driver *drv)
/**
* device_chld_remove() - Stop all device's children
+ *
+ * This continues through all children recursively stopping part-way through if
+ * an error occurs. Return values of -EKEYREJECTED are ignored and processing
+ * continues, since they just indicate that the child did not elect to be
+ * removed based on the value of @flags.
+ *
* @dev: The device whose children are to be removed
* @drv: The targeted driver
* @flags: Flag, if this functions is called in the pre-OS stage