]> git.baikalelectronics.ru Git - uboot.git/commitdiff
cyclic: use a flag in gd->flags for recursion protection
authorRasmus Villemoes <rasmus.villemoes@prevas.dk>
Fri, 28 Oct 2022 11:50:50 +0000 (13:50 +0200)
committerStefan Roese <sr@denx.de>
Wed, 2 Nov 2022 07:41:20 +0000 (08:41 +0100)
As a preparation for future patches, use a flag in gd->flags rather
than a separate member in (the singleton) struct cyclic_drv to keep
track of whether we're already inside cyclic_run().

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
Tested-by: Tim Harvey <tharvey@gateworks.com> # imx8mm-venice-*
common/cyclic.c
include/asm-generic/global_data.h
include/cyclic.h

index 7abb82c16a909841339282d572261452864d875a..ff75c8cadb9125819e126e10237395f3f7e6fb41 100644 (file)
@@ -66,10 +66,10 @@ void cyclic_run(void)
        uint64_t now, cpu_time;
 
        /* Prevent recursion */
-       if (gd->cyclic->cyclic_running)
+       if (gd->flags & GD_FLG_CYCLIC_RUNNING)
                return;
 
-       gd->cyclic->cyclic_running = true;
+       gd->flags |= GD_FLG_CYCLIC_RUNNING;
        list_for_each_entry_safe(cyclic, tmp, &gd->cyclic->cyclic_list, list) {
                /*
                 * Check if this cyclic function needs to get called, e.g.
@@ -99,7 +99,7 @@ void cyclic_run(void)
                        }
                }
        }
-       gd->cyclic->cyclic_running = false;
+       gd->flags &= ~GD_FLG_CYCLIC_RUNNING;
 }
 
 void schedule(void)
index c4b2bb44973246ece071ae9f23bb030f357ed9f0..8d348b0ec04397f2dc12e80925cd93c282bb4f8e 100644 (file)
@@ -650,6 +650,10 @@ enum gd_flags {
         * @GD_FLG_FDT_CHANGED: Device tree change has been detected by tests
         */
        GD_FLG_FDT_CHANGED = 0x100000,
+       /**
+        * GD_FLG_CYCLIC_RUNNING: cyclic_run is in progress
+        */
+       GD_FLG_CYCLIC_RUNNING = 0x200000,
 };
 
 #endif /* __ASSEMBLY__ */
index 9c5c4fcc54681680540487ba0b7af9fde66405e9..50427baa3f49d65044fadce2738ac3c0c664a523 100644 (file)
  *
  * @cyclic_list: Cylic list node
  * @cyclic_ready: Flag if cyclic infrastructure is ready
- * @cyclic_running: Flag if cyclic infrastructure is running
  */
 struct cyclic_drv {
        struct list_head cyclic_list;
        bool cyclic_ready;
-       bool cyclic_running;
 };
 
 /**