diff --git a/mm/page_size_compat.c b/mm/page_size_compat.c index 1fb9fd17d56f..19cd902aed87 100644 --- a/mm/page_size_compat.c +++ b/mm/page_size_compat.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -25,11 +26,15 @@ EXPORT_SYMBOL_GPL(page_shift_compat_enabled); int page_shift_compat __ro_after_init = MIN_PAGE_SHIFT_COMPAT; EXPORT_SYMBOL_GPL(page_shift_compat); -static int __init early_page_shift_compat(char *buf) +static int __init page_shift_params(char *param, char *val, + const char *unused, void *arg) { int ret; - ret = kstrtoint(buf, 10, &page_shift_compat); + if (strcmp(param, "page_shift") != 0) + return 0; + + ret = kstrtoint(val, 10, &page_shift_compat); if (ret) return ret; @@ -45,7 +50,20 @@ static int __init early_page_shift_compat(char *buf) return 0; } -early_param("page_shift", early_page_shift_compat); + +static int __init init_page_shift_compat(void) +{ + char *err; + + err = parse_args("page_shift", saved_command_line, NULL, 0, 0, 0, NULL, + page_shift_params); + + if (IS_ERR(err)) + return -EINVAL; + + return 0; +} +pure_initcall(init_page_shift_compat); static int __init init_mmap_rnd_bits(void) {