[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200825113033.GW1891694@smile.fi.intel.com>
Date: Tue, 25 Aug 2020 14:30:33 +0300
From: 'Andy Shevchenko' <andriy.shevchenko@...ux.intel.com>
To: David Laight <David.Laight@...lab.com>
Cc: Valentin Schneider <valentin.schneider@....com>,
Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Vincent Guittot <vincent.guittot@...aro.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Dietmar Eggemann <dietmar.eggemann@....com>
Subject: Re: [PATCH v1] sched/topology: Make compiler happy about unused
constant definitions
On Tue, Aug 25, 2020 at 10:23:05AM +0000, David Laight wrote:
> From: Andy Shevchenko
> > Sent: 25 August 2020 09:27
> > On Mon, Aug 24, 2020 at 06:09:41PM +0100, Valentin Schneider wrote:
> > > On 24/08/20 16:39, Andy Shevchenko wrote:
> > > > Compilation of almost each file ends up with
> > > >
> > > > In file included from .../include/linux/energy_model.h:10,
> > > > from .../include/linux/device.h:16,
> > > > from .../drivers/spi/spi.c:8:
> > > > .../include/linux/sched/topology.h:30:27: warning: ‘SD_DEGENERATE_GROUPS_MASK’ defined but not
> > used [-Wunused-const-variable=]
> > > > 30 | static const unsigned int SD_DEGENERATE_GROUPS_MASK =
> > > > | ^~~~~~~~~~~~~~~~~~~~~~~~~
> > > > ...
> > > >
> > > > Make compiler happy by annotating the static constants with __maybwe_unused.
> > > >
> > >
> > > That should see some use as long as the build is for SMP. This whole region
> > > is guarded by #ifdef CONFIG_SMP, so an !SMP build shouldn't trigger this.
> >
> > Isn't SMP is default for most of the kernel builds?
> > And honestly I didn't get the purpose of this comment.
>
> The real fix is to not use 'static const' in C.
> IIRC it is still a memory location (that can be patched) not
> a compile time constant.
Yep. The topology.h can be rather split to topology.c with exported symbols
(exported or just visible for linker, depends on the case).
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists