--- zzzz-none-000/linux-2.6.39.4/arch/x86/mm/init.c 2011-08-03 19:43:28.000000000 +0000 +++ puma6-arm-6490-729/linux-2.6.39.4/arch/x86/mm/init.c 2021-11-10 13:23:10.000000000 +0000 @@ -373,8 +373,38 @@ #endif } +#ifdef CONFIG_AVM_ENHANCED +static int root_dev_setup_allowed = 1; + +/* As setup_root_dev_if_possible is initially allowed to use + * __init root_dev_setup() but may not be defined as __init since it is + * reference by the puma6_mtd_add_notifier() hook, thus marked with __ref. */ +int __ref setup_root_dev_if_possible(char *root_device) +{ + extern int root_dev_setup_allowed; + extern int root_dev_setup(char *); + + if (likely(root_dev_setup_allowed)) + return root_dev_setup(root_device); + else + BUG(); + return -ENOSYS; +} +#endif + + +static void disable_setup_root_dev_hook(void) +{ +#ifdef CONFIG_AVM_ENHANCED + root_dev_setup_allowed = 0; +#endif +} + + void free_initmem(void) { + disable_setup_root_dev_hook(); + free_init_pages("unused kernel memory", (unsigned long)(&__init_begin), (unsigned long)(&__init_end));