Skip to content

Commit 1c39d76

Browse files
nickdesaulniersrostedt
authored andcommitted
tracepoint: Use __used attribute definitions from compiler_attributes.h
Just a small cleanup while I was touching this header. compiler_attributes.h does feature detection of these __attributes__(()) and provides more concise ways to invoke them. Link: https://lkml.kernel.org/r/[email protected] Acked-by: Miguel Ojeda <[email protected]> Signed-off-by: Nick Desaulniers <[email protected]> Signed-off-by: Steven Rostedt (VMware) <[email protected]>
1 parent f3751ad commit 1c39d76

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

include/linux/tracepoint.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,7 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)
116116

117117
#define __TRACEPOINT_ENTRY(name) \
118118
static tracepoint_ptr_t __tracepoint_ptr_##name __used \
119-
__attribute__((section("__tracepoints_ptrs"))) = \
120-
&__tracepoint_##name
119+
__section(__tracepoints_ptrs) = &__tracepoint_##name
121120
#endif
122121

123122
#endif /* _LINUX_TRACEPOINT_H */
@@ -280,9 +279,9 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)
280279
*/
281280
#define DEFINE_TRACE_FN(name, reg, unreg) \
282281
static const char __tpstrtab_##name[] \
283-
__attribute__((section("__tracepoints_strings"))) = #name; \
284-
struct tracepoint __tracepoint_##name \
285-
__attribute__((section("__tracepoints"), used)) = \
282+
__section(__tracepoints_strings) = #name; \
283+
struct tracepoint __tracepoint_##name __used \
284+
__section(__tracepoints) = \
286285
{ __tpstrtab_##name, STATIC_KEY_INIT_FALSE, reg, unreg, NULL };\
287286
__TRACEPOINT_ENTRY(name);
288287

@@ -361,7 +360,7 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)
361360
static const char *___tp_str __tracepoint_string = str; \
362361
___tp_str; \
363362
})
364-
#define __tracepoint_string __attribute__((section("__tracepoint_str"), used))
363+
#define __tracepoint_string __used __section(__tracepoint_str)
365364
#else
366365
/*
367366
* tracepoint_string() is used to save the string address for userspace

0 commit comments

Comments
 (0)