* [PATCH v2] bootconfig: Remove duplicate included header file linux/bootconfig.h
@ 2024-07-11 8:43 Thorsten Blum
2024-07-11 23:35 ` Masami Hiramatsu
0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2024-07-11 8:43 UTC (permalink / raw)
To: akpm, mhiramat; +Cc: linux-kernel, linux-trace-kernel, Thorsten Blum
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.
Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
---
Changes in v2:
- Move comment and delete #else as suggested by Masami Hiramatsu
- Link to v1: https://lore.kernel.org/linux-kernel/20240711002152.800028-2-thorsten.blum@toblux.com/
---
lib/bootconfig.c | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/lib/bootconfig.c b/lib/bootconfig.c
index 97f8911ea339..81f29c29f47b 100644
--- a/lib/bootconfig.c
+++ b/lib/bootconfig.c
@@ -4,8 +4,16 @@
* Masami Hiramatsu <mhiramat@kernel.org>
*/
-#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>
@@ -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
/*
--
2.39.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] bootconfig: Remove duplicate included header file linux/bootconfig.h
2024-07-11 8:43 [PATCH v2] bootconfig: Remove duplicate included header file linux/bootconfig.h Thorsten Blum
@ 2024-07-11 23:35 ` Masami Hiramatsu
0 siblings, 0 replies; 2+ messages in thread
From: Masami Hiramatsu @ 2024-07-11 23:35 UTC (permalink / raw)
To: Thorsten Blum; +Cc: akpm, linux-kernel, linux-trace-kernel
On Thu, 11 Jul 2024 10:43:16 +0200
Thorsten Blum <thorsten.blum@toblux.com> wrote:
> 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.
>
> Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
Thanks, looks good to me. Let me pick it up.
> ---
> Changes in v2:
> - Move comment and delete #else as suggested by Masami Hiramatsu
> - Link to v1: https://lore.kernel.org/linux-kernel/20240711002152.800028-2-thorsten.blum@toblux.com/
> ---
> lib/bootconfig.c | 20 +++++++++-----------
> 1 file changed, 9 insertions(+), 11 deletions(-)
>
> diff --git a/lib/bootconfig.c b/lib/bootconfig.c
> index 97f8911ea339..81f29c29f47b 100644
> --- a/lib/bootconfig.c
> +++ b/lib/bootconfig.c
> @@ -4,8 +4,16 @@
> * Masami Hiramatsu <mhiramat@kernel.org>
> */
>
> -#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>
> @@ -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
>
> /*
> --
> 2.39.2
>
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-07-11 23:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-11 8:43 [PATCH v2] bootconfig: Remove duplicate included header file linux/bootconfig.h Thorsten Blum
2024-07-11 23:35 ` Masami Hiramatsu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox