Skip to content

Commit

Permalink
bootconfig: Remove duplicate included header file linux/bootconfig.h
Browse files Browse the repository at this point in the history
The header file linux/bootconfig.h is included whether __KERNEL__ is
defined or not.

Include it only once before the #ifdef/#else/#endif preprocessor
directives and remove the following make includecheck warning:

  linux/bootconfig.h is included more than once

Move the comment to the top and delete the now empty #else block.

Link: https://lore.kernel.org/all/[email protected]/

Signed-off-by: Thorsten Blum <[email protected]>
Signed-off-by: Masami Hiramatsu (Google) <[email protected]>
  • Loading branch information
toblux authored and mhiramat committed Jul 11, 2024
1 parent 256abd8 commit 0d9c0a6
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions lib/bootconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,16 @@
* Masami Hiramatsu <[email protected]>
*/

#ifdef __KERNEL__
/*
* NOTE: This is only for tools/bootconfig, because tools/bootconfig will
* run the parser sanity test.
* This does NOT mean lib/bootconfig.c is available in the user space.
* However, if you change this file, please make sure the tools/bootconfig
* has no issue on building and running.
*/
#include <linux/bootconfig.h>

#ifdef __KERNEL__
#include <linux/bug.h>
#include <linux/ctype.h>
#include <linux/errno.h>
Expand All @@ -24,16 +32,6 @@ const char * __init xbc_get_embedded_bootconfig(size_t *size)
return (*size) ? embedded_bootconfig_data : NULL;
}
#endif

#else /* !__KERNEL__ */
/*
* NOTE: This is only for tools/bootconfig, because tools/bootconfig will
* run the parser sanity test.
* This does NOT mean lib/bootconfig.c is available in the user space.
* However, if you change this file, please make sure the tools/bootconfig
* has no issue on building and running.
*/
#include <linux/bootconfig.h>
#endif

/*
Expand Down

0 comments on commit 0d9c0a6

Please sign in to comment.