[PATCH 01/14] show_progress: add system wide progress stage notifier

Sascha Hauer sha at pengutronix.de
Thu Apr 15 08:29:11 BST 2021


On Tue, Apr 13, 2021 at 12:34:49AM +0200, Ahmad Fatoum wrote:
> Use case is e.g. board code that wants to register a client to light
> status LEDs to indicate system state when no serial output is available.
> This functionality doesn't increase code size due to linker GC when
> CONFIG_PROGRESS_NOTIFIER is disabled.
> 
> There is a generic progress notifier provided that just logs the
> status. This could be shared with the booted kernel via pstore or
> the log as a whole written to a system setup USB drive.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
> ---
>  include/progress.h  | 43 +++++++++++++++++++++++++++++++++++++++++++
>  lib/Kconfig         |  6 ++++++
>  lib/show_progress.c | 28 ++++++++++++++++++++++++++++
>  3 files changed, 77 insertions(+)
> 
> diff --git a/include/progress.h b/include/progress.h
> index 50b15fb12b4c..7230bd3a9bd5 100644
> --- a/include/progress.h
> +++ b/include/progress.h
> @@ -3,6 +3,8 @@
>  #define __PROGRSS_H
>  
>  #include <linux/types.h>
> +#include <notifier.h>
> +#include <errno.h>
>  
>  /* Initialize a progress bar. If max > 0 a one line progress
>   * bar is printed where 'max' corresponds to 100%. If max == 0
> @@ -15,4 +17,45 @@ void init_progression_bar(loff_t max);
>   */
>  void show_progress(loff_t now);
>  
> +extern struct notifier_head progress_notifier;
> +
> +enum progress_stage {
> +	PROGRESS_UNSPECIFIED = 0,
> +	PROGRESS_UPDATING,
> +	PROGRESS_UPDATE_SUCCESS,
> +	PROGRESS_UPDATE_FAIL,
> +};

Neither the commit message nor the function names say it, but here it
seems the progress is only used in context of a software update. Do you
anticipate going other types of progress here as well?

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list