diff mbox

[U-Boot,06/22] dm: Export device_chld_remove / device_chld_unbind

Message ID 1434569645-30322-7-git-send-email-hdegoede@redhat.com
State Superseded
Delegated to: Simon Glass
Headers show

Commit Message

Hans de Goede June 17, 2015, 7:33 p.m. UTC
These functions are useful to remove all children from an usb bus before
rescanning the bus.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/core/device-remove.c | 18 ++----------------
 include/dm/device-internal.h | 26 ++++++++++++++++++++++++++
 2 files changed, 28 insertions(+), 16 deletions(-)

Comments

Simon Glass June 29, 2015, 3:45 a.m. UTC | #1
Hi Hans,

On 17 June 2015 at 13:33, Hans de Goede <hdegoede@redhat.com> wrote:
> These functions are useful to remove all children from an usb bus before
> rescanning the bus.
>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
>  drivers/core/device-remove.c | 18 ++----------------
>  include/dm/device-internal.h | 26 ++++++++++++++++++++++++++
>  2 files changed, 28 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/core/device-remove.c b/drivers/core/device-remove.c
> index 6a16b4f..06de7e3 100644
> --- a/drivers/core/device-remove.c
> +++ b/drivers/core/device-remove.c
> @@ -18,16 +18,7 @@
>  #include <dm/uclass-internal.h>
>  #include <dm/util.h>
>
> -/**
> - * 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)
> +int device_chld_unbind(struct udevice *dev)

If we are exporting this can we give it a better name? Maybe
device_unbind_children()?

>  {
>         struct udevice *pos, *n;
>         int ret, saved_ret = 0;
> @@ -43,12 +34,7 @@ static int device_chld_unbind(struct udevice *dev)
>         return saved_ret;
>  }
>
> -/**
> - * 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)
> +int device_chld_remove(struct udevice *dev)
>  {
>         struct udevice *pos, *n;
>         int ret;
> diff --git a/include/dm/device-internal.h b/include/dm/device-internal.h
> index 687462b..6c8fe23 100644
> --- a/include/dm/device-internal.h
> +++ b/include/dm/device-internal.h
> @@ -107,6 +107,32 @@ int device_unbind(struct udevice *dev);
>  static inline int device_unbind(struct udevice *dev) { return 0; }
>  #endif
>
> +/**
> + * device_chld_remove() - 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_chld_remove(struct udevice *dev);
> +#else
> +static inline int device_chld_remove(struct udevice *dev) { return 0; }
> +#endif
> +
> +/**
> + * 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
> + */
> +#ifdef CONFIG_DM_DEVICE_REMOVE
> +int device_chld_unbind(struct udevice *dev);
> +#else
> +static inline int device_chld_unbind(struct udevice *dev) { return 0; }
> +#endif
> +
>  #ifdef CONFIG_DM_DEVICE_REMOVE
>  void device_free(struct udevice *dev);
>  #else
> --
> 2.4.3
>

Regards,
Simon
Hans de Goede June 30, 2015, 12:33 p.m. UTC | #2
Hi,

On 29-06-15 05:45, Simon Glass wrote:
> Hi Hans,
>
> On 17 June 2015 at 13:33, Hans de Goede <hdegoede@redhat.com> wrote:
>> These functions are useful to remove all children from an usb bus before
>> rescanning the bus.
>>
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>> ---
>>   drivers/core/device-remove.c | 18 ++----------------
>>   include/dm/device-internal.h | 26 ++++++++++++++++++++++++++
>>   2 files changed, 28 insertions(+), 16 deletions(-)
>>
>> diff --git a/drivers/core/device-remove.c b/drivers/core/device-remove.c
>> index 6a16b4f..06de7e3 100644
>> --- a/drivers/core/device-remove.c
>> +++ b/drivers/core/device-remove.c
>> @@ -18,16 +18,7 @@
>>   #include <dm/uclass-internal.h>
>>   #include <dm/util.h>
>>
>> -/**
>> - * 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)
>> +int device_chld_unbind(struct udevice *dev)
>
> If we are exporting this can we give it a better name? Maybe
> device_unbind_children()?

Will do for v2 of this set.

Regards,

Hans

>
>>   {
>>          struct udevice *pos, *n;
>>          int ret, saved_ret = 0;
>> @@ -43,12 +34,7 @@ static int device_chld_unbind(struct udevice *dev)
>>          return saved_ret;
>>   }
>>
>> -/**
>> - * 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)
>> +int device_chld_remove(struct udevice *dev)
>>   {
>>          struct udevice *pos, *n;
>>          int ret;
>> diff --git a/include/dm/device-internal.h b/include/dm/device-internal.h
>> index 687462b..6c8fe23 100644
>> --- a/include/dm/device-internal.h
>> +++ b/include/dm/device-internal.h
>> @@ -107,6 +107,32 @@ int device_unbind(struct udevice *dev);
>>   static inline int device_unbind(struct udevice *dev) { return 0; }
>>   #endif
>>
>> +/**
>> + * device_chld_remove() - 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_chld_remove(struct udevice *dev);
>> +#else
>> +static inline int device_chld_remove(struct udevice *dev) { return 0; }
>> +#endif
>> +
>> +/**
>> + * 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
>> + */
>> +#ifdef CONFIG_DM_DEVICE_REMOVE
>> +int device_chld_unbind(struct udevice *dev);
>> +#else
>> +static inline int device_chld_unbind(struct udevice *dev) { return 0; }
>> +#endif
>> +
>>   #ifdef CONFIG_DM_DEVICE_REMOVE
>>   void device_free(struct udevice *dev);
>>   #else
>> --
>> 2.4.3
>>
>
> Regards,
> Simon
>
diff mbox

Patch

diff --git a/drivers/core/device-remove.c b/drivers/core/device-remove.c
index 6a16b4f..06de7e3 100644
--- a/drivers/core/device-remove.c
+++ b/drivers/core/device-remove.c
@@ -18,16 +18,7 @@ 
 #include <dm/uclass-internal.h>
 #include <dm/util.h>
 
-/**
- * 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)
+int device_chld_unbind(struct udevice *dev)
 {
 	struct udevice *pos, *n;
 	int ret, saved_ret = 0;
@@ -43,12 +34,7 @@  static int device_chld_unbind(struct udevice *dev)
 	return saved_ret;
 }
 
-/**
- * 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)
+int device_chld_remove(struct udevice *dev)
 {
 	struct udevice *pos, *n;
 	int ret;
diff --git a/include/dm/device-internal.h b/include/dm/device-internal.h
index 687462b..6c8fe23 100644
--- a/include/dm/device-internal.h
+++ b/include/dm/device-internal.h
@@ -107,6 +107,32 @@  int device_unbind(struct udevice *dev);
 static inline int device_unbind(struct udevice *dev) { return 0; }
 #endif
 
+/**
+ * device_chld_remove() - 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_chld_remove(struct udevice *dev);
+#else
+static inline int device_chld_remove(struct udevice *dev) { return 0; }
+#endif
+
+/**
+ * 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
+ */
+#ifdef CONFIG_DM_DEVICE_REMOVE
+int device_chld_unbind(struct udevice *dev);
+#else
+static inline int device_chld_unbind(struct udevice *dev) { return 0; }
+#endif
+
 #ifdef CONFIG_DM_DEVICE_REMOVE
 void device_free(struct udevice *dev);
 #else