[PATCH 01/14] trace: Use notrace for short

Simon Glass sjg at chromium.org
Thu Dec 22 00:08:15 CET 2022


The attribute syntax is quite verbose. Use the macro provided for this
purpose.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 arch/arm/cpu/armv7/s5p-common/timer.c   |  2 +-
 arch/arm/mach-exynos/include/mach/cpu.h |  6 +++---
 arch/x86/include/asm/global_data.h      |  2 +-
 arch/x86/include/asm/msr.h              |  2 +-
 arch/x86/include/asm/u-boot-x86.h       |  2 +-
 common/spl/spl_fit.c                    |  1 +
 doc/develop/trace.rst                   |  2 +-
 lib/efi_loader/efi_freestanding.c       |  4 ++--
 lib/trace.c                             | 26 +++++++++++--------------
 9 files changed, 22 insertions(+), 25 deletions(-)

diff --git a/arch/arm/cpu/armv7/s5p-common/timer.c b/arch/arm/cpu/armv7/s5p-common/timer.c
index 8533d04878c..65e3ec39ae3 100644
--- a/arch/arm/cpu/armv7/s5p-common/timer.c
+++ b/arch/arm/cpu/armv7/s5p-common/timer.c
@@ -86,7 +86,7 @@ unsigned long get_timer(unsigned long base)
 	return time_ms - base;
 }
 
-unsigned long __attribute__((no_instrument_function)) timer_get_us(void)
+unsigned long notrace timer_get_us(void)
 {
 	static unsigned long base_time_us;
 
diff --git a/arch/arm/mach-exynos/include/mach/cpu.h b/arch/arm/mach-exynos/include/mach/cpu.h
index fb5fdaf3ba8..dab148e3320 100644
--- a/arch/arm/mach-exynos/include/mach/cpu.h
+++ b/arch/arm/mach-exynos/include/mach/cpu.h
@@ -248,7 +248,7 @@ static inline char *s5p_get_cpu_name(void)
 }
 
 #define IS_SAMSUNG_TYPE(type, id)			\
-static inline int __attribute__((no_instrument_function)) cpu_is_##type(void) \
+static inline int notrace cpu_is_##type(void)		\
 {							\
 	return (s5p_cpu_id >> 12) == id;		\
 }
@@ -257,7 +257,7 @@ IS_SAMSUNG_TYPE(exynos4, 0x4)
 IS_SAMSUNG_TYPE(exynos5, 0x5)
 
 #define IS_EXYNOS_TYPE(type, id)			\
-static inline int __attribute__((no_instrument_function)) \
+static inline int notrace				\
 	proid_is_##type(void)				\
 {							\
 	return s5p_cpu_id == id;			\
@@ -272,7 +272,7 @@ IS_EXYNOS_TYPE(exynos5422, 0x5422)
 #define proid_is_exynos542x() (proid_is_exynos5420() || proid_is_exynos5422())
 
 #define SAMSUNG_BASE(device, base)				\
-static inline unsigned long __attribute__((no_instrument_function)) \
+static inline unsigned long notrace				\
 	samsung_get_base_##device(void) \
 {								\
 	if (cpu_is_exynos4()) {				\
diff --git a/arch/x86/include/asm/global_data.h b/arch/x86/include/asm/global_data.h
index 23693f85a78..22d103df4ee 100644
--- a/arch/x86/include/asm/global_data.h
+++ b/arch/x86/include/asm/global_data.h
@@ -137,7 +137,7 @@ struct arch_global_data {
 
 #define DECLARE_GLOBAL_DATA_PTR   extern struct global_data *global_data_ptr
 # else
-static inline __attribute__((no_instrument_function)) gd_t *get_fs_gd_ptr(void)
+static inline notrace gd_t *get_fs_gd_ptr(void)
 {
 	gd_t *gd_ptr;
 
diff --git a/arch/x86/include/asm/msr.h b/arch/x86/include/asm/msr.h
index 3e613de6cef..27764fc56cb 100644
--- a/arch/x86/include/asm/msr.h
+++ b/arch/x86/include/asm/msr.h
@@ -71,7 +71,7 @@ static inline unsigned long long native_read_tscp(unsigned int *aux)
 #define EAX_EDX_RET(val, low, high)	"=A" (val)
 #endif
 
-static inline __attribute__((no_instrument_function))
+static inline notrace
 	unsigned long long native_read_msr(unsigned int msr)
 {
 	DECLARE_ARGS(val, low, high);
diff --git a/arch/x86/include/asm/u-boot-x86.h b/arch/x86/include/asm/u-boot-x86.h
index 4cf41e93541..8f38c2d1c60 100644
--- a/arch/x86/include/asm/u-boot-x86.h
+++ b/arch/x86/include/asm/u-boot-x86.h
@@ -108,7 +108,7 @@ void	board_init_f_r(void) __attribute__ ((noreturn));
 int arch_misc_init(void);
 
 /* Read the time stamp counter */
-static inline __attribute__((no_instrument_function)) uint64_t rdtsc(void)
+static inline notrace uint64_t rdtsc(void)
 {
 	uint32_t high, low;
 	__asm__ __volatile__("rdtsc" : "=a" (low), "=d" (high));
diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
index 08da7fed88e..0e026bb3d8e 100644
--- a/common/spl/spl_fit.c
+++ b/common/spl/spl_fit.c
@@ -599,6 +599,7 @@ static int spl_fit_upload_fpga(struct spl_fit_info *ctx, int node,
 			debug("Ignoring compatible = %s property\n",
 			      compatible);
 	}
+	return 0;
 
 	ret = fpga_load(devnum, (void *)fpga_image->load_addr,
 			fpga_image->size, BIT_FULL, flags);
diff --git a/doc/develop/trace.rst b/doc/develop/trace.rst
index b22e068ef9e..5c7802da51a 100644
--- a/doc/develop/trace.rst
+++ b/doc/develop/trace.rst
@@ -185,7 +185,7 @@ this produces sensible results for your board. Suitable sources for
 this timer include high resolution timers, PWMs or profile timers if
 available. Most modern SOCs have a suitable timer for this. Make sure
 that you mark this timer (and anything it calls) with
-__attribute__((no_instrument_function)) so that the trace library can
+notrace so that the trace library can
 use it without causing an infinite loop.
 
 
diff --git a/lib/efi_loader/efi_freestanding.c b/lib/efi_loader/efi_freestanding.c
index c85df026f0d..4b65fc64dd0 100644
--- a/lib/efi_loader/efi_freestanding.c
+++ b/lib/efi_loader/efi_freestanding.c
@@ -100,7 +100,7 @@ void *memset(void *s, int c, size_t n)
  * func_ptr:	Pointer to function being entered
  * caller:	Pointer to function which called this function
  */
-void __attribute__((no_instrument_function))
+void notrace
 __cyg_profile_func_enter(void *func_ptr, void *caller)
 {
 }
@@ -116,7 +116,7 @@ __cyg_profile_func_enter(void *func_ptr, void *caller)
  * func_ptr:	Pointer to function being entered
  * caller:	Pointer to function which called this function
  */
-void __attribute__((no_instrument_function))
+void notrace
 __cyg_profile_func_exit(void *func_ptr, void *caller)
 {
 }
diff --git a/lib/trace.c b/lib/trace.c
index 54f0bf2f578..880d90ebd5c 100644
--- a/lib/trace.c
+++ b/lib/trace.c
@@ -68,7 +68,7 @@ static volatile gd_t *trace_gd;
 /**
  * trace_save_gd() - save the value of the gd register
  */
-static void __attribute__((no_instrument_function)) trace_save_gd(void)
+static void notrace trace_save_gd(void)
 {
 	trace_gd = gd;
 }
@@ -81,7 +81,7 @@ static void __attribute__((no_instrument_function)) trace_save_gd(void)
  * have to set the gd register to the U-Boot value when entering a trace
  * point and set it back to the application value when exiting the trace point.
  */
-static void __attribute__((no_instrument_function)) trace_swap_gd(void)
+static void notrace trace_swap_gd(void)
 {
 	volatile gd_t *temp_gd = trace_gd;
 
@@ -91,18 +91,17 @@ static void __attribute__((no_instrument_function)) trace_swap_gd(void)
 
 #else
 
-static void __attribute__((no_instrument_function)) trace_save_gd(void)
+static void notrace trace_save_gd(void)
 {
 }
 
-static void __attribute__((no_instrument_function)) trace_swap_gd(void)
+static void notrace trace_swap_gd(void)
 {
 }
 
 #endif
 
-static void __attribute__((no_instrument_function)) add_ftrace(void *func_ptr,
-				void *caller, ulong flags)
+static void notrace add_ftrace(void *func_ptr, void *caller, ulong flags)
 {
 	if (hdr->depth > hdr->depth_limit) {
 		hdr->ftrace_too_deep_count++;
@@ -118,7 +117,7 @@ static void __attribute__((no_instrument_function)) add_ftrace(void *func_ptr,
 	hdr->ftrace_count++;
 }
 
-static void __attribute__((no_instrument_function)) add_textbase(void)
+static void notrace add_textbase(void)
 {
 	if (hdr->ftrace_count < hdr->ftrace_size) {
 		struct trace_call *rec = &hdr->ftrace[hdr->ftrace_count];
@@ -139,8 +138,7 @@ static void __attribute__((no_instrument_function)) add_textbase(void)
  * @func_ptr:	pointer to function being entered
  * @caller:	pointer to function which called this function
  */
-void __attribute__((no_instrument_function)) __cyg_profile_func_enter(
-		void *func_ptr, void *caller)
+void notrace __cyg_profile_func_enter(void *func_ptr, void *caller)
 {
 	if (trace_enabled) {
 		int func;
@@ -167,8 +165,7 @@ void __attribute__((no_instrument_function)) __cyg_profile_func_enter(
  * @func_ptr:	pointer to function being entered
  * @caller:	pointer to function which called this function
  */
-void __attribute__((no_instrument_function)) __cyg_profile_func_exit(
-		void *func_ptr, void *caller)
+void notrace __cyg_profile_func_exit(void *func_ptr, void *caller)
 {
 	if (trace_enabled) {
 		trace_swap_gd();
@@ -327,7 +324,7 @@ void trace_print_stats(void)
 	puts(" calls not traced due to depth\n");
 }
 
-void __attribute__((no_instrument_function)) trace_set_enabled(int enabled)
+void notrace trace_set_enabled(int enabled)
 {
 	trace_enabled = enabled != 0;
 }
@@ -339,8 +336,7 @@ void __attribute__((no_instrument_function)) trace_set_enabled(int enabled)
  * @buff_size:	Size of trace buffer
  * Return:	0 if ok
  */
-int __attribute__((no_instrument_function)) trace_init(void *buff,
-		size_t buff_size)
+int notrace trace_init(void *buff, size_t buff_size)
 {
 	ulong func_count = gd->mon_len / FUNC_SITE_SIZE;
 	size_t needed;
@@ -404,7 +400,7 @@ int __attribute__((no_instrument_function)) trace_init(void *buff,
  *
  * Return:	0 if ok, -ENOSPC if not enough memory is available
  */
-int __attribute__((no_instrument_function)) trace_early_init(void)
+int notrace trace_early_init(void)
 {
 	ulong func_count = gd->mon_len / FUNC_SITE_SIZE;
 	size_t buff_size = CONFIG_TRACE_EARLY_SIZE;
-- 
2.39.0.314.g84b9a713c41-goog



More information about the U-Boot mailing list