diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2013-07-16 11:16:24 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2013-11-06 10:24:46 +0100 |
commit | d7c1612d650e87dbdebf8957bc01bd1db52f0d5b (patch) | |
tree | 3a97b1663cf1a2d72142ee1f30f8d3dfb3266a77 /common | |
parent | 91b3761ec87a0194b7cb7a0b5ed983504c876195 (diff) | |
download | barebox-d7c1612d650e87dbdebf8957bc01bd1db52f0d5b.tar.gz barebox-d7c1612d650e87dbdebf8957bc01bd1db52f0d5b.tar.xz |
of: Add a context pointer to fixup functions
If drivers want to fixup their specific instance they need some context
to know which instance they have to fixup.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common')
-rw-r--r-- | common/memory.c | 4 | ||||
-rw-r--r-- | common/oftree.c | 12 |
2 files changed, 9 insertions, 7 deletions
diff --git a/common/memory.c b/common/memory.c index 7ec211b8da..c82bbaaf4c 100644 --- a/common/memory.c +++ b/common/memory.c @@ -163,7 +163,7 @@ int release_sdram_region(struct resource *res) #ifdef CONFIG_OFTREE -static int of_memory_fixup(struct device_node *node) +static int of_memory_fixup(struct device_node *node, void *unused) { struct memory_bank *bank; int err; @@ -200,7 +200,7 @@ static int of_memory_fixup(struct device_node *node) static int of_register_memory_fixup(void) { - return of_register_fixup(of_memory_fixup); + return of_register_fixup(of_memory_fixup, NULL); } late_initcall(of_register_memory_fixup); #endif diff --git a/common/oftree.c b/common/oftree.c index f2a31692ec..50fc95b588 100644 --- a/common/oftree.c +++ b/common/oftree.c @@ -113,7 +113,7 @@ void of_print_cmdline(struct device_node *root) printf("commandline: %s\n", cmdline); } -static int of_fixup_bootargs(struct device_node *root) +static int of_fixup_bootargs(struct device_node *root, void *unused) { struct device_node *node; const char *str; @@ -135,22 +135,24 @@ static int of_fixup_bootargs(struct device_node *root) static int of_register_bootargs_fixup(void) { - return of_register_fixup(of_fixup_bootargs); + return of_register_fixup(of_fixup_bootargs, NULL); } late_initcall(of_register_bootargs_fixup); struct of_fixup { - int (*fixup)(struct device_node *); + int (*fixup)(struct device_node *, void *); + void *context; struct list_head list; }; static LIST_HEAD(of_fixup_list); -int of_register_fixup(int (*fixup)(struct device_node *)) +int of_register_fixup(int (*fixup)(struct device_node *, void *), void *context) { struct of_fixup *of_fixup = xzalloc(sizeof(*of_fixup)); of_fixup->fixup = fixup; + of_fixup->context = context; list_add_tail(&of_fixup->list, &of_fixup_list); @@ -167,7 +169,7 @@ int of_fix_tree(struct device_node *node) int ret; list_for_each_entry(of_fixup, &of_fixup_list, list) { - ret = of_fixup->fixup(node); + ret = of_fixup->fixup(node, of_fixup->context); if (ret) return ret; } |