From nobody Fri Sep 12 20:11:14 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 884E3C636CC for ; Wed, 8 Feb 2023 01:57:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229934AbjBHB5j (ORCPT ); Tue, 7 Feb 2023 20:57:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229731AbjBHB5e (ORCPT ); Tue, 7 Feb 2023 20:57:34 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91D5B3E601 for ; Tue, 7 Feb 2023 17:57:33 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2D02B6147F for ; Wed, 8 Feb 2023 01:57:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B27DC433D2; Wed, 8 Feb 2023 01:57:32 +0000 (UTC) Received: from rostedt by gandalf.local.home with local (Exim 4.96) (envelope-from ) id 1pPZiF-006dPG-25; Tue, 07 Feb 2023 20:57:31 -0500 Message-ID: <20230208015731.460057881@goodmis.org> User-Agent: quilt/0.66 Date: Tue, 07 Feb 2023 20:56:39 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Andrew Morton , Tom Rix , Mark Rutland Subject: [for-next][PATCH 06/11] samples: ftrace: Make some global variables static References: <20230208015633.791198913@goodmis.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Tom Rix smatch reports this representative issue samples/ftrace/ftrace-ops.c:15:14: warning: symbol 'nr_function_calls' was = not declared. Should it be static? The nr_functions_calls and several other global variables are only used in ftrace-ops.c, so they should be static. Remove the instances of initializing static int to 0. Link: https://lore.kernel.org/linux-trace-kernel/20230130193708.1378108-1-t= rix@redhat.com Signed-off-by: Tom Rix Acked-by: Mark Rutland Signed-off-by: Steven Rostedt (Google) --- samples/ftrace/ftrace-ops.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/samples/ftrace/ftrace-ops.c b/samples/ftrace/ftrace-ops.c index 0c8da87ff5c3..68d6685c80bd 100644 --- a/samples/ftrace/ftrace-ops.c +++ b/samples/ftrace/ftrace-ops.c @@ -12,7 +12,7 @@ * Arbitrary large value chosen to be sufficiently large to minimize noise= but * sufficiently small to complete quickly. */ -unsigned int nr_function_calls =3D 100000; +static unsigned int nr_function_calls =3D 100000; module_param(nr_function_calls, uint, 0); MODULE_PARM_DESC(nr_function_calls, "How many times to call the relevant t= racee"); =20 @@ -21,7 +21,7 @@ MODULE_PARM_DESC(nr_function_calls, "How many times to ca= ll the relevant tracee" * be called directly or whether it's necessary to go via the list func, w= hich * can be significantly more expensive. */ -unsigned int nr_ops_relevant =3D 1; +static unsigned int nr_ops_relevant =3D 1; module_param(nr_ops_relevant, uint, 0); MODULE_PARM_DESC(nr_ops_relevant, "How many ftrace_ops to associate with t= he relevant tracee"); =20 @@ -30,7 +30,7 @@ MODULE_PARM_DESC(nr_ops_relevant, "How many ftrace_ops to= associate with the rel * tracers enabled for distinct functions can force the use of the list fu= nc * and incur overhead for all call sites. */ -unsigned int nr_ops_irrelevant =3D 0; +static unsigned int nr_ops_irrelevant; module_param(nr_ops_irrelevant, uint, 0); MODULE_PARM_DESC(nr_ops_irrelevant, "How many ftrace_ops to associate with= the irrelevant tracee"); =20 @@ -38,15 +38,15 @@ MODULE_PARM_DESC(nr_ops_irrelevant, "How many ftrace_op= s to associate with the i * On architectures with DYNAMIC_FTRACE_WITH_REGS, saving the full pt_regs= can * be more expensive than only saving the minimal necessary regs. */ -bool save_regs =3D false; +static bool save_regs; module_param(save_regs, bool, 0); MODULE_PARM_DESC(save_regs, "Register ops with FTRACE_OPS_FL_SAVE_REGS (sa= ve all registers in the trampoline)"); =20 -bool assist_recursion =3D false; +static bool assist_recursion; module_param(assist_recursion, bool, 0); MODULE_PARM_DESC(assist_reursion, "Register ops with FTRACE_OPS_FL_RECURSI= ON"); =20 -bool assist_rcu =3D false; +static bool assist_rcu; module_param(assist_rcu, bool, 0); MODULE_PARM_DESC(assist_reursion, "Register ops with FTRACE_OPS_FL_RCU"); =20 @@ -55,7 +55,7 @@ MODULE_PARM_DESC(assist_reursion, "Register ops with FTRA= CE_OPS_FL_RCU"); * overhead. Sometimes a consistency check using a more expensive tracer is * desireable. */ -bool check_count =3D false; +static bool check_count; module_param(check_count, bool, 0); MODULE_PARM_DESC(check_count, "Check that tracers are called the expected = number of times\n"); =20 @@ -64,7 +64,7 @@ MODULE_PARM_DESC(check_count, "Check that tracers are cal= led the expected number * runs, but sometimes it can be useful to leave them registered so that t= hey * can be inspected through the tracefs 'enabled_functions' file. */ -bool persist =3D false; +static bool persist; module_param(persist, bool, 0); MODULE_PARM_DESC(persist, "Successfully load module and leave ftrace ops r= egistered after test completes\n"); =20 @@ -114,8 +114,8 @@ static void ops_func_count(unsigned long ip, unsigned l= ong parent_ip, self->count++; } =20 -struct sample_ops *ops_relevant; -struct sample_ops *ops_irrelevant; +static struct sample_ops *ops_relevant; +static struct sample_ops *ops_irrelevant; =20 static struct sample_ops *ops_alloc_init(void *tracee, ftrace_func_t func, unsigned long flags, int nr) @@ -163,8 +163,8 @@ static void ops_check(struct sample_ops *ops, int nr, } } =20 -ftrace_func_t tracer_relevant =3D ops_func_nop; -ftrace_func_t tracer_irrelevant =3D ops_func_nop; +static ftrace_func_t tracer_relevant =3D ops_func_nop; +static ftrace_func_t tracer_irrelevant =3D ops_func_nop; =20 static int __init ftrace_ops_sample_init(void) { --=20 2.39.1