diff mbox

[U-Boot,u-boot,35/40] common: cmd_dfu: invoke board_usb_cleanup() for cleaning up

Message ID 1423212497-11970-36-git-send-email-kishon@ti.com
State Accepted
Delegated to: Łukasz Majewski
Headers show

Commit Message

Kishon Vijay Abraham I Feb. 6, 2015, 8:48 a.m. UTC
Invoked board_usb_cleanup for cleaning up initialized USB. It
will be invoked if the user enterts ctrl-C.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 common/cmd_dfu.c |    1 +
 common/usb.c     |    7 +++++++
 2 files changed, 8 insertions(+)

Comments

Łukasz Majewski Feb. 16, 2015, 11:47 a.m. UTC | #1
Hi Kishon,

> Invoked board_usb_cleanup for cleaning up initialized USB. It
> will be invoked if the user enterts ctrl-C.
> 
> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> ---
>  common/cmd_dfu.c |    1 +
>  common/usb.c     |    7 +++++++
>  2 files changed, 8 insertions(+)
> 
> diff --git a/common/cmd_dfu.c b/common/cmd_dfu.c
> index e975abe..161d38b 100644
> --- a/common/cmd_dfu.c
> +++ b/common/cmd_dfu.c
> @@ -68,6 +68,7 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int
> argc, char * const argv[]) }
>  exit:
>  	g_dnl_unregister();
> +	board_usb_cleanup(controller_index, USB_INIT_DEVICE);
>  done:
>  	dfu_free_entities();
>  
> diff --git a/common/usb.c b/common/usb.c
> index 736cd9f..c7cc1b1 100644
> --- a/common/usb.c
> +++ b/common/usb.c
> @@ -1063,4 +1063,11 @@ int board_usb_init(int index, enum
> usb_init_type init) {
>  	return 0;
>  }
> +
> +

Extra blank line is not needed here.

> +__weak
> +int board_usb_cleanup(int index, enum usb_init_type init)
> +{
> +	return 0;
> +}
>  /* EOF */

Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
diff mbox

Patch

diff --git a/common/cmd_dfu.c b/common/cmd_dfu.c
index e975abe..161d38b 100644
--- a/common/cmd_dfu.c
+++ b/common/cmd_dfu.c
@@ -68,6 +68,7 @@  static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	}
 exit:
 	g_dnl_unregister();
+	board_usb_cleanup(controller_index, USB_INIT_DEVICE);
 done:
 	dfu_free_entities();
 
diff --git a/common/usb.c b/common/usb.c
index 736cd9f..c7cc1b1 100644
--- a/common/usb.c
+++ b/common/usb.c
@@ -1063,4 +1063,11 @@  int board_usb_init(int index, enum usb_init_type init)
 {
 	return 0;
 }
+
+
+__weak
+int board_usb_cleanup(int index, enum usb_init_type init)
+{
+	return 0;
+}
 /* EOF */