mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-28 15:41:40 +00:00
dm: Export device_remove_children / device_unbind_children
These functions are useful to remove all children from an usb bus before rescanning the bus. Give them a better name and export them. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
8802f56349
commit
bb52b367f6
2 changed files with 30 additions and 18 deletions
|
@ -18,16 +18,7 @@
|
||||||
#include <dm/uclass-internal.h>
|
#include <dm/uclass-internal.h>
|
||||||
#include <dm/util.h>
|
#include <dm/util.h>
|
||||||
|
|
||||||
/**
|
int device_unbind_children(struct udevice *dev)
|
||||||
* device_chld_unbind() - Unbind all device's children from the device
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* @return 0 on success, -ve on error
|
|
||||||
*/
|
|
||||||
static int device_chld_unbind(struct udevice *dev)
|
|
||||||
{
|
{
|
||||||
struct udevice *pos, *n;
|
struct udevice *pos, *n;
|
||||||
int ret, saved_ret = 0;
|
int ret, saved_ret = 0;
|
||||||
|
@ -43,12 +34,7 @@ static int device_chld_unbind(struct udevice *dev)
|
||||||
return saved_ret;
|
return saved_ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
int device_remove_children(struct udevice *dev)
|
||||||
* device_chld_remove() - Stop all device's children
|
|
||||||
* @dev: The device whose children are to be removed
|
|
||||||
* @return 0 on success, -ve on error
|
|
||||||
*/
|
|
||||||
static int device_chld_remove(struct udevice *dev)
|
|
||||||
{
|
{
|
||||||
struct udevice *pos, *n;
|
struct udevice *pos, *n;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -84,7 +70,7 @@ int device_unbind(struct udevice *dev)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = device_chld_unbind(dev);
|
ret = device_unbind_children(dev);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
@ -159,7 +145,7 @@ int device_remove(struct udevice *dev)
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
ret = device_chld_remove(dev);
|
ret = device_remove_children(dev);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
|
|
|
@ -107,6 +107,32 @@ int device_unbind(struct udevice *dev);
|
||||||
static inline int device_unbind(struct udevice *dev) { return 0; }
|
static inline int device_unbind(struct udevice *dev) { return 0; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* device_remove_children() - Stop all device's children
|
||||||
|
* @dev: The device whose children are to be removed
|
||||||
|
* @return 0 on success, -ve on error
|
||||||
|
*/
|
||||||
|
#ifdef CONFIG_DM_DEVICE_REMOVE
|
||||||
|
int device_remove_children(struct udevice *dev);
|
||||||
|
#else
|
||||||
|
static inline int device_remove_children(struct udevice *dev) { return 0; }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* device_unbind_children() - Unbind all device's children from the device
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* @return 0 on success, -ve on error
|
||||||
|
*/
|
||||||
|
#ifdef CONFIG_DM_DEVICE_REMOVE
|
||||||
|
int device_unbind_children(struct udevice *dev);
|
||||||
|
#else
|
||||||
|
static inline int device_unbind_children(struct udevice *dev) { return 0; }
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_DM_DEVICE_REMOVE
|
#ifdef CONFIG_DM_DEVICE_REMOVE
|
||||||
void device_free(struct udevice *dev);
|
void device_free(struct udevice *dev);
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Reference in a new issue