From: Mark Rutland <mark.rutland@arm.com> To: Jason Wang <wangborong@cdjrlc.com> Cc: will@kernel.org, catalin.marinas@arm.com, peterz@infradead.org, mingo@redhat.com, acme@kernel.org, alexander.shishkin@linux.intel.com, jolsa@kernel.org, namhyung@kernel.org, linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] arm64: perf: no need to initialise statics to 0 Date: Mon, 9 May 2022 09:45:30 +0100 [thread overview] Message-ID: <YnjUqm3lu75+LjqH@FVFF77S0Q05N> (raw) In-Reply-To: <20220508022312.93905-1-wangborong@cdjrlc.com> On Sun, May 08, 2022 at 10:23:12AM +0800, Jason Wang wrote: > Static variables do not need to be initialised to 0, because compiler > will initialise all uninitialised statics to 0. Thus, remove the > unneeded initializations. > > Signed-off-by: Jason Wang <wangborong@cdjrlc.com> I would strongly prefer that we leave this as-is. There is no problem with explicitly initializing a static variable to 0, and it clearly aligns with the cmpxchg arguments below. Removing the initialization makes that *less* clear. Thanks, Mark. > --- > arch/arm64/kernel/perf_event.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c > index cb69ff1e6138..919fdcf8fce6 100644 > --- a/arch/arm64/kernel/perf_event.c > +++ b/arch/arm64/kernel/perf_event.c > @@ -1226,7 +1226,7 @@ static struct ctl_table armv8_pmu_sysctl_table[] = { > > static void armv8_pmu_register_sysctl_table(void) > { > - static u32 tbl_registered = 0; > + static u32 tbl_registered; > > if (!cmpxchg_relaxed(&tbl_registered, 0, 1)) > register_sysctl("kernel", armv8_pmu_sysctl_table); > -- > 2.35.1 > > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
WARNING: multiple messages have this Message-ID (diff)
From: Mark Rutland <mark.rutland@arm.com> To: Jason Wang <wangborong@cdjrlc.com> Cc: will@kernel.org, catalin.marinas@arm.com, peterz@infradead.org, mingo@redhat.com, acme@kernel.org, alexander.shishkin@linux.intel.com, jolsa@kernel.org, namhyung@kernel.org, linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] arm64: perf: no need to initialise statics to 0 Date: Mon, 9 May 2022 09:45:30 +0100 [thread overview] Message-ID: <YnjUqm3lu75+LjqH@FVFF77S0Q05N> (raw) In-Reply-To: <20220508022312.93905-1-wangborong@cdjrlc.com> On Sun, May 08, 2022 at 10:23:12AM +0800, Jason Wang wrote: > Static variables do not need to be initialised to 0, because compiler > will initialise all uninitialised statics to 0. Thus, remove the > unneeded initializations. > > Signed-off-by: Jason Wang <wangborong@cdjrlc.com> I would strongly prefer that we leave this as-is. There is no problem with explicitly initializing a static variable to 0, and it clearly aligns with the cmpxchg arguments below. Removing the initialization makes that *less* clear. Thanks, Mark. > --- > arch/arm64/kernel/perf_event.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c > index cb69ff1e6138..919fdcf8fce6 100644 > --- a/arch/arm64/kernel/perf_event.c > +++ b/arch/arm64/kernel/perf_event.c > @@ -1226,7 +1226,7 @@ static struct ctl_table armv8_pmu_sysctl_table[] = { > > static void armv8_pmu_register_sysctl_table(void) > { > - static u32 tbl_registered = 0; > + static u32 tbl_registered; > > if (!cmpxchg_relaxed(&tbl_registered, 0, 1)) > register_sysctl("kernel", armv8_pmu_sysctl_table); > -- > 2.35.1 > >
next prev parent reply other threads:[~2022-05-09 8:46 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-05-08 2:23 [PATCH] arm64: perf: no need to initialise statics to 0 Jason Wang 2022-05-09 8:45 ` Mark Rutland [this message] 2022-05-09 8:45 ` Mark Rutland
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=YnjUqm3lu75+LjqH@FVFF77S0Q05N \ --to=mark.rutland@arm.com \ --cc=acme@kernel.org \ --cc=alexander.shishkin@linux.intel.com \ --cc=catalin.marinas@arm.com \ --cc=jolsa@kernel.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-perf-users@vger.kernel.org \ --cc=mingo@redhat.com \ --cc=namhyung@kernel.org \ --cc=peterz@infradead.org \ --cc=wangborong@cdjrlc.com \ --cc=will@kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.