aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuis R. Rodriguez <mcgrof@kernel.org>2015-10-23 19:03:19 -0700
committerLuis R. Rodriguez <mcgrof@kernel.org>2016-02-11 08:42:16 -0800
commit0f9830d41512fc40509526e5ac25baffd241376c (patch)
treef9fef77223381afe03620197324d206aad95190d
parent01d9ed4478b880a3e638183d16dd9ae6fbc7b3b7 (diff)
downloadlinker-tables-0f9830d41512fc40509526e5ac25baffd241376c.tar.gz
init: add name support to the init structure
This lets us do all the printing. Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
-rw-r--r--bar.c3
-rw-r--r--foo.c4
-rw-r--r--init.c7
-rw-r--r--init.h2
-rw-r--r--main.c4
5 files changed, 7 insertions, 13 deletions
diff --git a/bar.c b/bar.c
index 881dfb6..d221ea4 100644
--- a/bar.c
+++ b/bar.c
@@ -3,11 +3,10 @@
#include "init.h"
static void init_bar(void) {
- printf("bar is going to init\n");
sleep(2);
}
struct init_fn bar_init_fn __init_fn (INIT_NORMAL) = {
.initialise = init_bar,
- //.name = "Bar thing",
+ .name = "Bar thing",
};
diff --git a/foo.c b/foo.c
index 257a7e6..2c15fd6 100644
--- a/foo.c
+++ b/foo.c
@@ -3,12 +3,10 @@
#include "init.h"
static void init_foo(void) {
- printf("foo is about to start\n");
sleep(1);
- printf("foo started!\n");
}
struct init_fn foo_init_fn __init_fn(INIT_EARLY) = {
.initialise = init_foo,
- //.name = "Foo thing",
+ .name = "Foo thing",
};
diff --git a/init.c b/init.c
index 1c464a1..5cebb87 100644
--- a/init.c
+++ b/init.c
@@ -3,14 +3,12 @@
#include "init.h"
static void init_x(void) {
- printf("x is about to start\n");
sleep(1);
- printf("x started!\n");
}
struct init_fn x_init_fn __init_fn(INIT_EARLY) = {
.initialise = init_x,
- //.name = "X thing",
+ .name = "X thing",
};
int init(void)
@@ -22,8 +20,9 @@ int init(void)
printf("Number of init entries: %d\n", num_inits);
for_each_table_entry (init_fn, INIT_FNS) {
- //printf("Initializing %s ...", init_fn->name);
+ printf("Initializing %s ...\n", init_fn->name);
init_fn->initialise();
+ printf("Completed initializing %s !\n", init_fn->name);
}
return 0;
diff --git a/init.h b/init.h
index 15db838..ccfd9d0 100644
--- a/init.h
+++ b/init.h
@@ -8,7 +8,7 @@
*/
struct init_fn {
void (* initialise) (void);
- //const char *name;
+ const char *name;
};
/** Initialisation function table */
diff --git a/main.c b/main.c
index cdd437b..d0b197f 100644
--- a/main.c
+++ b/main.c
@@ -3,14 +3,12 @@
#include "init.h"
static void init_y(void) {
- printf("y is about to start\n");
sleep(1);
- printf("y started!\n");
}
struct init_fn y_init_fn __init_fn(INIT_EARLY) = {
.initialise = init_y,
- //.name = "Y thing",
+ .name = "Y thing",
};
int main(void)