module: Add a new entry to the priority of modules 71/290871/5
authorSangYoun Kwak <sy.kwak@samsung.com>
Tue, 4 Apr 2023 09:27:43 +0000 (18:27 +0900)
committerSangYoun Kwak <sy.kwak@samsung.com>
Fri, 7 Apr 2023 04:55:18 +0000 (13:55 +0900)
A new entry, MODULE_PRIORITY_INITIAL is added to the enum of
module_priority.

This priority is added for the reason below:
 * Since the 'lowmem' module has MODULE_PRIORITY_EARLY as its priority,
   modules separated from 'lowmem' module should be initialized before
   MODULE_PRIORITY_HIGH but after MODULE_PRIORITY_EARLY.

Thus, the newly added priority MODULE_PRIORITY_INITIAL will be used by
modules which need to be initialized before all other modules but after
MODULE_PRIORITY_EARLY.

Change-Id: I07f31f05c5b8851de14a8461504ce04784b6722f
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
src/common/module/module.c
src/common/module/module.h

index ce2df2c..406f798 100644 (file)
@@ -49,6 +49,7 @@ static void assert_priority(enum module_priority priority)
 {
        switch(priority) {
        case MODULE_PRIORITY_LATE:
+       case MODULE_PRIORITY_INITIAL:
        case MODULE_PRIORITY_NORMAL:
        case MODULE_PRIORITY_HIGH:
        case MODULE_PRIORITY_EARLY:
@@ -151,12 +152,14 @@ static void module_init_per_priority(void *data, enum module_priority priority)
 void modules_init(void *data)
 {
        module_init_per_priority(data, MODULE_PRIORITY_EARLY);
+       module_init_per_priority(data, MODULE_PRIORITY_INITIAL);
        module_init_per_priority(data, MODULE_PRIORITY_HIGH);
 }
 
 void modules_init_late(void *data)
 {
        module_init_per_priority(data, MODULE_PRIORITY_EARLY);
+       module_init_per_priority(data, MODULE_PRIORITY_INITIAL);
        module_init_per_priority(data, MODULE_PRIORITY_HIGH);
        module_init_per_priority(data, MODULE_PRIORITY_NORMAL);
        module_init_per_priority(data, MODULE_PRIORITY_LATE);
index c66b7b9..f3eb99b 100644 (file)
@@ -34,12 +34,14 @@ extern "C" {
  * modules.
  */
 enum module_priority {
+       /* FIXME: Rename the priority enum symbols below */
        MODULE_PRIORITY_MIN = -1,       /* indicates the start of priority */
                                        /* Don't use MODULE_PRIORITY_MIN as a priority */
 
        MODULE_PRIORITY_LATE = 0,       /* Default priority */
        MODULE_PRIORITY_NORMAL,         /* Initialized after booting is done */
        MODULE_PRIORITY_HIGH,           /* Initialized as soon as resourced is started */
+       MODULE_PRIORITY_INITIAL,        /* Initialized right after EARLY priority modules */
        MODULE_PRIORITY_EARLY,          /* initialized before NORMAL priority modules */
 
        MODULE_PRIORITY_MAX,            /* indicates the number of priorities*/