diff options
author | Jean-Jacques Hiblot <jjhiblot@ti.com> | 2018-08-09 16:17:45 +0200 |
---|---|---|
committer | Marek Vasut <marex@denx.de> | 2018-08-21 16:21:37 +0200 |
commit | 3be9bcb04883497b422f3f2e4a468657056dd48d (patch) | |
tree | 79f1d053520c4b767421d9034555231c000c14bb /include/dm | |
parent | 7ec9181d6a2b68480a289c36e5729487f2a4add1 (diff) |
device: expose the functions used to remove and unbind children of a device
Also add a 'drv' parameter to filter the children to remove/unbind.
Exporting those functions is a preparatory work for the addition of the
bind/unbind commands.
Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Diffstat (limited to 'include/dm')
-rw-r--r-- | include/dm/device-internal.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/include/dm/device-internal.h b/include/dm/device-internal.h index f4af15448f..02ac4c7952 100644 --- a/include/dm/device-internal.h +++ b/include/dm/device-internal.h @@ -131,6 +131,44 @@ static inline void device_free(struct udevice *dev) {} #endif /** + * device_chld_unbind() - Unbind all device's children from the device if bound + * to drv + * + * On error, the function continues to unbind all children, and reports the + * first error. + * + * @dev: The device that is to be stripped of its children + * @drv: The targeted driver + * @return 0 on success, -ve on error + */ +#if CONFIG_IS_ENABLED(DM_DEVICE_REMOVE) +int device_chld_unbind(struct udevice *dev, struct driver *drv); +#else +static inline int device_chld_unbind(struct udevice *dev, struct driver *drv) +{ + return 0; +} +#endif + +/** + * device_chld_remove() - Stop all device's children + * @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 + * @return 0 on success, -ve on error + */ +#if CONFIG_IS_ENABLED(DM_DEVICE_REMOVE) +int device_chld_remove(struct udevice *dev, struct driver *drv, + uint flags); +#else +static inline int device_chld_remove(struct udevice *dev, struct driver *drv, + uint flags) +{ + return 0; +} +#endif + +/** * simple_bus_translate() - translate a bus address to a system address * * This handles the 'ranges' property in a simple bus. It translates the |