diff options
Diffstat (limited to 'include/linux/init.h')
| -rw-r--r-- | include/linux/init.h | 38 |
1 files changed, 29 insertions, 9 deletions
diff --git a/include/linux/init.h b/include/linux/init.h index 2df8e8dd10a4..21b6d768edd7 100644 --- a/include/linux/init.h +++ b/include/linux/init.h | |||
| @@ -253,21 +253,41 @@ struct obs_kernel_param { | |||
| 253 | * obs_kernel_param "array" too far apart in .init.setup. | 253 | * obs_kernel_param "array" too far apart in .init.setup. |
| 254 | */ | 254 | */ |
| 255 | #define __setup_param(str, unique_id, fn, early) \ | 255 | #define __setup_param(str, unique_id, fn, early) \ |
| 256 | static const char __setup_str_##unique_id[] __initconst \ | 256 | static const char __setup_str_##unique_id[] __initconst \ |
| 257 | __aligned(1) = str; \ | 257 | __aligned(1) = str; \ |
| 258 | static struct obs_kernel_param __setup_##unique_id \ | 258 | static struct obs_kernel_param __setup_##unique_id \ |
| 259 | __used __section(.init.setup) \ | 259 | __used __section(.init.setup) \ |
| 260 | __attribute__((aligned((sizeof(long))))) \ | 260 | __attribute__((aligned((sizeof(long))))) \ |
| 261 | = { __setup_str_##unique_id, fn, early } | 261 | = { __setup_str_##unique_id, fn, early } |
| 262 | 262 | ||
| 263 | #define __setup(str, fn) \ | 263 | #define __setup(str, fn) \ |
| 264 | __setup_param(str, fn, fn, 0) | 264 | __setup_param(str, fn, fn, 0) |
| 265 | 265 | ||
| 266 | /* NOTE: fn is as per module_param, not __setup! Emits warning if fn | 266 | /* |
| 267 | * returns non-zero. */ | 267 | * NOTE: fn is as per module_param, not __setup! |
| 268 | #define early_param(str, fn) \ | 268 | * Emits warning if fn returns non-zero. |
| 269 | */ | ||
| 270 | #define early_param(str, fn) \ | ||
| 269 | __setup_param(str, fn, fn, 1) | 271 | __setup_param(str, fn, fn, 1) |
| 270 | 272 | ||
| 273 | #define early_param_on_off(str_on, str_off, var, config) \ | ||
| 274 | \ | ||
| 275 | int var = IS_ENABLED(config); \ | ||
| 276 | \ | ||
| 277 | static int __init parse_##var##_on(char *arg) \ | ||
| 278 | { \ | ||
| 279 | var = 1; \ | ||
| 280 | return 0; \ | ||
| 281 | } \ | ||
| 282 | __setup_param(str_on, parse_##var##_on, parse_##var##_on, 1); \ | ||
| 283 | \ | ||
| 284 | static int __init parse_##var##_off(char *arg) \ | ||
| 285 | { \ | ||
| 286 | var = 0; \ | ||
| 287 | return 0; \ | ||
| 288 | } \ | ||
| 289 | __setup_param(str_off, parse_##var##_off, parse_##var##_off, 1) | ||
| 290 | |||
| 271 | /* Relies on boot_command_line being set */ | 291 | /* Relies on boot_command_line being set */ |
| 272 | void __init parse_early_param(void); | 292 | void __init parse_early_param(void); |
| 273 | void __init parse_early_options(char *cmdline); | 293 | void __init parse_early_options(char *cmdline); |
