From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@kernel.org>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Anna-Maria Gleixner <anna-maria@linutronix.de>,
Boris Ostrovsky <boris.ostrovsky@oracle.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rcu: remove unused variable in boot_cpu_state_init
Date: Wed, 21 Jun 2017 15:10:54 -0700 [thread overview]
Message-ID: <20170621221054.GU3721@linux.vnet.ibm.com> (raw)
In-Reply-To: <20170621215741.4028236-1-arnd@arndb.de>
On Wed, Jun 21, 2017 at 11:57:28PM +0200, Arnd Bergmann wrote:
> Without CONFIG_SMP, we get a harmless warning about
> an unused variable:
>
> kernel/cpu.c: In function 'boot_cpu_state_init':
> kernel/cpu.c:1778:6: error: unused variable 'cpu' [-Werror=unused-variable]
>
> This reworks the function to have the declaration inside
> of the #ifdef.
>
> Fixes: faeb334286b7 ("rcu: Migrate callbacks earlier in the CPU-offline timeline")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
I simply added a __maybe_unused in 6441c656acde ("rcu: Migrate callbacks
earlier in the CPU-offline timeline") in my -rcu tree. However, your
approach does have the advantage of complaining if the code using that
variable is removed.
So, would you be OK with my folding your approach into my commit with
attribution?
Thanx, Paul
> ---
> kernel/cpu.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/cpu.c b/kernel/cpu.c
> index f13ad79e785d..9cd4fc35a66f 100644
> --- a/kernel/cpu.c
> +++ b/kernel/cpu.c
> @@ -1775,11 +1775,11 @@ void __init boot_cpu_init(void)
> */
> void __init boot_cpu_state_init(void)
> {
> +#ifdef CONFIG_SMP
> int cpu;
>
> - per_cpu_ptr(&cpuhp_state, smp_processor_id())->state = CPUHP_ONLINE;
> -#ifdef CONFIG_SMP
> for_each_possible_cpu(cpu)
> per_cpu_ptr(&cpuhp_state, cpu)->cpu = cpu;
> #endif
> + per_cpu_ptr(&cpuhp_state, smp_processor_id())->state = CPUHP_ONLINE;
> }
> --
> 2.9.0
>
next prev parent reply other threads:[~2017-06-21 22:11 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-21 21:57 [PATCH] rcu: remove unused variable in boot_cpu_state_init Arnd Bergmann
2017-06-21 22:10 ` Paul E. McKenney [this message]
2017-06-21 22:15 ` Arnd Bergmann
2017-06-22 14:36 ` Paul E. McKenney
2017-06-22 21:10 ` Paul E. McKenney
2017-06-22 7:26 ` Ingo Molnar
2017-06-22 7:41 ` Arnd Bergmann
2017-06-22 7:51 ` Ingo Molnar
2017-06-22 7:54 ` Ingo Molnar
2017-06-22 7:59 ` Ingo Molnar
2017-06-22 8:58 ` Arnd Bergmann
2017-06-22 9:02 ` Ingo Molnar
2017-06-22 9:44 ` Arnd Bergmann
2017-06-22 14:55 ` Paul E. McKenney
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=20170621221054.GU3721@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=anna-maria@linutronix.de \
--cc=arnd@arndb.de \
--cc=bigeasy@linutronix.de \
--cc=boris.ostrovsky@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=tglx@linutronix.de \
/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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).