{"id":814472,"url":"http://patchwork.ozlabs.org/api/1.2/patches/814472/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/patch/1505538646-19191-2-git-send-email-yamada.masahiro@socionext.com/","project":{"id":18,"url":"http://patchwork.ozlabs.org/api/1.2/projects/18/?format=json","name":"U-Boot","link_name":"uboot","list_id":"u-boot.lists.denx.de","list_email":"u-boot@lists.denx.de","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<1505538646-19191-2-git-send-email-yamada.masahiro@socionext.com>","list_archive_url":null,"date":"2017-09-16T05:10:39","name":"[U-Boot,v2,1/8] stdio.h: move printf() stuff from <common.h> to <stdio.h>","commit_ref":"7fea7b1a37ad2b1c1e92bd87f7c6a1877d70e579","pull_url":null,"state":"accepted","archived":false,"hash":"b17388b8cb4e236236a538e3824db98329193ca2","submitter":{"id":65882,"url":"http://patchwork.ozlabs.org/api/1.2/people/65882/?format=json","name":"Masahiro Yamada","email":"yamada.masahiro@socionext.com"},"delegate":{"id":3651,"url":"http://patchwork.ozlabs.org/api/1.2/users/3651/?format=json","username":"trini","first_name":"Tom","last_name":"Rini","email":"trini@ti.com"},"mbox":"http://patchwork.ozlabs.org/project/uboot/patch/1505538646-19191-2-git-send-email-yamada.masahiro@socionext.com/mbox/","series":[{"id":3418,"url":"http://patchwork.ozlabs.org/api/1.2/series/3418/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/list/?series=3418","date":"2017-09-16T05:10:45","name":"Sync and consolidate Linux-derived printk, BUILD_BUG, BUG, WARN, etc.","version":2,"mbox":"http://patchwork.ozlabs.org/series/3418/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/814472/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/814472/checks/","tags":{},"related":[],"headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=nifty.com header.i=@nifty.com\n\theader.b=\"VTbcDm97\"; dkim-atps=neutral"],"Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xvL6Z0RwKz9sRV\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 16 Sep 2017 15:14:30 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid C8134C2202D; Sat, 16 Sep 2017 05:12:11 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 1FC9FC21FAB;\n\tSat, 16 Sep 2017 05:11:22 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid A9682C21C41; Sat, 16 Sep 2017 05:11:18 +0000 (UTC)","from conuserg-09.nifty.com (conuserg-09.nifty.com [210.131.2.76])\n\tby lists.denx.de (Postfix) with ESMTPS id B1285C21C41\n\tfor <u-boot@lists.denx.de>; Sat, 16 Sep 2017 05:11:16 +0000 (UTC)","from grover.sesame (FL1-122-131-185-176.osk.mesh.ad.jp\n\t[122.131.185.176]) (authenticated)\n\tby conuserg-09.nifty.com with ESMTP id v8G5Asol028761;\n\tSat, 16 Sep 2017 14:10:56 +0900"],"X-Spam-Checker-Version":"SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=0.0 required=5.0 tests=T_DKIM_INVALID\n\tautolearn=unavailable autolearn_force=no version=3.4.0","DKIM-Filter":"OpenDKIM Filter v2.10.3 conuserg-09.nifty.com v8G5Asol028761","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com;\n\ts=dec2015msa; t=1505538656;\n\tbh=NAljXx8AcMwU5sS5IUYklvz41UUUv7VYi0m5AmnP74k=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=VTbcDm97Uw/SoW9eWaCk0US6RQbubGq5JyJj0hxP4FYCJiZG8bkUDN8ZvNZIiCWmI\n\tNo85BgKvHCZ+gZ9f3ml06JUaSmlRGH0qTBXLOfDrt0vLI8FndBKqRWL9ncOi1muCwv\n\tth5fZKgaN4qoEmrNn+iEVwQL53D5YWomWb1m6F/YM6aZNmwDyJ0lLbHUC+0m1QdXMd\n\taa/Ayc+BjjQvYpL1+YsXdDwTSMyTF3qAwC6f7JFFJDDNEYB9z9v2ZyfnoV82kR3cR5\n\t2An9UzOSGzJZgyyeQkHnYhYLOyUzXEhdFnPKqE2lZIdXPR2UhS34NbCJ3GJA/2exIa\n\tB6kjbRf64BEsA==","X-Nifty-SrcIP":"[122.131.185.176]","From":"Masahiro Yamada <yamada.masahiro@socionext.com>","To":"u-boot@lists.denx.de","Date":"Sat, 16 Sep 2017 14:10:39 +0900","Message-Id":"<1505538646-19191-2-git-send-email-yamada.masahiro@socionext.com>","X-Mailer":"git-send-email 2.7.4","In-Reply-To":"<1505538646-19191-1-git-send-email-yamada.masahiro@socionext.com>","References":"<1505538646-19191-1-git-send-email-yamada.masahiro@socionext.com>","Subject":"[U-Boot] [PATCH v2 1/8] stdio.h: move printf() stuff from\n\t<common.h> to <stdio.h>","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.18","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<http://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>"},"content":"<common.h> pulls in a lot of headers.  Including it from every .c\nfile is a bad idea.  We need to remove contents until it contains\nnothing.\n\nMove printf() and friends to <stdio.h>.\n\nSigned-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>\n---\n\nChanges in v2:\n  - newly added\n\n include/common.h | 41 +--------------------------------------\n include/stdio.h  | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 60 insertions(+), 40 deletions(-)\n create mode 100644 include/stdio.h","diff":"diff --git a/include/common.h b/include/common.h\nindex aaed13167123..5e841947c17f 100644\n--- a/include/common.h\n+++ b/include/common.h\n@@ -29,6 +29,7 @@ typedef volatile unsigned char\tvu_char;\n #include <linux/stringify.h>\n #include <asm/ptrace.h>\n #include <stdarg.h>\n+#include <stdio.h>\n #include <linux/kernel.h>\n \n #include <part.h>\n@@ -699,46 +700,6 @@ unsigned int rand_r(unsigned int *seedp);\n /* serial stuff */\n int\tserial_printf (const char *fmt, ...)\n \t\t__attribute__ ((format (__printf__, 1, 2)));\n-/* stdin */\n-int\tgetc(void);\n-int\ttstc(void);\n-\n-/* stdout */\n-#if !defined(CONFIG_SPL_BUILD) || \\\n-\t(defined(CONFIG_TPL_BUILD) && defined(CONFIG_TPL_SERIAL_SUPPORT)) || \\\n-\t(defined(CONFIG_SPL_BUILD) && !defined(CONFIG_TPL_BUILD) && \\\n-\t\tdefined(CONFIG_SPL_SERIAL_SUPPORT))\n-void\tputc(const char c);\n-void\tputs(const char *s);\n-int\tprintf(const char *fmt, ...)\n-\t\t__attribute__ ((format (__printf__, 1, 2)));\n-int\tvprintf(const char *fmt, va_list args);\n-#else\n-#define\tputc(...) do { } while (0)\n-#define puts(...) do { } while (0)\n-#define printf(...) do { } while (0)\n-#define vprintf(...) do { } while (0)\n-#endif\n-\n-/* stderr */\n-#define eputc(c)\t\tfputc(stderr, c)\n-#define eputs(s)\t\tfputs(stderr, s)\n-#define eprintf(fmt,args...)\tfprintf(stderr,fmt ,##args)\n-\n-/*\n- * FILE based functions (can only be used AFTER relocation!)\n- */\n-#define stdin\t\t0\n-#define stdout\t\t1\n-#define stderr\t\t2\n-#define MAX_FILES\t3\n-\n-int\tfprintf(int file, const char *fmt, ...)\n-\t\t__attribute__ ((format (__printf__, 2, 3)));\n-void\tfputs(int file, const char *s);\n-void\tfputc(int file, const char c);\n-int\tftstc(int file);\n-int\tfgetc(int file);\n \n /* lib/gzip.c */\n int gzip(void *dst, unsigned long *lenp,\ndiff --git a/include/stdio.h b/include/stdio.h\nnew file mode 100644\nindex 000000000000..aedf3744525e\n--- /dev/null\n+++ b/include/stdio.h\n@@ -0,0 +1,59 @@\n+#ifndef __STDIO_H\n+#define __STDIO_H\n+\n+#include <stdarg.h>\n+#include <linux/compiler.h>\n+\n+/* stdin */\n+int getc(void);\n+int tstc(void);\n+\n+/* stdout */\n+#if !defined(CONFIG_SPL_BUILD) || \\\n+\t(defined(CONFIG_TPL_BUILD) && defined(CONFIG_TPL_SERIAL_SUPPORT)) || \\\n+\t(defined(CONFIG_SPL_BUILD) && !defined(CONFIG_TPL_BUILD) && \\\n+\t\tdefined(CONFIG_SPL_SERIAL_SUPPORT))\n+void putc(const char c);\n+void puts(const char *s);\n+int __printf(1, 2) printf(const char *fmt, ...);\n+int vprintf(const char *fmt, va_list args);\n+#else\n+static inline void putc(const char c)\n+{\n+}\n+\n+static inline void puts(const char *s)\n+{\n+}\n+\n+static inline int __printf(1, 2) printf(const char *fmt, ...)\n+{\n+\treturn 0;\n+}\n+\n+static inline int vprintf(const char *fmt, va_list args)\n+{\n+\treturn 0;\n+}\n+#endif\n+\n+/*\n+ * FILE based functions (can only be used AFTER relocation!)\n+ */\n+#define stdin\t\t0\n+#define stdout\t\t1\n+#define stderr\t\t2\n+#define MAX_FILES\t3\n+\n+/* stderr */\n+#define eputc(c)\t\tfputc(stderr, c)\n+#define eputs(s)\t\tfputs(stderr, s)\n+#define eprintf(fmt, args...)\tfprintf(stderr, fmt, ##args)\n+\n+int __printf(2, 3) fprintf(int file, const char *fmt, ...);\n+void fputs(int file, const char *s);\n+void fputc(int file, const char c);\n+int ftstc(int file);\n+int fgetc(int file);\n+\n+#endif /* __STDIO_H */\n","prefixes":["U-Boot","v2","1/8"]}