
Update the cyclic demo code and documentation to indicate there is now a return code from cyclic_register().
Signed-off-by: Marek Vasut marek.vasut+renesas@mailbox.org --- Cc: Aaron Williams awilliams@marvell.com Cc: Anatolij Gustschin agust@denx.de Cc: Angelo Dureghello angelo@kernel-space.org Cc: Christian Marangi ansuelsmth@gmail.com Cc: Devarsh Thakkar devarsht@ti.com Cc: Heinrich Schuchardt xypron.glpk@gmx.de Cc: Jaehoon Chung jh80.chung@samsung.com Cc: Michael Polyntsov michael.polyntsov@iopsys.eu Cc: Michael Trimarchi michael@amarulasolutions.com Cc: Nikhil M Jain n-jain1@ti.com Cc: Peng Fan peng.fan@nxp.com Cc: Peter Robinson pbrobinson@gmail.com Cc: Rasmus Villemoes rasmus.villemoes@prevas.dk Cc: Ronald Wahl ronald.wahl@legrand.com Cc: Simon Glass sjg@chromium.org Cc: Stefan Roese sr@denx.de Cc: Tim Harvey tharvey@gateworks.com Cc: Tom Rini trini@konsulko.com Cc: u-boot@lists.denx.de --- cmd/cyclic.c | 10 ++++++---- doc/develop/cyclic.rst | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/cmd/cyclic.c b/cmd/cyclic.c index 339dd4a7bce..e98c4a488d6 100644 --- a/cmd/cyclic.c +++ b/cmd/cyclic.c @@ -33,8 +33,10 @@ static void cyclic_demo(struct cyclic_info *c) static int do_cyclic_demo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { + const char *demo_name = "cyclic_demo"; struct cyclic_demo_info *info; uint time_ms; + int ret;
if (argc < 3) return CMD_RET_USAGE; @@ -49,12 +51,12 @@ static int do_cyclic_demo(struct cmd_tbl *cmdtp, int flag, int argc, info->delay_us = simple_strtoul(argv[2], NULL, 0);
/* Register demo cyclic function */ - cyclic_register(&info->cyclic, cyclic_demo, time_ms * 1000, "cyclic_demo"); + ret = cyclic_register(&info->cyclic, cyclic_demo, time_ms * 1000, demo_name);
- printf("Registered function "%s" to be executed all %dms\n", - "cyclic_demo", time_ms); + printf("Registered function "%s" to be executed all %dms with return code %d\n", + demo_name, time_ms, ret);
- return 0; + return ret; }
static int do_cyclic_list(struct cmd_tbl *cmdtp, int flag, int argc, diff --git a/doc/develop/cyclic.rst b/doc/develop/cyclic.rst index 6f1da6f0d9b..604c0463f8d 100644 --- a/doc/develop/cyclic.rst +++ b/doc/develop/cyclic.rst @@ -38,9 +38,9 @@ To register a cyclic function, use something like this:: /* Initialize donkey ... */
/* Register demo cyclic function */ - cyclic_register(&donkey->cyclic, cyclic_demo, 10 * 1000, "cyclic_demo"); + ret = cyclic_register(&donkey->cyclic, cyclic_demo, 10 * 1000, "cyclic_demo");
- return 0; + return ret; }
This will register the function `cyclic_demo()` to be periodically