[PATCH 2/8] cyclic: Handle return code from cyclic_register() in demo and docs
Marek Vasut
marek.vasut+renesas at mailbox.org
Sat Jan 18 05:00:56 CET 2025
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 at mailbox.org>
---
Cc: Aaron Williams <awilliams at marvell.com>
Cc: Anatolij Gustschin <agust at denx.de>
Cc: Angelo Dureghello <angelo at kernel-space.org>
Cc: Christian Marangi <ansuelsmth at gmail.com>
Cc: Devarsh Thakkar <devarsht at ti.com>
Cc: Heinrich Schuchardt <xypron.glpk at gmx.de>
Cc: Jaehoon Chung <jh80.chung at samsung.com>
Cc: Michael Polyntsov <michael.polyntsov at iopsys.eu>
Cc: Michael Trimarchi <michael at amarulasolutions.com>
Cc: Nikhil M Jain <n-jain1 at ti.com>
Cc: Peng Fan <peng.fan at nxp.com>
Cc: Peter Robinson <pbrobinson at gmail.com>
Cc: Rasmus Villemoes <rasmus.villemoes at prevas.dk>
Cc: Ronald Wahl <ronald.wahl at legrand.com>
Cc: Simon Glass <sjg at chromium.org>
Cc: Stefan Roese <sr at denx.de>
Cc: Tim Harvey <tharvey at gateworks.com>
Cc: Tom Rini <trini at konsulko.com>
Cc: u-boot at 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
--
2.45.2
More information about the U-Boot
mailing list