Skip to content

Commit c281b94

Browse files
author
Ingo Molnar
committed
init.h: Clean up the __setup()/early_param() macros
Make it all a bit easier on the eyes: - Move the __setup_param() lines right after their init functions - Use consistent vertical spacing - Use more horizontal spacing to make it look like regular C code - Use standard comment style Cc: Luis R. Rodriguez <mcgrof@suse.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Borislav Petkov <bp@alien8.de> Cc: Borislav Petkov <bp@suse.de> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: David Vrabel <david.vrabel@citrix.com> Cc: Dexuan Cui <decui@microsoft.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Jan Beulich <JBeulich@suse.com> Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com> Cc: Juergen Gross <jgross@suse.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Pavel Machek <pavel@ucw.cz> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Tony Lindgren <tony@atomide.com> Cc: Toshi Kani <toshi.kani@hp.com> Cc: Vlastimil Babka <vbabka@suse.cz> Cc: Xishi Qiu <qiuxishi@huawei.com> Cc: julia.lawall@lip6.fr Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent e61980a commit c281b94

File tree

1 file changed

+27
-22
lines changed

1 file changed

+27
-22
lines changed

include/linux/init.h

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -253,34 +253,39 @@ struct obs_kernel_param {
253253
* obs_kernel_param "array" too far apart in .init.setup.
254254
*/
255255
#define __setup_param(str, unique_id, fn, early) \
256-
static const char __setup_str_##unique_id[] __initconst \
257-
__aligned(1) = str; \
258-
static struct obs_kernel_param __setup_##unique_id \
259-
__used __section(.init.setup) \
260-
__attribute__((aligned((sizeof(long))))) \
256+
static const char __setup_str_##unique_id[] __initconst \
257+
__aligned(1) = str; \
258+
static struct obs_kernel_param __setup_##unique_id \
259+
__used __section(.init.setup) \
260+
__attribute__((aligned((sizeof(long))))) \
261261
= { __setup_str_##unique_id, fn, early }
262262

263-
#define __setup(str, fn) \
263+
#define __setup(str, fn) \
264264
__setup_param(str, fn, fn, 0)
265265

266-
/* NOTE: fn is as per module_param, not __setup! Emits warning if fn
267-
* returns non-zero. */
268-
#define early_param(str, fn) \
266+
/*
267+
* NOTE: fn is as per module_param, not __setup!
268+
* Emits warning if fn returns non-zero.
269+
*/
270+
#define early_param(str, fn) \
269271
__setup_param(str, fn, fn, 1)
270272

271-
#define early_param_on_off(str_on, str_off, var, config) \
272-
int var = IS_ENABLED(config); \
273-
static int __init parse_##var##_on(char *arg) \
274-
{ \
275-
var = 1; \
276-
return 0; \
277-
} \
278-
static int __init parse_##var##_off(char *arg) \
279-
{ \
280-
var = 0; \
281-
return 0; \
282-
} \
283-
__setup_param(str_on, parse_##var##_on, parse_##var##_on, 1); \
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+
} \
284289
__setup_param(str_off, parse_##var##_off, parse_##var##_off, 1)
285290

286291
/* Relies on boot_command_line being set */

0 commit comments

Comments
 (0)