From patchwork Mon Aug 6 11:47:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 953839 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=socionext.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=nifty.com header.i=@nifty.com header.b="vHkm2xed"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 41kbYK68cmz9s0R for ; Mon, 6 Aug 2018 21:49:57 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 8FFB8C21E02; Mon, 6 Aug 2018 11:49:54 +0000 (UTC) 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 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 4792FC21D8A; Mon, 6 Aug 2018 11:48:49 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id BBD13C21C57; Mon, 6 Aug 2018 11:48:47 +0000 (UTC) Received: from conuserg-08.nifty.com (conuserg-08.nifty.com [210.131.2.75]) by lists.denx.de (Postfix) with ESMTPS id 6CC3FC21C2F for ; Mon, 6 Aug 2018 11:48:45 +0000 (UTC) Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id w76BllPS032023; Mon, 6 Aug 2018 20:47:48 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com w76BllPS032023 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1533556068; bh=6Lh3/iZlXbGd87vfZuFTNcsfukfG0z6w01SI/cUEiL0=; h=From:To:Cc:Subject:Date:From; b=vHkm2xed3cIWQRDZ3kj/NcVT0cl7uFoQ/y6f8yIFYqt6i/M4X9Do1DeGQiHjjhZEb AqB2/sV04eYjW8/2GSu0ZnkH/Mpa29lDJkbJzyDMNPLgk0Y9RR5E3BQcIiL7GabNEw CVIR8hht6NVFPCuKlG9UcOhqfajJNlwyUTvblRKzzDCQdzseGMSma5muYuaIzCCSAN Mg0kCdO6DzV+5RllBr5Ea7MjZAEv81up1FBrm/du8rMQWCxoxX5Y4MJ/WwzHm/nZaO 40midadbzgdUQ1e9YxpJY8EgUyiVOBPi+d/mTQovPztp4R6wOBr9mezVFRHi6KDGZV uF9w59wancWfg== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: u-boot@lists.denx.de Date: Mon, 6 Aug 2018 20:47:38 +0900 Message-Id: <1533556060-26284-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 Cc: Tom Rini Subject: [U-Boot] [PATCH 1/3] Remove CONFIG_USE_STDINT X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" You do not need to use the typedefs provided by compiler. Our compilers are either IPL32 or LP64. Hence, U-Boot can/should always use int-ll64.h typedefs like Linux kernel, whatever the typedefs the compiler internally uses. Signed-off-by: Masahiro Yamada --- README | 5 ----- arch/sandbox/include/asm/types.h | 5 ----- arch/x86/include/asm/types.h | 5 ----- config.mk | 5 ----- include/compiler.h | 5 ----- include/inttypes.h | 10 ---------- include/linux/types.h | 9 +-------- scripts/config_whitelist.txt | 1 - test/stdint/test-includes.sh | 2 -- tools/buildman/func_test.py | 2 +- 10 files changed, 2 insertions(+), 47 deletions(-) diff --git a/README b/README index aee0f73..58594f3 100644 --- a/README +++ b/README @@ -3018,11 +3018,6 @@ Configuration Settings: If defined, don't allow the -f switch to env set override variable access flags. -- CONFIG_USE_STDINT - If stdint.h is available with your toolchain you can define this - option to enable it. You can provide option 'USE_STDINT=1' when - building U-Boot to enable this. - The following definitions that deal with the placement and management of environment data (variable area); in general, we support the following configurations: diff --git a/arch/sandbox/include/asm/types.h b/arch/sandbox/include/asm/types.h index a10b455..79c85aa 100644 --- a/arch/sandbox/include/asm/types.h +++ b/arch/sandbox/include/asm/types.h @@ -41,13 +41,8 @@ typedef unsigned short u16; typedef signed int s32; typedef unsigned int u32; -#if !defined(CONFIG_USE_STDINT) || !defined(__INT64_TYPE__) typedef signed long long s64; typedef unsigned long long u64; -#else -typedef __INT64_TYPE__ s64; -typedef __UINT64_TYPE__ u64; -#endif /* * Number of bits in a C 'long' on this architecture. diff --git a/arch/x86/include/asm/types.h b/arch/x86/include/asm/types.h index a47e581..7649c2b 100644 --- a/arch/x86/include/asm/types.h +++ b/arch/x86/include/asm/types.h @@ -36,13 +36,8 @@ typedef unsigned short u16; typedef signed int s32; typedef unsigned int u32; -#if !defined(CONFIG_USE_STDINT) || !defined(__INT64_TYPE__) typedef signed long long s64; typedef unsigned long long u64; -#else -typedef __INT64_TYPE__ s64; -typedef __UINT64_TYPE__ u64; -#endif #if CONFIG_IS_ENABLED(X86_64) #define BITS_PER_LONG 64 diff --git a/config.mk b/config.mk index 78748cc..b4e4618 100644 --- a/config.mk +++ b/config.mk @@ -62,11 +62,6 @@ ifdef FTRACE PLATFORM_CPPFLAGS += -finstrument-functions -DFTRACE endif -# Allow use of stdint.h if available -ifneq ($(USE_STDINT),) -PLATFORM_CPPFLAGS += -DCONFIG_USE_STDINT -endif - ######################################################################### RELFLAGS := $(PLATFORM_RELFLAGS) diff --git a/include/compiler.h b/include/compiler.h index 957f4b5..29507f9 100644 --- a/include/compiler.h +++ b/include/compiler.h @@ -120,13 +120,8 @@ typedef unsigned int uint; #else /* !USE_HOSTCC */ -#ifdef CONFIG_USE_STDINT -/* Provided by gcc. */ -#include -#else /* Type for `void *' pointers. */ typedef unsigned long int uintptr_t; -#endif #include #include diff --git a/include/inttypes.h b/include/inttypes.h index ea731ec..b86ad04 100644 --- a/include/inttypes.h +++ b/include/inttypes.h @@ -34,19 +34,9 @@ typedef wchar_t __gwchar_t; defined if explicitly requested. */ #if !defined __cplusplus || defined __STDC_FORMAT_MACROS -#ifdef CONFIG_USE_STDINT -# if __WORDSIZE == 64 -# define __PRI64_PREFIX "l" -# define __PRIPTR_PREFIX "l" -# else -# define __PRI64_PREFIX "ll" -# define __PRIPTR_PREFIX -# endif -#else /* linux/types.h always uses long long for 64-bit and long for uintptr_t */ # define __PRI64_PREFIX "ll" # define __PRIPTR_PREFIX "l" -#endif /* Macros for printing format specifiers. */ diff --git a/include/linux/types.h b/include/linux/types.h index 7c33e7a..1f3cd63 100644 --- a/include/linux/types.h +++ b/include/linux/types.h @@ -106,8 +106,7 @@ typedef __u8 uint8_t; typedef __u16 uint16_t; typedef __u32 uint32_t; -#if defined(__GNUC__) && !defined(__STRICT_ANSI__) && \ - (!defined(CONFIG_USE_STDINT) || !defined(__INT64_TYPE__)) +#if defined(__GNUC__) && !defined(__STRICT_ANSI__) typedef __u64 uint64_t; typedef __u64 u_int64_t; typedef __s64 int64_t; @@ -120,12 +119,6 @@ typedef __s64 int64_t; #define aligned_be64 __be64 __aligned(8) #define aligned_le64 __le64 __aligned(8) -#if defined(CONFIG_USE_STDINT) && defined(__INT64_TYPE__) -typedef __UINT64_TYPE__ uint64_t; -typedef __UINT64_TYPE__ u_int64_t; -typedef __INT64_TYPE__ int64_t; -#endif - #ifdef __KERNEL__ typedef phys_addr_t resource_size_t; #endif diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt index 0d60da3..fe3a772 100644 --- a/scripts/config_whitelist.txt +++ b/scripts/config_whitelist.txt @@ -4674,7 +4674,6 @@ CONFIG_USE_INTERRUPT CONFIG_USE_NOR CONFIG_USE_ONENAND_BOARD_INIT CONFIG_USE_SPIFLASH -CONFIG_USE_STDINT CONFIG_UTBIPAR_INIT_TBIPA CONFIG_U_BOOT_HDR_ADDR CONFIG_U_BOOT_HDR_SIZE diff --git a/test/stdint/test-includes.sh b/test/stdint/test-includes.sh index 077bdc7..1db8515 100755 --- a/test/stdint/test-includes.sh +++ b/test/stdint/test-includes.sh @@ -46,10 +46,8 @@ try_test() { $cmd } -# Run a test with and without CONFIG_USE_STDINT try_both() { try_test $@ - try_test $@ -DCONFIG_USE_STDINT } # board arch soc path-to-gcc diff --git a/tools/buildman/func_test.py b/tools/buildman/func_test.py index 363db9d..119d02c 100644 --- a/tools/buildman/func_test.py +++ b/tools/buildman/func_test.py @@ -27,7 +27,7 @@ settings_data = ''' [make-flags] src=/home/sjg/c/src chroot=/home/sjg/c/chroot -vboot=USE_STDINT=1 VBOOT_DEBUG=1 MAKEFLAGS_VBOOT=DEBUG=1 CFLAGS_EXTRA_VBOOT=-DUNROLL_LOOPS VBOOT_SOURCE=${src}/platform/vboot_reference +vboot=VBOOT_DEBUG=1 MAKEFLAGS_VBOOT=DEBUG=1 CFLAGS_EXTRA_VBOOT=-DUNROLL_LOOPS VBOOT_SOURCE=${src}/platform/vboot_reference chromeos_coreboot=VBOOT=${chroot}/build/link/usr ${vboot} chromeos_daisy=VBOOT=${chroot}/build/daisy/usr ${vboot} chromeos_peach=VBOOT=${chroot}/build/peach_pit/usr ${vboot} From patchwork Mon Aug 6 11:47:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 953845 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=socionext.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=nifty.com header.i=@nifty.com header.b="2j8Aophe"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 41kbw14VjFz9s4c for ; Mon, 6 Aug 2018 22:06:09 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id B9B6AC21DF9; Mon, 6 Aug 2018 12:06:07 +0000 (UTC) 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=KHOP_BIG_TO_CC, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id A75B8C21C8B; Mon, 6 Aug 2018 12:06:01 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 1BC2DC21E0F; Mon, 6 Aug 2018 11:49:10 +0000 (UTC) Received: from conuserg-08.nifty.com (conuserg-08.nifty.com [210.131.2.75]) by lists.denx.de (Postfix) with ESMTPS id A76F8C21C2F for ; Mon, 6 Aug 2018 11:48:58 +0000 (UTC) Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id w76BllPT032023; Mon, 6 Aug 2018 20:47:49 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com w76BllPT032023 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1533556070; bh=5hvK7XStbsc7BUBaoAKgIP6MK1UPkx9UVyeoJGPeWTs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2j8Aophe0ATs29nSeUxnFWwrekSuqcMc3wTY+3hcf1pH8bQozoc1yQ72X3PYwP+Xh 0jyhcs6jM3kmJz1+bYbgtRmP3LXLDkjlug0emqx5l/K339u+4hZr0YSB/clBdVxvaC 1IvuVRoKFquopoWhp5PyFR3pyut5l6lIr8it0F6lALyxsB1A5OaJGI1UKDYii7X+H8 PiKSi5PN8AYTzZPNr20ce88n36L/D+2/nYfL8v7cSJnTGWan4c/AIqBbw+OfH4zldS +kIhQAr4U3MJ2tDqJV4AfzOyKOSiQNHerzkBRMrMZ1p533MsEa9V2N7fMSRsJy9E/V dSYvdrUTWvYbQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: u-boot@lists.denx.de Date: Mon, 6 Aug 2018 20:47:39 +0900 Message-Id: <1533556060-26284-2-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1533556060-26284-1-git-send-email-yamada.masahiro@socionext.com> References: <1533556060-26284-1-git-send-email-yamada.masahiro@socionext.com> X-Mailman-Approved-At: Mon, 06 Aug 2018 12:06:00 +0000 Cc: Alexey Brodkin , uboot-snps-arc@synopsys.com, Andy Fleming , Stefan Roese , Marek Vasut , Tom Rini , Angelo Dureghello , Macpaul Lin , Eugeniy Paltsev , Scott McNutt , Huan Wang Subject: [U-Boot] [PATCH 2/3] arch: types.h: factor out fixed width typedefs to int-ll64.h X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" All architectures have the same definition for s8/16/32/64 and u8/16/32/64. Factor out the duplicated code into . BTW, Linux unified the kernel space definition into int-ll64.h a few years ago as you see in Linux commit 0c79a8e29b5f ("asm/types.h: Remove include/asm-generic/int-l64.h"). Signed-off-by: Masahiro Yamada --- arch/arc/include/asm/types.h | 36 ++-------------------------- arch/arm/include/asm/types.h | 33 ++------------------------ arch/m68k/include/asm/types.h | 30 ++--------------------- arch/microblaze/include/asm/types.h | 33 ++------------------------ arch/mips/include/asm/types.h | 36 ++-------------------------- arch/nds32/include/asm/types.h | 33 ++------------------------ arch/powerpc/include/asm/types.h | 30 ++--------------------- arch/riscv/include/asm/types.h | 33 ++------------------------ arch/sandbox/include/asm/types.h | 33 ++------------------------ arch/sh/include/asm/types.h | 34 ++------------------------- arch/x86/include/asm/types.h | 33 ++------------------------ arch/xtensa/include/asm/types.h | 33 ++------------------------ include/asm-generic/int-ll64.h | 47 +++++++++++++++++++++++++++++++++++++ include/asm-generic/types.h | 9 +++++++ 14 files changed, 80 insertions(+), 373 deletions(-) create mode 100644 include/asm-generic/int-ll64.h create mode 100644 include/asm-generic/types.h diff --git a/arch/arc/include/asm/types.h b/arch/arc/include/asm/types.h index 3e37781..f31dcdf 100644 --- a/arch/arc/include/asm/types.h +++ b/arch/arc/include/asm/types.h @@ -6,41 +6,9 @@ #ifndef __ASM_ARC_TYPES_H #define __ASM_ARC_TYPES_H -typedef unsigned short umode_t; - -/* - * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the - * header files exported to user space - */ - -typedef __signed__ char __s8; -typedef unsigned char __u8; - -typedef __signed__ short __s16; -typedef unsigned short __u16; - -typedef __signed__ int __s32; -typedef unsigned int __u32; +#include -#if defined(__GNUC__) && !defined(__STRICT_ANSI__) -typedef __signed__ long long __s64; -typedef unsigned long long __u64; -#endif - -/* - * These aren't exported outside the kernel to avoid name space clashes - */ -typedef signed char s8; -typedef unsigned char u8; - -typedef signed short s16; -typedef unsigned short u16; - -typedef signed int s32; -typedef unsigned int u32; - -typedef signed long long s64; -typedef unsigned long long u64; +typedef unsigned short umode_t; #define BITS_PER_LONG 32 diff --git a/arch/arm/include/asm/types.h b/arch/arm/include/asm/types.h index 9af7353..900b261 100644 --- a/arch/arm/include/asm/types.h +++ b/arch/arm/include/asm/types.h @@ -1,44 +1,15 @@ #ifndef __ASM_ARM_TYPES_H #define __ASM_ARM_TYPES_H -typedef unsigned short umode_t; - -/* - * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the - * header files exported to user space - */ - -typedef __signed__ char __s8; -typedef unsigned char __u8; - -typedef __signed__ short __s16; -typedef unsigned short __u16; - -typedef __signed__ int __s32; -typedef unsigned int __u32; +#include -#if defined(__GNUC__) -__extension__ typedef __signed__ long long __s64; -__extension__ typedef unsigned long long __u64; -#endif +typedef unsigned short umode_t; /* * These aren't exported outside the kernel to avoid name space clashes */ #ifdef __KERNEL__ -typedef signed char s8; -typedef unsigned char u8; - -typedef signed short s16; -typedef unsigned short u16; - -typedef signed int s32; -typedef unsigned int u32; - -typedef signed long long s64; -typedef unsigned long long u64; - #ifdef CONFIG_ARM64 #define BITS_PER_LONG 64 #else /* CONFIG_ARM64 */ diff --git a/arch/m68k/include/asm/types.h b/arch/m68k/include/asm/types.h index 3ffcab2..5d39b97 100644 --- a/arch/m68k/include/asm/types.h +++ b/arch/m68k/include/asm/types.h @@ -1,43 +1,17 @@ #ifndef _M68K_TYPES_H #define _M68K_TYPES_H +#include + #ifndef __ASSEMBLY__ typedef unsigned short umode_t; -typedef __signed__ char __s8; -typedef unsigned char __u8; - -typedef __signed__ short __s16; -typedef unsigned short __u16; - -typedef __signed__ int __s32; -typedef unsigned int __u32; - -#if defined(__GNUC__) -__extension__ typedef __signed__ long long __s64; -__extension__ typedef unsigned long long __u64; -#endif - typedef struct { __u32 u[4]; } __attribute__((aligned(16))) vector128; #ifdef __KERNEL__ -/* - * These aren't exported outside the kernel to avoid name space clashes - */ -typedef signed char s8; -typedef unsigned char u8; - -typedef signed short s16; -typedef unsigned short u16; - -typedef signed int s32; -typedef unsigned int u32; - -typedef signed long long s64; -typedef unsigned long long u64; #define BITS_PER_LONG 32 diff --git a/arch/microblaze/include/asm/types.h b/arch/microblaze/include/asm/types.h index 77094f6..056a313 100644 --- a/arch/microblaze/include/asm/types.h +++ b/arch/microblaze/include/asm/types.h @@ -1,6 +1,8 @@ #ifndef _ASM_TYPES_H #define _ASM_TYPES_H +#include + /* * This file is never included by application software unless * explicitly requested (e.g., via linux/types.h) in which case the @@ -12,41 +14,10 @@ typedef unsigned short umode_t; /* - * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the - * header files exported to user space - */ - -typedef __signed__ char __s8; -typedef unsigned char __u8; - -typedef __signed__ short __s16; -typedef unsigned short __u16; - -typedef __signed__ int __s32; -typedef unsigned int __u32; - -#if defined(__GNUC__) -__extension__ typedef __signed__ long long __s64; -__extension__ typedef unsigned long long __u64; -#endif - -/* * These aren't exported outside the kernel to avoid name space clashes */ #ifdef __KERNEL__ -typedef signed char s8; -typedef unsigned char u8; - -typedef signed short s16; -typedef unsigned short u16; - -typedef signed int s32; -typedef unsigned int u32; - -typedef signed long long s64; -typedef unsigned long long u64; - #define BITS_PER_LONG 32 /* Dma addresses are 32-bits wide. */ diff --git a/arch/mips/include/asm/types.h b/arch/mips/include/asm/types.h index 7032862..925d7ef 100644 --- a/arch/mips/include/asm/types.h +++ b/arch/mips/include/asm/types.h @@ -6,32 +6,12 @@ #ifndef _ASM_TYPES_H #define _ASM_TYPES_H +#include + #ifndef __ASSEMBLY__ typedef unsigned short umode_t; -/* - * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the - * header files exported to user space - */ - -typedef __signed__ char __s8; -typedef unsigned char __u8; - -typedef __signed__ short __s16; -typedef unsigned short __u16; - -typedef __signed__ int __s32; -typedef unsigned int __u32; - -#if defined(__GNUC__) -__extension__ typedef __signed__ long long __s64; -__extension__ typedef unsigned long long __u64; -#else -typedef __signed__ long long __s64; -typedef unsigned long long __u64; -#endif - #endif /* __ASSEMBLY__ */ /* @@ -43,18 +23,6 @@ typedef unsigned long long __u64; #ifndef __ASSEMBLY__ -typedef __signed char s8; -typedef unsigned char u8; - -typedef __signed short s16; -typedef unsigned short u16; - -typedef __signed int s32; -typedef unsigned int u32; - -typedef __signed__ long long s64; -typedef unsigned long long u64; - #if (defined(CONFIG_HIGHMEM) && defined(CONFIG_64BIT_PHYS_ADDR)) \ || defined(CONFIG_64BIT) typedef u64 dma_addr_t; diff --git a/arch/nds32/include/asm/types.h b/arch/nds32/include/asm/types.h index 2e8924f..d2444da 100644 --- a/arch/nds32/include/asm/types.h +++ b/arch/nds32/include/asm/types.h @@ -11,44 +11,15 @@ #ifndef __ASM_NDS_TYPES_H #define __ASM_NDS_TYPES_H -typedef unsigned short umode_t; - -/* - * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the - * header files exported to user space - */ - -typedef __signed__ char __s8; -typedef unsigned char __u8; - -typedef __signed__ short __s16; -typedef unsigned short __u16; - -typedef __signed__ int __s32; -typedef unsigned int __u32; +#include -#if defined(__GNUC__) && !defined(__STRICT_ANSI__) -typedef __signed__ long long __s64; -typedef unsigned long long __u64; -#endif +typedef unsigned short umode_t; /* * These aren't exported outside the kernel to avoid name space clashes */ #ifdef __KERNEL__ -typedef signed char s8; -typedef unsigned char u8; - -typedef signed short s16; -typedef unsigned short u16; - -typedef signed int s32; -typedef unsigned int u32; - -typedef signed long long s64; -typedef unsigned long long u64; - #define BITS_PER_LONG 32 #include diff --git a/arch/powerpc/include/asm/types.h b/arch/powerpc/include/asm/types.h index b29ce79..cc8d123 100644 --- a/arch/powerpc/include/asm/types.h +++ b/arch/powerpc/include/asm/types.h @@ -1,43 +1,17 @@ #ifndef _PPC_TYPES_H #define _PPC_TYPES_H +#include + #ifndef __ASSEMBLY__ typedef unsigned short umode_t; -typedef __signed__ char __s8; -typedef unsigned char __u8; - -typedef __signed__ short __s16; -typedef unsigned short __u16; - -typedef __signed__ int __s32; -typedef unsigned int __u32; - -#if defined(__GNUC__) -__extension__ typedef __signed__ long long __s64; -__extension__ typedef unsigned long long __u64; -#endif - typedef struct { __u32 u[4]; } __attribute__((aligned(16))) vector128; #ifdef __KERNEL__ -/* - * These aren't exported outside the kernel to avoid name space clashes - */ -typedef signed char s8; -typedef unsigned char u8; - -typedef signed short s16; -typedef unsigned short u16; - -typedef signed int s32; -typedef unsigned int u32; - -typedef signed long long s64; -typedef unsigned long long u64; #define BITS_PER_LONG 32 diff --git a/arch/riscv/include/asm/types.h b/arch/riscv/include/asm/types.h index 9797206..bd86271 100644 --- a/arch/riscv/include/asm/types.h +++ b/arch/riscv/include/asm/types.h @@ -12,44 +12,15 @@ #ifndef __ASM_RISCV_TYPES_H #define __ASM_RISCV_TYPES_H -typedef unsigned short umode_t; - -/* - * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the - * header files exported to user space - */ - -typedef __signed__ char __s8; -typedef unsigned char __u8; - -typedef __signed__ short __s16; -typedef unsigned short __u16; - -typedef __signed__ int __s32; -typedef unsigned int __u32; +#include -#if defined(__GNUC__) && !defined(__STRICT_ANSI__) -typedef __signed__ long long __s64; -typedef unsigned long long __u64; -#endif +typedef unsigned short umode_t; /* * These aren't exported outside the kernel to avoid name space clashes */ #ifdef __KERNEL__ -typedef signed char s8; -typedef unsigned char u8; - -typedef signed short s16; -typedef unsigned short u16; - -typedef signed int s32; -typedef unsigned int u32; - -typedef signed long long s64; -typedef unsigned long long u64; - #define BITS_PER_LONG 32 #include diff --git a/arch/sandbox/include/asm/types.h b/arch/sandbox/include/asm/types.h index 79c85aa..7cd56b4 100644 --- a/arch/sandbox/include/asm/types.h +++ b/arch/sandbox/include/asm/types.h @@ -6,44 +6,15 @@ #ifndef __ASM_SANDBOX_TYPES_H #define __ASM_SANDBOX_TYPES_H -typedef unsigned short umode_t; - -/* - * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the - * header files exported to user space - */ - -typedef __signed__ char __s8; -typedef unsigned char __u8; - -typedef __signed__ short __s16; -typedef unsigned short __u16; - -typedef __signed__ int __s32; -typedef unsigned int __u32; +#include -#if defined(__GNUC__) -__extension__ typedef __signed__ long long __s64; -__extension__ typedef unsigned long long __u64; -#endif +typedef unsigned short umode_t; /* * These aren't exported outside the kernel to avoid name space clashes */ #ifdef __KERNEL__ -typedef signed char s8; -typedef unsigned char u8; - -typedef signed short s16; -typedef unsigned short u16; - -typedef signed int s32; -typedef unsigned int u32; - -typedef signed long long s64; -typedef unsigned long long u64; - /* * Number of bits in a C 'long' on this architecture. */ diff --git a/arch/sh/include/asm/types.h b/arch/sh/include/asm/types.h index aed4a6e..c5ddbbd 100644 --- a/arch/sh/include/asm/types.h +++ b/arch/sh/include/asm/types.h @@ -1,29 +1,12 @@ #ifndef __ASM_SH_TYPES_H #define __ASM_SH_TYPES_H +#include + #ifndef __ASSEMBLY__ typedef unsigned short umode_t; -/* - * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the - * header files exported to user space - */ - -typedef __signed__ char __s8; -typedef unsigned char __u8; - -typedef __signed__ short __s16; -typedef unsigned short __u16; - -typedef __signed__ int __s32; -typedef unsigned int __u32; - -#if defined(__GNUC__) -__extension__ typedef __signed__ long long __s64; -__extension__ typedef unsigned long long __u64; -#endif - #endif /* __ASSEMBLY__ */ /* @@ -35,19 +18,6 @@ __extension__ typedef unsigned long long __u64; #ifndef __ASSEMBLY__ - -typedef __signed__ char s8; -typedef unsigned char u8; - -typedef __signed__ short s16; -typedef unsigned short u16; - -typedef __signed__ int s32; -typedef unsigned int u32; - -typedef __signed__ long long s64; -typedef unsigned long long u64; - /* Dma addresses are 32-bits wide. */ typedef u32 dma_addr_t; diff --git a/arch/x86/include/asm/types.h b/arch/x86/include/asm/types.h index 7649c2b..ba50001 100644 --- a/arch/x86/include/asm/types.h +++ b/arch/x86/include/asm/types.h @@ -1,44 +1,15 @@ #ifndef __ASM_I386_TYPES_H #define __ASM_I386_TYPES_H -typedef unsigned short umode_t; - -/* - * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the - * header files exported to user space - */ - -typedef __signed__ char __s8; -typedef unsigned char __u8; - -typedef __signed__ short __s16; -typedef unsigned short __u16; - -typedef __signed__ int __s32; -typedef unsigned int __u32; +#include -#if defined(__GNUC__) -__extension__ typedef __signed__ long long __s64; -__extension__ typedef unsigned long long __u64; -#endif +typedef unsigned short umode_t; /* * These aren't exported outside the kernel to avoid name space clashes */ #ifdef __KERNEL__ -typedef signed char s8; -typedef unsigned char u8; - -typedef signed short s16; -typedef unsigned short u16; - -typedef signed int s32; -typedef unsigned int u32; - -typedef signed long long s64; -typedef unsigned long long u64; - #if CONFIG_IS_ENABLED(X86_64) #define BITS_PER_LONG 64 #else diff --git a/arch/xtensa/include/asm/types.h b/arch/xtensa/include/asm/types.h index bae1a48..2c5b543 100644 --- a/arch/xtensa/include/asm/types.h +++ b/arch/xtensa/include/asm/types.h @@ -6,44 +6,15 @@ #ifndef _XTENSA_TYPES_H #define _XTENSA_TYPES_H -typedef unsigned short umode_t; - -/* - * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the - * header files exported to user space - */ - -typedef __signed__ char __s8; -typedef unsigned char __u8; - -typedef __signed__ short __s16; -typedef unsigned short __u16; +#include -typedef __signed__ int __s32; -typedef unsigned int __u32; - -#if defined(__GNUC__) && !defined(__STRICT_ANSI__) -typedef __signed__ long long __s64; -typedef unsigned long long __u64; -#endif +typedef unsigned short umode_t; /* * These aren't exported outside the kernel to avoid name space clashes */ #ifdef __KERNEL__ -typedef signed char s8; -typedef unsigned char u8; - -typedef signed short s16; -typedef unsigned short u16; - -typedef signed int s32; -typedef unsigned int u32; - -typedef signed long long s64; -typedef unsigned long long u64; - #define BITS_PER_LONG 32 /* Dma addresses are 32-bits wide */ diff --git a/include/asm-generic/int-ll64.h b/include/asm-generic/int-ll64.h new file mode 100644 index 0000000..7451718 --- /dev/null +++ b/include/asm-generic/int-ll64.h @@ -0,0 +1,47 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * asm-generic/int-ll64.h + * + * Integer declarations for architectures which use "long long" + * for 64-bit types. + */ + +#ifndef _ASM_GENERIC_INT_LL64_H +#define _ASM_GENERIC_INT_LL64_H + +#ifndef __ASSEMBLY__ +/* + * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the + * header files exported to user space + */ + +typedef __signed__ char __s8; +typedef unsigned char __u8; + +typedef __signed__ short __s16; +typedef unsigned short __u16; + +typedef __signed__ int __s32; +typedef unsigned int __u32; + +#ifdef __GNUC__ +__extension__ typedef __signed__ long long __s64; +__extension__ typedef unsigned long long __u64; +#else +typedef __signed__ long long __s64; +typedef unsigned long long __u64; +#endif + +typedef __s8 s8; +typedef __u8 u8; +typedef __s16 s16; +typedef __u16 u16; +typedef __s32 s32; +typedef __u32 u32; +typedef __s64 s64; +typedef __u64 u64; + +#endif /* __ASSEMBLY__ */ + + +#endif /* _ASM_GENERIC_INT_LL64_H */ diff --git a/include/asm-generic/types.h b/include/asm-generic/types.h new file mode 100644 index 0000000..7c076c5 --- /dev/null +++ b/include/asm-generic/types.h @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _ASM_GENERIC_TYPES_H +#define _ASM_GENERIC_TYPES_H +/* + * int-ll64 is used everywhere now. + */ +#include + +#endif /* _ASM_GENERIC_TYPES_H */ From patchwork Mon Aug 6 11:47:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 953838 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=socionext.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=nifty.com header.i=@nifty.com header.b="N+s4gefe"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 41kbXH3dV3z9s4c for ; Mon, 6 Aug 2018 21:49:01 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id F36D9C21DED; Mon, 6 Aug 2018 11:48:58 +0000 (UTC) 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 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id A85DAC21C57; Mon, 6 Aug 2018 11:48:48 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id B95E2C21C8B; Mon, 6 Aug 2018 11:48:46 +0000 (UTC) Received: from conuserg-08.nifty.com (conuserg-08.nifty.com [210.131.2.75]) by lists.denx.de (Postfix) with ESMTPS id 747EBC21C57 for ; Mon, 6 Aug 2018 11:48:45 +0000 (UTC) Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id w76BllPU032023; Mon, 6 Aug 2018 20:47:50 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com w76BllPU032023 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1533556071; bh=0VWCpfh9jnbEwLw9q83ztvCNyB6ODs8+DJcc1UFaPZw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N+s4gefe/Y4Wm/MuNlJYPihBLrcMAJKPcsNR63MeW6WvSLJymVO+e6io6oSBdhiQR u6bqlV1CHhLhZCQcJ3mXjFq6ZzzoVdL/J/5oKtWtlvobPKxx3NDwNrF5xb/300mbtH xrbfExQtEi+zZjebVXjV6lUvJ6zNbMzlBh+3EUdT4egRP1l3kNeXVxcNDL+DHVkah1 Ij0AsYIEaxox/XUSFvoOOQe1uV01pNzRX0d936eMPMqhW/Iwi635+k+3Kj9O0vBI3X hkiHLpqJdMMTwN7nQHWJDeBI7KVyZkfYL+l5gjOBX4Vr6LFma+QiKaOYTypjQq+oJk IZEhqYKR2vB/Q== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: u-boot@lists.denx.de Date: Mon, 6 Aug 2018 20:47:40 +0900 Message-Id: <1533556060-26284-3-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1533556060-26284-1-git-send-email-yamada.masahiro@socionext.com> References: <1533556060-26284-1-git-send-email-yamada.masahiro@socionext.com> Cc: Tom Rini , Alexander Graf Subject: [U-Boot] [PATCH 3/3] Remove includes and PRI* usages in printf() entirely X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" In int-ll64.h, we always use the following typedefs: typedef unsigned int u32; typedef unsigned long uintptr_t; typedef unsigned long long u64; This does not need to match to the compiler's . Do not include it. The use of PRI* makes the code super-ugly. You can simply use "l" for printing uintptr_t, "ll" for u64, and no modifier for u32. Signed-off-by: Masahiro Yamada --- arch/x86/lib/relocate.c | 12 +- board/raspberrypi/rpi/rpi.c | 3 +- cmd/mem.c | 6 +- common/fdt_support.c | 17 +-- common/usb_storage.c | 16 +-- disk/part_efi.c | 1 - drivers/pci/pci-uclass.c | 6 +- drivers/pci/pci_sandbox.c | 1 - drivers/scsi/scsi.c | 9 +- fs/ext4/ext4_common.c | 3 +- include/common.h | 3 - include/inttypes.h | 276 --------------------------------------- lib/display_options.c | 5 +- lib/efi_loader/efi_boottime.c | 7 +- lib/efi_loader/efi_device_path.c | 1 - lib/efi_loader/efi_disk.c | 7 +- lib/efi_loader/efi_gop.c | 1 - lib/efi_loader/efi_memory.c | 3 +- lib/efi_loader/efi_net.c | 1 - lib/efi_loader/efi_smbios.c | 1 - lib/fdtdec.c | 8 +- test/stdint/int-types.c | 7 +- 22 files changed, 43 insertions(+), 351 deletions(-) delete mode 100644 include/inttypes.h diff --git a/arch/x86/lib/relocate.c b/arch/x86/lib/relocate.c index 050f9d0..ed10755 100644 --- a/arch/x86/lib/relocate.c +++ b/arch/x86/lib/relocate.c @@ -15,7 +15,6 @@ */ #include -#include #include #include #include @@ -70,8 +69,7 @@ static void do_elf_reloc_fixups64(unsigned int text_base, uintptr_t size, *offset_ptr_ram = gd->reloc_off + re_src->r_addend; } else { - debug(" %p: %lx: rom reloc %lx, ram %p, value %lx, limit %" - PRIXPTR "\n", + debug(" %p: %lx: rom reloc %lx, ram %p, value %lx, limit %lX\n", re_src, (ulong)re_src->r_info, (ulong)re_src->r_offset, offset_ptr_ram, (ulong)*offset_ptr_ram, text_base + size); @@ -109,11 +107,9 @@ static void do_elf_reloc_fixups32(unsigned int text_base, uintptr_t size, *offset_ptr_ram <= text_base + size) { *offset_ptr_ram += gd->reloc_off; } else { - debug(" %p: rom reloc %x, ram %p, value %x," - " limit %" PRIXPTR "\n", re_src, - re_src->r_offset, offset_ptr_ram, - *offset_ptr_ram, - text_base + size); + debug(" %p: rom reloc %x, ram %p, value %x, limit %lX\n", + re_src, re_src->r_offset, offset_ptr_ram, + *offset_ptr_ram, text_base + size); } } else { debug(" %p: rom reloc %x, last %p\n", re_src, diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c index 35f5939..649127c 100644 --- a/board/raspberrypi/rpi/rpi.c +++ b/board/raspberrypi/rpi/rpi.c @@ -4,7 +4,6 @@ */ #include -#include #include #include #include @@ -384,7 +383,7 @@ static void set_serial_number(void) return; } - snprintf(serial_string, sizeof(serial_string), "%016" PRIx64, + snprintf(serial_string, sizeof(serial_string), "%016llx", msg->get_board_serial.body.resp.serial); env_set("serial#", serial_string); } diff --git a/cmd/mem.c b/cmd/mem.c index 509b400..392ed17 100644 --- a/cmd/mem.c +++ b/cmd/mem.c @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include @@ -275,8 +274,7 @@ static int do_mem_cmp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) if (word1 != word2) { ulong offset = buf1 - base; #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA - printf("%s at 0x%p (%#0*"PRIx64") != %s at 0x%p (%#0*" - PRIx64 ")\n", + printf("%s at 0x%p (%#0*llx) != %s at 0x%p (%#0*llx)\n", type, (void *)(addr1 + offset), size, word1, type, (void *)(addr2 + offset), size, word2); #else @@ -1000,7 +998,7 @@ mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const argv[]) printf(" %08x", *((u32 *)ptr)); #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA else if (size == 8) - printf(" %016" PRIx64, *((u64 *)ptr)); + printf(" %016llx", *((u64 *)ptr)); #endif else if (size == 2) printf(" %04x", *((u16 *)ptr)); diff --git a/common/fdt_support.c b/common/fdt_support.c index 1bdd03f..f37a2e8 100644 --- a/common/fdt_support.c +++ b/common/fdt_support.c @@ -7,7 +7,6 @@ */ #include -#include #include #include #include @@ -1021,8 +1020,7 @@ static u64 of_bus_default_map(fdt32_t *addr, const fdt32_t *range, s = fdt_read_number(range + na + pna, ns); da = fdt_read_number(addr, na); - debug("OF: default map, cp=%" PRIu64 ", s=%" PRIu64 - ", da=%" PRIu64 "\n", cp, s, da); + debug("OF: default map, cp=%llu, s=%llu, da=%llu\n", cp, s, da); if (da < cp || da >= (cp + s)) return OF_BAD_ADDR; @@ -1077,8 +1075,7 @@ static u64 of_bus_isa_map(fdt32_t *addr, const fdt32_t *range, s = fdt_read_number(range + na + pna, ns); da = fdt_read_number(addr + 1, na - 1); - debug("OF: ISA map, cp=%" PRIu64 ", s=%" PRIu64 - ", da=%" PRIu64 "\n", cp, s, da); + debug("OF: ISA map, cp=%llu, s=%llu, da=%llu\n", cp, s, da); if (da < cp || da >= (cp + s)) return OF_BAD_ADDR; @@ -1184,7 +1181,7 @@ static int of_translate_one(const void *blob, int parent, struct of_bus *bus, finish: of_dump_addr("OF: parent translation for:", addr, pna); - debug("OF: with offset: %" PRIu64 "\n", offset); + debug("OF: with offset: %llu\n", offset); /* Translate it into parent bus space */ return pbus->translate(addr, offset, pna); @@ -1514,9 +1511,9 @@ int fdt_verify_alias_address(void *fdt, int anode, const char *alias, u64 addr) dt_addr = fdt_translate_address(fdt, node, reg); if (addr != dt_addr) { - printf("Warning: U-Boot configured device %s at address %" - PRIx64 ",\n but the device tree has it address %" - PRIx64 ".\n", alias, addr, dt_addr); + printf("Warning: U-Boot configured device %s at address %llu,\n" + "but the device tree has it address %llx.\n", + alias, addr, dt_addr); return 0; } @@ -1664,7 +1661,7 @@ int fdt_setup_simplefb_node(void *fdt, int node, u64 base_address, u32 width, if (ret < 0) return ret; - snprintf(name, sizeof(name), "framebuffer@%" PRIx64, base_address); + snprintf(name, sizeof(name), "framebuffer@%llx", base_address); ret = fdt_set_name(fdt, node, name); if (ret < 0) return ret; diff --git a/common/usb_storage.c b/common/usb_storage.c index 9cd6474..d92ebb6 100644 --- a/common/usb_storage.c +++ b/common/usb_storage.c @@ -36,7 +36,6 @@ #include #include #include -#include #include #include #include @@ -1164,8 +1163,8 @@ static unsigned long usb_stor_read(struct blk_desc *block_dev, lbaint_t blknr, start = blknr; blks = blkcnt; - debug("\nusb_read: dev %d startblk " LBAF ", blccnt " LBAF " buffer %" - PRIxPTR "\n", block_dev->devnum, start, blks, buf_addr); + debug("\nusb_read: dev %d startblk " LBAF ", blccnt " LBAF " buffer %lx\n", + block_dev->devnum, start, blks, buf_addr); do { /* XXX need some comment here */ @@ -1194,8 +1193,7 @@ retry_it: } while (blks != 0); ss->flags &= ~USB_READY; - debug("usb_read: end startblk " LBAF - ", blccnt %x buffer %" PRIxPTR "\n", + debug("usb_read: end startblk " LBAF ", blccnt %x buffer %lx\n", start, smallblks, buf_addr); usb_disable_asynch(0); /* asynch transfer allowed */ @@ -1248,8 +1246,8 @@ static unsigned long usb_stor_write(struct blk_desc *block_dev, lbaint_t blknr, start = blknr; blks = blkcnt; - debug("\nusb_write: dev %d startblk " LBAF ", blccnt " LBAF " buffer %" - PRIxPTR "\n", block_dev->devnum, start, blks, buf_addr); + debug("\nusb_write: dev %d startblk " LBAF ", blccnt " LBAF " buffer %lx\n", + block_dev->devnum, start, blks, buf_addr); do { /* If write fails retry for max retry count else @@ -1280,8 +1278,8 @@ retry_it: } while (blks != 0); ss->flags &= ~USB_READY; - debug("usb_write: end startblk " LBAF ", blccnt %x buffer %" - PRIxPTR "\n", start, smallblks, buf_addr); + debug("usb_write: end startblk " LBAF ", blccnt %x buffer %lx\n", + start, smallblks, buf_addr); usb_disable_asynch(0); /* asynch transfer allowed */ if (blkcnt >= ss->max_xfer_blk) diff --git a/disk/part_efi.c b/disk/part_efi.c index 2945892..519a637 100644 --- a/disk/part_efi.c +++ b/disk/part_efi.c @@ -14,7 +14,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c index 46e9c71..447e6f1 100644 --- a/drivers/pci/pci-uclass.c +++ b/drivers/pci/pci-uclass.c @@ -7,7 +7,6 @@ #include #include #include -#include #include #include #include @@ -852,9 +851,8 @@ static void decode_regions(struct pci_controller *hose, ofnode parent_node, prop += addr_cells; size = fdtdec_get_number(prop, size_cells); prop += size_cells; - debug("%s: region %d, pci_addr=%" PRIx64 ", addr=%" PRIx64 - ", size=%" PRIx64 ", space_code=%d\n", __func__, - hose->region_count, pci_addr, addr, size, space_code); + debug("%s: region %d, pci_addr=%llx, addr=%llx, size=%llx, space_code=%d\n", + __func__, hose->region_count, pci_addr, addr, size, space_code); if (space_code & 2) { type = flags & (1U << 30) ? PCI_REGION_PREFETCH : PCI_REGION_MEM; diff --git a/drivers/pci/pci_sandbox.c b/drivers/pci/pci_sandbox.c index 67cd733..90b6ca1 100644 --- a/drivers/pci/pci_sandbox.c +++ b/drivers/pci/pci_sandbox.c @@ -7,7 +7,6 @@ #include #include #include -#include #include static int sandbox_pci_write_config(struct udevice *bus, pci_dev_t devfn, diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index 16246be..bc6ac8c 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c @@ -6,7 +6,6 @@ #include #include -#include #include #include #include @@ -196,7 +195,7 @@ static ulong scsi_read(struct blk_desc *block_dev, lbaint_t blknr, blks = 0; } debug("scsi_read_ext: startblk " LBAF - ", blccnt %x buffer %" PRIXPTR "\n", + ", blccnt %x buffer %lX\n", start, smallblks, buf_addr); if (scsi_exec(bdev, pccb)) { scsi_print_error(pccb); @@ -206,7 +205,7 @@ static ulong scsi_read(struct blk_desc *block_dev, lbaint_t blknr, buf_addr += pccb->datalen; } while (blks != 0); debug("scsi_read_ext: end startblk " LBAF - ", blccnt %x buffer %" PRIXPTR "\n", start, smallblks, buf_addr); + ", blccnt %x buffer %lX\n", start, smallblks, buf_addr); return blkcnt; } @@ -260,7 +259,7 @@ static ulong scsi_write(struct blk_desc *block_dev, lbaint_t blknr, start += blks; blks = 0; } - debug("%s: startblk " LBAF ", blccnt %x buffer %" PRIXPTR "\n", + debug("%s: startblk " LBAF ", blccnt %x buffer %lx\n", __func__, start, smallblks, buf_addr); if (scsi_exec(bdev, pccb)) { scsi_print_error(pccb); @@ -269,7 +268,7 @@ static ulong scsi_write(struct blk_desc *block_dev, lbaint_t blknr, } buf_addr += pccb->datalen; } while (blks != 0); - debug("%s: end startblk " LBAF ", blccnt %x buffer %" PRIXPTR "\n", + debug("%s: end startblk " LBAF ", blccnt %x buffer %lX\n", __func__, start, smallblks, buf_addr); return blkcnt; } diff --git a/fs/ext4/ext4_common.c b/fs/ext4/ext4_common.c index 672fead..67e2471 100644 --- a/fs/ext4/ext4_common.c +++ b/fs/ext4/ext4_common.c @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include @@ -210,7 +209,7 @@ void put_ext4(uint64_t off, void *buf, uint32_t size) if ((startblock + (size >> log2blksz)) > (part_offset + fs->total_sect)) { printf("part_offset is " LBAFU "\n", part_offset); - printf("total_sector is %" PRIu64 "\n", fs->total_sect); + printf("total_sector is %llu\n", fs->total_sect); printf("error: overflow occurs\n"); return; } diff --git a/include/common.h b/include/common.h index 940161f..69d79b3 100644 --- a/include/common.h +++ b/include/common.h @@ -37,9 +37,6 @@ typedef volatile unsigned char vu_char; #include #include -/* Bring in printf format macros if inttypes.h is included */ -#define __STDC_FORMAT_MACROS - #ifdef __LP64__ #define CONFIG_SYS_SUPPORT_64BIT_DATA #endif diff --git a/include/inttypes.h b/include/inttypes.h deleted file mode 100644 index b86ad04..0000000 --- a/include/inttypes.h +++ /dev/null @@ -1,276 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ */ -/* - * Copyright (C) 1997-2001, 2004, 2007 Free Software Foundation, Inc. - * - * This file is taken from the GNU C Library v2.15, with the unimplemented - * functions removed and a few style fixes. - */ - -/* - * ISO C99: 7.8 Format conversion of integer types - */ - -#ifndef _INTTYPES_H -#define _INTTYPES_H 1 - -#include - -/* Get a definition for wchar_t. But we must not define wchar_t itself. */ -#ifndef ____gwchar_t_defined -# ifdef __cplusplus -# define __gwchar_t wchar_t -# elif defined __WCHAR_TYPE__ -typedef __WCHAR_TYPE__ __gwchar_t; -# else -# define __need_wchar_t -# include -typedef wchar_t __gwchar_t; -# endif -# define ____gwchar_t_defined 1 -#endif - - -/* The ISO C99 standard specifies that these macros must only be - defined if explicitly requested. */ -#if !defined __cplusplus || defined __STDC_FORMAT_MACROS - -/* linux/types.h always uses long long for 64-bit and long for uintptr_t */ -# define __PRI64_PREFIX "ll" -# define __PRIPTR_PREFIX "l" - -/* Macros for printing format specifiers. */ - -/* Decimal notation. */ -# define PRId8 "d" -# define PRId16 "d" -# define PRId32 "d" -# define PRId64 __PRI64_PREFIX "d" - -# define PRIdLEAST8 "d" -# define PRIdLEAST16 "d" -# define PRIdLEAST32 "d" -# define PRIdLEAST64 __PRI64_PREFIX "d" - -# define PRIdFAST8 "d" -# define PRIdFAST16 __PRIPTR_PREFIX "d" -# define PRIdFAST32 __PRIPTR_PREFIX "d" -# define PRIdFAST64 __PRI64_PREFIX "d" - - -# define PRIi8 "i" -# define PRIi16 "i" -# define PRIi32 "i" -# define PRIi64 __PRI64_PREFIX "i" - -# define PRIiLEAST8 "i" -# define PRIiLEAST16 "i" -# define PRIiLEAST32 "i" -# define PRIiLEAST64 __PRI64_PREFIX "i" - -# define PRIiFAST8 "i" -# define PRIiFAST16 __PRIPTR_PREFIX "i" -# define PRIiFAST32 __PRIPTR_PREFIX "i" -# define PRIiFAST64 __PRI64_PREFIX "i" - -/* Octal notation. */ -# define PRIo8 "o" -# define PRIo16 "o" -# define PRIo32 "o" -# define PRIo64 __PRI64_PREFIX "o" - -# define PRIoLEAST8 "o" -# define PRIoLEAST16 "o" -# define PRIoLEAST32 "o" -# define PRIoLEAST64 __PRI64_PREFIX "o" - -# define PRIoFAST8 "o" -# define PRIoFAST16 __PRIPTR_PREFIX "o" -# define PRIoFAST32 __PRIPTR_PREFIX "o" -# define PRIoFAST64 __PRI64_PREFIX "o" - -/* Unsigned integers. */ -# define PRIu8 "u" -# define PRIu16 "u" -# define PRIu32 "u" -# define PRIu64 __PRI64_PREFIX "u" - -# define PRIuLEAST8 "u" -# define PRIuLEAST16 "u" -# define PRIuLEAST32 "u" -# define PRIuLEAST64 __PRI64_PREFIX "u" - -# define PRIuFAST8 "u" -# define PRIuFAST16 __PRIPTR_PREFIX "u" -# define PRIuFAST32 __PRIPTR_PREFIX "u" -# define PRIuFAST64 __PRI64_PREFIX "u" - -/* lowercase hexadecimal notation. */ -# define PRIx8 "x" -# define PRIx16 "x" -# define PRIx32 "x" -# define PRIx64 __PRI64_PREFIX "x" - -# define PRIxLEAST8 "x" -# define PRIxLEAST16 "x" -# define PRIxLEAST32 "x" -# define PRIxLEAST64 __PRI64_PREFIX "x" - -# define PRIxFAST8 "x" -# define PRIxFAST16 __PRIPTR_PREFIX "x" -# define PRIxFAST32 __PRIPTR_PREFIX "x" -# define PRIxFAST64 __PRI64_PREFIX "x" - -/* UPPERCASE hexadecimal notation. */ -# define PRIX8 "X" -# define PRIX16 "X" -# define PRIX32 "X" -# define PRIX64 __PRI64_PREFIX "X" - -# define PRIXLEAST8 "X" -# define PRIXLEAST16 "X" -# define PRIXLEAST32 "X" -# define PRIXLEAST64 __PRI64_PREFIX "X" - -# define PRIXFAST8 "X" -# define PRIXFAST16 __PRIPTR_PREFIX "X" -# define PRIXFAST32 __PRIPTR_PREFIX "X" -# define PRIXFAST64 __PRI64_PREFIX "X" - - -/* Macros for printing `intmax_t' and `uintmax_t'. */ -# define PRIdMAX __PRI64_PREFIX "d" -# define PRIiMAX __PRI64_PREFIX "i" -# define PRIoMAX __PRI64_PREFIX "o" -# define PRIuMAX __PRI64_PREFIX "u" -# define PRIxMAX __PRI64_PREFIX "x" -# define PRIXMAX __PRI64_PREFIX "X" - - -/* Macros for printing `intptr_t' and `uintptr_t'. */ -# define PRIdPTR __PRIPTR_PREFIX "d" -# define PRIiPTR __PRIPTR_PREFIX "i" -# define PRIoPTR __PRIPTR_PREFIX "o" -# define PRIuPTR __PRIPTR_PREFIX "u" -# define PRIxPTR __PRIPTR_PREFIX "x" -# define PRIXPTR __PRIPTR_PREFIX "X" - - -/* Macros for scanning format specifiers. */ - -/* Signed decimal notation. */ -# define SCNd8 "hhd" -# define SCNd16 "hd" -# define SCNd32 "d" -# define SCNd64 __PRI64_PREFIX "d" - -# define SCNdLEAST8 "hhd" -# define SCNdLEAST16 "hd" -# define SCNdLEAST32 "d" -# define SCNdLEAST64 __PRI64_PREFIX "d" - -# define SCNdFAST8 "hhd" -# define SCNdFAST16 __PRIPTR_PREFIX "d" -# define SCNdFAST32 __PRIPTR_PREFIX "d" -# define SCNdFAST64 __PRI64_PREFIX "d" - -/* Signed decimal notation. */ -# define SCNi8 "hhi" -# define SCNi16 "hi" -# define SCNi32 "i" -# define SCNi64 __PRI64_PREFIX "i" - -# define SCNiLEAST8 "hhi" -# define SCNiLEAST16 "hi" -# define SCNiLEAST32 "i" -# define SCNiLEAST64 __PRI64_PREFIX "i" - -# define SCNiFAST8 "hhi" -# define SCNiFAST16 __PRIPTR_PREFIX "i" -# define SCNiFAST32 __PRIPTR_PREFIX "i" -# define SCNiFAST64 __PRI64_PREFIX "i" - -/* Unsigned decimal notation. */ -# define SCNu8 "hhu" -# define SCNu16 "hu" -# define SCNu32 "u" -# define SCNu64 __PRI64_PREFIX "u" - -# define SCNuLEAST8 "hhu" -# define SCNuLEAST16 "hu" -# define SCNuLEAST32 "u" -# define SCNuLEAST64 __PRI64_PREFIX "u" - -# define SCNuFAST8 "hhu" -# define SCNuFAST16 __PRIPTR_PREFIX "u" -# define SCNuFAST32 __PRIPTR_PREFIX "u" -# define SCNuFAST64 __PRI64_PREFIX "u" - -/* Octal notation. */ -# define SCNo8 "hho" -# define SCNo16 "ho" -# define SCNo32 "o" -# define SCNo64 __PRI64_PREFIX "o" - -# define SCNoLEAST8 "hho" -# define SCNoLEAST16 "ho" -# define SCNoLEAST32 "o" -# define SCNoLEAST64 __PRI64_PREFIX "o" - -# define SCNoFAST8 "hho" -# define SCNoFAST16 __PRIPTR_PREFIX "o" -# define SCNoFAST32 __PRIPTR_PREFIX "o" -# define SCNoFAST64 __PRI64_PREFIX "o" - -/* Hexadecimal notation. */ -# define SCNx8 "hhx" -# define SCNx16 "hx" -# define SCNx32 "x" -# define SCNx64 __PRI64_PREFIX "x" - -# define SCNxLEAST8 "hhx" -# define SCNxLEAST16 "hx" -# define SCNxLEAST32 "x" -# define SCNxLEAST64 __PRI64_PREFIX "x" - -# define SCNxFAST8 "hhx" -# define SCNxFAST16 __PRIPTR_PREFIX "x" -# define SCNxFAST32 __PRIPTR_PREFIX "x" -# define SCNxFAST64 __PRI64_PREFIX "x" - - -/* Macros for scanning `intmax_t' and `uintmax_t'. */ -# define SCNdMAX __PRI64_PREFIX "d" -# define SCNiMAX __PRI64_PREFIX "i" -# define SCNoMAX __PRI64_PREFIX "o" -# define SCNuMAX __PRI64_PREFIX "u" -# define SCNxMAX __PRI64_PREFIX "x" - -/* Macros for scaning `intptr_t' and `uintptr_t'. */ -# define SCNdPTR __PRIPTR_PREFIX "d" -# define SCNiPTR __PRIPTR_PREFIX "i" -# define SCNoPTR __PRIPTR_PREFIX "o" -# define SCNuPTR __PRIPTR_PREFIX "u" -# define SCNxPTR __PRIPTR_PREFIX "x" - -#endif /* C++ && format macros */ - - -#if __WORDSIZE == 64 - -/* We have to define the `uintmax_t' type using `ldiv_t'. */ -typedef struct { - long int quot; /* Quotient. */ - long int rem; /* Remainder. */ -} imaxdiv_t; - -#else - -/* We have to define the `uintmax_t' type using `lldiv_t'. */ -typedef struct { - long long int quot; /* Quotient. */ - long long int rem; /* Remainder. */ -} imaxdiv_t; - -#endif - -#endif /* inttypes.h */ diff --git a/lib/display_options.c b/lib/display_options.c index f1c9304..3284982 100644 --- a/lib/display_options.c +++ b/lib/display_options.c @@ -7,7 +7,6 @@ #include #include #include -#include #include #include #include @@ -65,7 +64,7 @@ void print_freq(uint64_t freq, const char *s) } if (!c) { - printf("%" PRIu64 " Hz%s", freq, s); + printf("%llu Hz%s", freq, s); return; } @@ -105,7 +104,7 @@ void print_size(uint64_t size, const char *s) } if (!c) { - printf("%" PRIu64 " Bytes%s", size, s); + printf("%llu Bytes%s", size, s); return; } diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index b9e54f5..92b715e 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -13,7 +13,6 @@ #include #include #include -#include #include DECLARE_GLOBAL_DATA_PTR; @@ -350,7 +349,7 @@ static efi_status_t EFIAPI efi_free_pages_ext(uint64_t memory, { efi_status_t r; - EFI_ENTRY("%" PRIx64 ", 0x%zx", memory, pages); + EFI_ENTRY("%llx, 0x%zx", memory, pages); r = efi_free_pages(memory, pages); return EFI_EXIT(r); } @@ -800,7 +799,7 @@ static efi_status_t EFIAPI efi_set_timer_ext(struct efi_event *event, enum efi_timer_delay type, uint64_t trigger_time) { - EFI_ENTRY("%p, %d, %" PRIx64, event, type, trigger_time); + EFI_ENTRY("%p, %d, %llx", event, type, trigger_time); return EFI_EXIT(efi_set_timer(event, type, trigger_time)); } @@ -1972,7 +1971,7 @@ static efi_status_t EFIAPI efi_set_watchdog_timer(unsigned long timeout, unsigned long data_size, uint16_t *watchdog_data) { - EFI_ENTRY("%ld, 0x%" PRIx64 ", %ld, %p", timeout, watchdog_code, + EFI_ENTRY("%ld, 0x%llx, %ld, %p", timeout, watchdog_code, data_size, watchdog_data); return EFI_EXIT(efi_set_watchdog(timeout)); } diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c index 6040bcf..9d776a6 100644 --- a/lib/efi_loader/efi_device_path.c +++ b/lib/efi_loader/efi_device_path.c @@ -13,7 +13,6 @@ #include #include #include -#include #include /* template END node: */ diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c index 5c6ec52..13fcc1b 100644 --- a/lib/efi_loader/efi_disk.c +++ b/lib/efi_loader/efi_disk.c @@ -9,7 +9,6 @@ #include #include #include -#include #include #include @@ -66,7 +65,7 @@ static efi_status_t efi_disk_rw_blocks(struct efi_block_io *this, blocks = buffer_size / blksz; lba += diskobj->offset; - debug("EFI: %s:%d blocks=%x lba=%"PRIx64" blksz=%x dir=%d\n", __func__, + debug("EFI: %s:%d blocks=%x lba=%llx blksz=%x dir=%d\n", __func__, __LINE__, blocks, lba, blksz, direction); /* We only support full block access */ @@ -111,7 +110,7 @@ static efi_status_t EFIAPI efi_disk_read_blocks(struct efi_block_io *this, real_buffer = efi_bounce_buffer; #endif - EFI_ENTRY("%p, %x, %" PRIx64 ", %zx, %p", this, media_id, lba, + EFI_ENTRY("%p, %x, %llx, %zx, %p", this, media_id, lba, buffer_size, buffer); r = efi_disk_rw_blocks(this, media_id, lba, buffer_size, real_buffer, @@ -146,7 +145,7 @@ static efi_status_t EFIAPI efi_disk_write_blocks(struct efi_block_io *this, real_buffer = efi_bounce_buffer; #endif - EFI_ENTRY("%p, %x, %" PRIx64 ", %zx, %p", this, media_id, lba, + EFI_ENTRY("%p, %x, %llx, %zx, %p", this, media_id, lba, buffer_size, buffer); /* Populate bounce buffer if necessary */ diff --git a/lib/efi_loader/efi_gop.c b/lib/efi_loader/efi_gop.c index 3a36bbc..a4aa9bc 100644 --- a/lib/efi_loader/efi_gop.c +++ b/lib/efi_loader/efi_gop.c @@ -8,7 +8,6 @@ #include #include #include -#include #include #include #include diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c index 967c3f7..59f6af5 100644 --- a/lib/efi_loader/efi_memory.c +++ b/lib/efi_loader/efi_memory.c @@ -7,7 +7,6 @@ #include #include -#include #include #include #include @@ -159,7 +158,7 @@ uint64_t efi_add_memory_map(uint64_t start, uint64_t pages, int memory_type, bool carve_again; uint64_t carved_pages = 0; - debug("%s: 0x%" PRIx64 " 0x%" PRIx64 " %d %s\n", __func__, + debug("%s: 0x%llx 0x%llx %d %s\n", __func__, start, pages, memory_type, overlap_only_ram ? "yes" : "no"); if (memory_type >= EFI_MAX_MEMORY_TYPE) diff --git a/lib/efi_loader/efi_net.c b/lib/efi_loader/efi_net.c index 5a3d7be..034d0d2 100644 --- a/lib/efi_loader/efi_net.c +++ b/lib/efi_loader/efi_net.c @@ -7,7 +7,6 @@ #include #include -#include #include #include diff --git a/lib/efi_loader/efi_smbios.c b/lib/efi_loader/efi_smbios.c index 932f758..38e42fa 100644 --- a/lib/efi_loader/efi_smbios.c +++ b/lib/efi_loader/efi_smbios.c @@ -7,7 +7,6 @@ #include #include -#include #include static const efi_guid_t smbios_guid = SMBIOS_TABLE_GUID; diff --git a/lib/fdtdec.c b/lib/fdtdec.c index a208589..1cc0863 100644 --- a/lib/fdtdec.c +++ b/lib/fdtdec.c @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include @@ -1450,13 +1449,12 @@ int fdtdec_decode_ram_size(const void *blob, const char *area, int board_id, if (auto_size) { u64 new_size; - debug("Auto-sizing %" PRIx64 ", size %" PRIx64 ": ", - addr, size); + debug("Auto-sizing %llx, size %llx: ", addr, size); new_size = get_ram_size((long *)(uintptr_t)addr, size); if (new_size == size) { debug("OK\n"); } else { - debug("sized to %" PRIx64 "\n", new_size); + debug("sized to %llx\n", new_size); size = new_size; } } @@ -1466,7 +1464,7 @@ int fdtdec_decode_ram_size(const void *blob, const char *area, int board_id, total_size += size; } - debug("Memory size %" PRIu64 "\n", total_size); + debug("Memory size %llu\n", total_size); if (sizep) *sizep = (phys_size_t)total_size; diff --git a/test/stdint/int-types.c b/test/stdint/int-types.c index 2660084..f6d09e8 100644 --- a/test/stdint/int-types.c +++ b/test/stdint/int-types.c @@ -1,5 +1,4 @@ #include -#include int test_types(void) { @@ -7,7 +6,7 @@ int test_types(void) uint64_t uint64 = 0; u64 u64_val = 0; - printf("uintptr = %" PRIuPTR "\n", uintptr); - printf("uint64 = %" PRIu64 "\n", uint64); - printf("u64 = %" PRIu64 "\n", u64_val); + printf("uintptr = %lu\n", uintptr); + printf("uint64 = %llu\n", uint64); + printf("u64 = %llu\n", u64_val); }