Update the cyclic demo code and documentation to indicate there
is now a return code from cyclic_register().

Signed-off-by: Marek Vasut <[email protected]>
---
Cc: Aaron Williams <[email protected]>
Cc: Anatolij Gustschin <[email protected]>
Cc: Angelo Dureghello <[email protected]>
Cc: Christian Marangi <[email protected]>
Cc: Devarsh Thakkar <[email protected]>
Cc: Heinrich Schuchardt <[email protected]>
Cc: Jaehoon Chung <[email protected]>
Cc: Michael Polyntsov <[email protected]>
Cc: Michael Trimarchi <[email protected]>
Cc: Nikhil M Jain <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Peter Robinson <[email protected]>
Cc: Rasmus Villemoes <[email protected]>
Cc: Ronald Wahl <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Stefan Roese <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
---
 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

Reply via email to