diff mbox series

[v3,6/9] tftp: implement support for LED activity

Message ID 20240812103254.26972-7-ansuelsmth@gmail.com
State Changes Requested
Delegated to: Tom Rini
Headers show
Series led: introduce LED boot and activity function | expand

Commit Message

Christian Marangi Aug. 12, 2024, 10:32 a.m. UTC
Implement support for LED activity. If the feature is enabled,
make the defined ACTIVITY LED to signal traffic.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
 net/tftp.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Simon Glass Sept. 19, 2024, 2:13 p.m. UTC | #1
Hi Christian,

On Mon, 12 Aug 2024 at 12:33, Christian Marangi <ansuelsmth@gmail.com> wrote:
>
> Implement support for LED activity. If the feature is enabled,
> make the defined ACTIVITY LED to signal traffic.
>
> Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
> ---
>  net/tftp.c | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/net/tftp.c b/net/tftp.c
> index 2e073183d5a..45c2455336a 100644
> --- a/net/tftp.c
> +++ b/net/tftp.c
> @@ -10,6 +10,7 @@
>  #include <efi_loader.h>
>  #include <env.h>
>  #include <image.h>
> +#include <led.h>
>  #include <lmb.h>
>  #include <log.h>
>  #include <mapmem.h>
> @@ -192,6 +193,9 @@ static void new_transfer(void)
>  #ifdef CONFIG_CMD_TFTPPUT
>         tftp_put_final_block_sent = 0;
>  #endif
> +#ifdef CONFIG_LED_ACTIVITY_ENABLE
> +       led_activity_blink();

If you make that an empty static inline when !LED_ACTIVITY_ENABLE and
a real function when CONFIG_LED_ACTIVITY_ENABLE, then you can drop the
#ifdef here.

Also, can you drop the _ENABLE suffix? All CONFIGs enable something.

> +#endif
>  }
>
>  #ifdef CONFIG_CMD_TFTPPUT
> @@ -301,6 +305,9 @@ static void tftp_complete(void)
>                         time_start * 1000, "/s");
>         }
>         puts("\ndone\n");
> +#ifdef CONFIG_LED_ACTIVITY_ENABLE
> +       led_activity_off();
> +#endif
>         if (!tftp_put_active)
>                 efi_set_bootdev("Net", "", tftp_filename,
>                                 map_sysmem(tftp_load_addr, 0),
> --
> 2.45.2
>

Regards,
Simon
diff mbox series

Patch

diff --git a/net/tftp.c b/net/tftp.c
index 2e073183d5a..45c2455336a 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -10,6 +10,7 @@ 
 #include <efi_loader.h>
 #include <env.h>
 #include <image.h>
+#include <led.h>
 #include <lmb.h>
 #include <log.h>
 #include <mapmem.h>
@@ -192,6 +193,9 @@  static void new_transfer(void)
 #ifdef CONFIG_CMD_TFTPPUT
 	tftp_put_final_block_sent = 0;
 #endif
+#ifdef CONFIG_LED_ACTIVITY_ENABLE
+	led_activity_blink();
+#endif
 }
 
 #ifdef CONFIG_CMD_TFTPPUT
@@ -301,6 +305,9 @@  static void tftp_complete(void)
 			time_start * 1000, "/s");
 	}
 	puts("\ndone\n");
+#ifdef CONFIG_LED_ACTIVITY_ENABLE
+	led_activity_off();
+#endif
 	if (!tftp_put_active)
 		efi_set_bootdev("Net", "", tftp_filename,
 				map_sysmem(tftp_load_addr, 0),