Skip to content

Commit f94fe70

Browse files
arndbrostedt
authored andcommitted
ftrace: sample: avoid open-coded 64-bit division
Calculating the average period requires a 64-bit division that leads to a link failure on 32-bit architectures: x86_64-linux-ld: samples/ftrace/ftrace-ops.o: in function `ftrace_ops_sample_init': ftrace-ops.c:(.init.text+0x23b): undefined reference to `__udivdi3' Use the div_u64() helper to do this instead. Since this is an init function that is not called frequently, the runtime overhead is going to be acceptable. Link: https://lore.kernel.org/linux-trace-kernel/[email protected] Cc: Masami Hiramatsu <[email protected]> Fixes: b56c68f ("ftrace: Add sample with custom ops") Signed-off-by: Arnd Bergmann <[email protected]> Acked-by: Mark Rutland <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 parent 01678fb commit f94fe70

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

samples/ftrace/ftrace-ops.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ static int __init ftrace_ops_sample_init(void)
223223

224224
pr_info("Attempted %u calls to %ps in %lluns (%lluns / call)\n",
225225
nr_function_calls, tracee_relevant,
226-
period, period / nr_function_calls);
226+
period, div_u64(period, nr_function_calls));
227227

228228
if (persist)
229229
return 0;

0 commit comments

Comments
 (0)