isystem: ship and use stdarg.h
authorAlexey Dobriyan <adobriyan@gmail.com>
Mon, 2 Aug 2021 20:40:32 +0000 (23:40 +0300)
committerMasahiro Yamada <masahiroy@kernel.org>
Thu, 19 Aug 2021 00:02:55 +0000 (09:02 +0900)
Ship minimal stdarg.h (1 type, 4 macros) as <linux/stdarg.h>.
stdarg.h is the only userspace header commonly used in the kernel.

GPL 2 version of <stdarg.h> can be extracted from
http://archive.debian.org/debian/pool/main/g/gcc-4.2/gcc-4.2_4.2.4.orig.tar.gz

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
31 files changed:
arch/parisc/kernel/firmware.c
arch/powerpc/kernel/prom_init.c
arch/powerpc/kernel/rtas.c
arch/powerpc/kernel/udbg.c
arch/s390/boot/pgm_check_info.c
arch/x86/boot/boot.h
drivers/firmware/efi/libstub/efi-stub-helper.c
drivers/firmware/efi/libstub/vsprintf.c
drivers/gpu/drm/amd/display/dc/dc_helper.c
drivers/gpu/drm/drm_print.c
drivers/isdn/capi/capiutil.c
drivers/macintosh/via-cuda.c
drivers/macintosh/via-pmu.c
drivers/staging/media/atomisp/pci/hive_isp_css_include/print_support.h
drivers/staging/media/atomisp/pci/ia_css_env.h
drivers/staging/media/atomisp/pci/runtime/debug/interface/ia_css_debug.h
drivers/staging/media/atomisp/pci/sh_css_internal.h
fs/befs/debug.c
fs/reiserfs/prints.c
fs/ufs/super.c
include/acpi/platform/acgcc.h
include/linux/kernel.h
include/linux/printk.h
include/linux/stdarg.h [new file with mode: 0644]
include/linux/string.h
lib/debug_info.c
lib/kasprintf.c
lib/kunit/string-stream.h
lib/vsprintf.c
mm/kfence/report.c
net/batman-adv/log.c

index 665b70086685c3f4c7229bdeafaeebd9d106512b..7034227dbdf32a83e37cc1ea8af6cfe3ef718265 100644 (file)
@@ -51,7 +51,7 @@
  *                                     prumpf  991016  
  */
 
-#include <stdarg.h>
+#include <linux/stdarg.h>
 
 #include <linux/delay.h>
 #include <linux/init.h>
index a5bf355ce1d632f032b855ff4089365d1d5b3ee1..10664633f7e38cb57a3b6632780b576812bb44d3 100644 (file)
@@ -14,7 +14,7 @@
 /* we cannot use FORTIFY as it brings in new symbols */
 #define __NO_FORTIFY
 
-#include <stdarg.h>
+#include <linux/stdarg.h>
 #include <linux/kernel.h>
 #include <linux/string.h>
 #include <linux/init.h>
index 99f2cce635fb11c04f3a5055f8820d9d5b72f7b6..ff80bbad22a58da8076b492068e07e76e95361b3 100644 (file)
@@ -7,7 +7,7 @@
  * Copyright (C) 2001 IBM.
  */
 
-#include <stdarg.h>
+#include <linux/stdarg.h>
 #include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/spinlock.h>
index 01595e8cafe7b41a5b5efdec540864f9bdfe6310..b1544b2f6321b2746ef553ad5e30dd14eda49d40 100644 (file)
@@ -5,7 +5,7 @@
  * c 2001 PPC 64 Team, IBM Corp
  */
 
-#include <stdarg.h>
+#include <linux/stdarg.h>
 #include <linux/types.h>
 #include <linux/sched.h>
 #include <linux/console.h>
index 3a46abed2549a259aa05e8fc7b15502335c385e9..b7d8dd88bbf266ab5af9e33cae88d064ed2a65fb 100644 (file)
@@ -1,5 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <linux/kernel.h>
+#include <linux/stdarg.h>
 #include <linux/string.h>
 #include <linux/ctype.h>
 #include <asm/stacktrace.h>
@@ -8,7 +9,6 @@
 #include <asm/setup.h>
 #include <asm/sclp.h>
 #include <asm/uv.h>
-#include <stdarg.h>
 #include "boot.h"
 
 const char hex_asc[] = "0123456789abcdef";
index ca866f1cca2ef1a733c1b91613bd5375962b5f3f..34c9dbb6a47d678e1f984947b2437523eb2d362e 100644 (file)
@@ -18,7 +18,7 @@
 
 #ifndef __ASSEMBLY__
 
-#include <stdarg.h>
+#include <linux/stdarg.h>
 #include <linux/types.h>
 #include <linux/edd.h>
 #include <asm/setup.h>
index ae87dded989db2e9ebbc4bb0c0c478f928fa257b..d489bdc645fe1a824cf21c0245d497d635637aff 100644 (file)
@@ -7,7 +7,7 @@
  * Copyright 2011 Intel Corporation; author Matt Fleming
  */
 
-#include <stdarg.h>
+#include <linux/stdarg.h>
 
 #include <linux/ctype.h>
 #include <linux/efi.h>
index 1088e288c04d73d6b349b229e2963b5e0e0d83ff..71c71c222346a4c5bb4a7eaeb9a1b3a7964761ef 100644 (file)
@@ -10,7 +10,7 @@
  * Oh, it's a waste of space, but oh-so-yummy for debugging.
  */
 
-#include <stdarg.h>
+#include <linux/stdarg.h>
 
 #include <linux/compiler.h>
 #include <linux/ctype.h>
index a612ba6dc3898526c6ad925a52b96a067cd62382..ab6bc5d79012559c032dac38ae8d680714c7c9d8 100644 (file)
@@ -28,9 +28,9 @@
  */
 
 #include <linux/delay.h>
+#include <linux/stdarg.h>
 
 #include "dm_services.h"
-#include <stdarg.h>
 
 #include "dc.h"
 #include "dc_dmub_srv.h"
index 111b932cf2a9b514cdae82c8ead793d6a937453d..f783d4963d4be23901e27ddc9afecbd6ee4dbb0e 100644 (file)
@@ -25,7 +25,7 @@
 
 #define DEBUG /* for pr_debug() */
 
-#include <stdarg.h>
+#include <linux/stdarg.h>
 
 #include <linux/io.h>
 #include <linux/moduleparam.h>
index f26bf3c66d7eb7ccc009b4e6e9005261407f07ff..d7ae42edc4a853993f555173602e3ac091187ec6 100644 (file)
@@ -379,7 +379,7 @@ static char *pnames[] =
        /*2f */ "Useruserdata"
 };
 
-#include <stdarg.h>
+#include <linux/stdarg.h>
 
 /*-------------------------------------------------------*/
 static _cdebbuf *bufprint(_cdebbuf *cdb, char *fmt, ...)
index 3581abfb0c6a1afedac163ffa8cd98bed3536bff..cd267392289cfa6c632356e5e02928d248e88280 100644 (file)
@@ -9,7 +9,7 @@
  *
  * Copyright (C) 1996 Paul Mackerras.
  */
-#include <stdarg.h>
+#include <linux/stdarg.h>
 #include <linux/types.h>
 #include <linux/errno.h>
 #include <linux/kernel.h>
index 4bdd4c45e7a72484ab5f4ce4213729754c77f57c..4b98bc26a94b564a116952536642f97ea7ca69eb 100644 (file)
@@ -18,7 +18,7 @@
  *    a sleep or a freq. switch
  *
  */
-#include <stdarg.h>
+#include <linux/stdarg.h>
 #include <linux/mutex.h>
 #include <linux/types.h>
 #include <linux/errno.h>
index 540b405cc0f7625d532e532883143449a6ea155a..a3c7f3de6d173409df0e4a6b07baeeea2955005a 100644 (file)
@@ -16,7 +16,7 @@
 #ifndef __PRINT_SUPPORT_H_INCLUDED__
 #define __PRINT_SUPPORT_H_INCLUDED__
 
-#include <stdarg.h>
+#include <linux/stdarg.h>
 
 extern int (*sh_css_printf)(const char *fmt, va_list args);
 /* depends on host supplied print function in ia_css_init() */
index 6b38723b27cd926976a804e75c7bd436cbf9edab..3b89bbd837a0d39a90f771f4483a0bfa3a71d6b7 100644 (file)
@@ -17,7 +17,7 @@
 #define __IA_CSS_ENV_H
 
 #include <type_support.h>
-#include <stdarg.h> /* va_list */
+#include <linux/stdarg.h> /* va_list */
 #include "ia_css_types.h"
 #include "ia_css_acc_types.h"
 
index 5e6e7447ae0026c98192a152ecff1e91385dc8ad..e37ef4232c558fcb5fb64e0a993d0be4409d6c5e 100644 (file)
@@ -19,7 +19,7 @@
 /*! \file */
 
 #include <type_support.h>
-#include <stdarg.h>
+#include <linux/stdarg.h>
 #include "ia_css_types.h"
 #include "ia_css_binary.h"
 #include "ia_css_frame_public.h"
index 3c669ec79b682fb19349a61e10f34340e8bdeed1..496faa7297a5a896be8ba8d3e7c14bd5b728468c 100644 (file)
@@ -20,7 +20,7 @@
 #include <math_support.h>
 #include <type_support.h>
 #include <platform_support.h>
-#include <stdarg.h>
+#include <linux/stdarg.h>
 
 #if !defined(ISP2401)
 #include "input_formatter.h"
index eb7bd6c692c793e3c97913a85137d4cd32380ba1..02fa66fb82c22349facacff09986d69af11b4b85 100644 (file)
@@ -14,7 +14,7 @@
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 #ifdef __KERNEL__
 
-#include <stdarg.h>
+#include <linux/stdarg.h>
 #include <linux/string.h>
 #include <linux/spinlock.h>
 #include <linux/kernel.h>
index 500f2000eb41acb6e34cd91556d33528644be89c..30319dc33c189616e83686e9bb6fbb1c818d0073 100644 (file)
@@ -8,7 +8,7 @@
 #include <linux/string.h>
 #include <linux/buffer_head.h>
 
-#include <stdarg.h>
+#include <linux/stdarg.h>
 
 static char error_buf[1024];
 static char fmt_buf[1024];
index 74028b5a7b0ae3f984f11d67d9e2d273e47a7109..00a01471ea0596eaa3bacece5c6ea10fb2d65cc5 100644 (file)
@@ -70,7 +70,7 @@
 #include <linux/module.h>
 #include <linux/bitops.h>
 
-#include <stdarg.h>
+#include <linux/stdarg.h>
 
 #include <linux/uaccess.h>
 
index f6656be81760e17ceba1a1189abb0a67ddcc18f4..fb172a03a7537e02495e1ab8c644c7a92f2a7b33 100644 (file)
@@ -22,7 +22,7 @@ typedef __builtin_va_list va_list;
 #define va_arg(v, l)            __builtin_va_arg(v, l)
 #define va_copy(d, s)           __builtin_va_copy(d, s)
 #else
-#include <stdarg.h>
+#include <linux/stdarg.h>
 #endif
 #endif
 
index 1b2f0a7e00d688b875ec94d8e93bf9206e697a86..2776423a587e4a1a999f26bd41b586f818ac15d5 100644 (file)
@@ -2,7 +2,7 @@
 #ifndef _LINUX_KERNEL_H
 #define _LINUX_KERNEL_H
 
-#include <stdarg.h>
+#include <linux/stdarg.h>
 #include <linux/align.h>
 #include <linux/limits.h>
 #include <linux/linkage.h>
index e834d78f047884bab2bec5fd0fbc5d75ace977dc..9f3f29ea348ee0337f36d02adb9e88e1e7768714 100644 (file)
@@ -2,7 +2,7 @@
 #ifndef __KERNEL_PRINTK__
 #define __KERNEL_PRINTK__
 
-#include <stdarg.h>
+#include <linux/stdarg.h>
 #include <linux/init.h>
 #include <linux/kern_levels.h>
 #include <linux/linkage.h>
diff --git a/include/linux/stdarg.h b/include/linux/stdarg.h
new file mode 100644 (file)
index 0000000..c8dc7f4
--- /dev/null
@@ -0,0 +1,11 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+#ifndef _LINUX_STDARG_H
+#define _LINUX_STDARG_H
+
+typedef __builtin_va_list va_list;
+#define va_start(v, l) __builtin_va_start(v, l)
+#define va_end(v)      __builtin_va_end(v)
+#define va_arg(v, T)   __builtin_va_arg(v, T)
+#define va_copy(d, s)  __builtin_va_copy(d, s)
+
+#endif
index b48d2d28e0b1148ada1c6359c8ff6e7f3dfa1b9f..5e96d656be7ae0430af7785dc479d0e9f767d77a 100644 (file)
@@ -6,7 +6,7 @@
 #include <linux/types.h>       /* for size_t */
 #include <linux/stddef.h>      /* for NULL */
 #include <linux/errno.h>       /* for E2BIG */
-#include <stdarg.h>
+#include <linux/stdarg.h>
 #include <uapi/linux/string.h>
 
 extern char *strndup_user(const char __user *, long);
index 36daf753293c33777265f6e0bddfecd5a052de34..cc4723c74af5079dc4d4e865ae441017a73bebf3 100644 (file)
@@ -5,8 +5,6 @@
  * CONFIG_DEBUG_INFO_REDUCED. Please do not add actual code. However,
  * adding appropriate #includes is fine.
  */
-#include <stdarg.h>
-
 #include <linux/cred.h>
 #include <linux/crypto.h>
 #include <linux/dcache.h>
@@ -22,6 +20,7 @@
 #include <linux/net.h>
 #include <linux/sched.h>
 #include <linux/slab.h>
+#include <linux/stdarg.h>
 #include <linux/types.h>
 #include <net/addrconf.h>
 #include <net/sock.h>
index bacf7b83ccf0ee6bdc14902bfd400a72b265b5cd..cd2f5974ed987d57d0d2b388b83edb31ea6ec83e 100644 (file)
@@ -5,7 +5,7 @@
  *  Copyright (C) 1991, 1992  Linus Torvalds
  */
 
-#include <stdarg.h>
+#include <linux/stdarg.h>
 #include <linux/export.h>
 #include <linux/slab.h>
 #include <linux/types.h>
index 5e94b623454fe780df070845b0c5f69159621d6b..43f9508a55b40f883280ddf0bf63109a86ed236e 100644 (file)
@@ -11,7 +11,7 @@
 
 #include <linux/spinlock.h>
 #include <linux/types.h>
-#include <stdarg.h>
+#include <linux/stdarg.h>
 
 struct string_stream_fragment {
        struct kunit *test;
index 26c83943748a4beec62bb7f06cec902aa12fba8f..3bcb7be03f93fdb242233d7bdc65e5df40b8229b 100644 (file)
@@ -17,7 +17,7 @@
  * - scnprintf and vscnprintf
  */
 
-#include <stdarg.h>
+#include <linux/stdarg.h>
 #include <linux/build_bug.h>
 #include <linux/clk.h>
 #include <linux/clk-provider.h>
index 2a319c21c939a2c0a0ede5dc94d6e9ebdc4cac99..4b891dd75650966f03582dbef3304923f0eccf74 100644 (file)
@@ -5,7 +5,7 @@
  * Copyright (C) 2020, Google LLC.
  */
 
-#include <stdarg.h>
+#include <linux/stdarg.h>
 
 #include <linux/kernel.h>
 #include <linux/lockdep.h>
index f0e5d14296621d7d4d81b18ac7497ab85b5d73c0..7a93a1e94c40eb4e26c9ed3c6c4068d97830aa05 100644 (file)
@@ -7,7 +7,7 @@
 #include "log.h"
 #include "main.h"
 
-#include <stdarg.h>
+#include <linux/stdarg.h>
 
 #include "trace.h"