linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] topology: Fix compilation warning when not in SMP
@ 2014-04-04  6:43 Vincent Stehlé
  2014-04-04 23:49 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 4+ messages in thread
From: Vincent Stehlé @ 2014-04-04  6:43 UTC (permalink / raw)
  To: linux-kernel, linux-next, stable; +Cc: Vincent Stehlé, Greg Kroah-Hartman

The topology_##name() macro does not use its argument when CONFIG_SMP is not
set, as it ultimately calls the cpu_data() macro.

So we avoid maintaining a possibly unused `cpu' variable, to avoid the
following compilation warning:

  drivers/base/topology.c: In function ‘show_physical_package_id’:
  drivers/base/topology.c:103:118: warning: unused variable ‘cpu’ [-Wunused-variable]
   define_id_show_func(physical_package_id);

  drivers/base/topology.c: In function ‘show_core_id’:
  drivers/base/topology.c:106:106: warning: unused variable ‘cpu’ [-Wunused-variable]
   define_id_show_func(core_id);

This can be seen with e.g. x86 defconfig and CONFIG_SMP not set.

Signed-off-by: Vincent Stehlé <vincent.stehle@laposte.net>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: <stable@vger.kernel.org> # 3.10.x
Cc: <stable@vger.kernel.org> # 3.13.x
Cc: <stable@vger.kernel.org> # 3.14.x
---
 drivers/base/topology.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/base/topology.c b/drivers/base/topology.c
index ad9d177..c928576 100644
--- a/drivers/base/topology.c
+++ b/drivers/base/topology.c
@@ -39,8 +39,7 @@
 static ssize_t show_##name(struct device *dev,			\
 		struct device_attribute *attr, char *buf)	\
 {								\
-	unsigned int cpu = dev->id;				\
-	return sprintf(buf, "%d\n", topology_##name(cpu));	\
+	return sprintf(buf, "%d\n", topology_##name(dev->id));	\
 }
 
 #if defined(topology_thread_cpumask) || defined(topology_core_cpumask) || \
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] topology: Fix compilation warning when not in SMP
  2014-04-04  6:43 [PATCH] topology: Fix compilation warning when not in SMP Vincent Stehlé
@ 2014-04-04 23:49 ` Greg Kroah-Hartman
  2014-04-05 12:30   ` Vincent
  0 siblings, 1 reply; 4+ messages in thread
From: Greg Kroah-Hartman @ 2014-04-04 23:49 UTC (permalink / raw)
  To: Vincent Stehlé; +Cc: linux-kernel, linux-next, stable

On Fri, Apr 04, 2014 at 08:43:18AM +0200, Vincent Stehlé wrote:
> The topology_##name() macro does not use its argument when CONFIG_SMP is not
> set, as it ultimately calls the cpu_data() macro.
> 
> So we avoid maintaining a possibly unused `cpu' variable, to avoid the
> following compilation warning:
> 
>   drivers/base/topology.c: In function ‘show_physical_package_id’:
>   drivers/base/topology.c:103:118: warning: unused variable ‘cpu’ [-Wunused-variable]
>    define_id_show_func(physical_package_id);
> 
>   drivers/base/topology.c: In function ‘show_core_id’:
>   drivers/base/topology.c:106:106: warning: unused variable ‘cpu’ [-Wunused-variable]
>    define_id_show_func(core_id);
> 
> This can be seen with e.g. x86 defconfig and CONFIG_SMP not set.
> 
> Signed-off-by: Vincent Stehlé <vincent.stehle@laposte.net>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: <stable@vger.kernel.org> # 3.10.x
> Cc: <stable@vger.kernel.org> # 3.13.x
> Cc: <stable@vger.kernel.org> # 3.14.x

Warnings aren't a stable kernel issue, so why would this be relevant
there?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] topology: Fix compilation warning when not in SMP
  2014-04-04 23:49 ` Greg Kroah-Hartman
@ 2014-04-05 12:30   ` Vincent
  2014-04-05 17:20     ` Greg Kroah-Hartman
  0 siblings, 1 reply; 4+ messages in thread
From: Vincent @ 2014-04-05 12:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, linux-next

On 04/05/2014 01:49 AM, Greg Kroah-Hartman wrote:
> Warnings aren't a stable kernel issue, so why would this be relevant
> there?

Oh, sorry about that. I'll go re-read the stable kernel rules again.

Shall I re-post without the stable Cc:, for only mainline and next?

Best regards,

V.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] topology: Fix compilation warning when not in SMP
  2014-04-05 12:30   ` Vincent
@ 2014-04-05 17:20     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2014-04-05 17:20 UTC (permalink / raw)
  To: Vincent; +Cc: linux-kernel, linux-next

On Sat, Apr 05, 2014 at 02:30:27PM +0200, Vincent wrote:
> On 04/05/2014 01:49 AM, Greg Kroah-Hartman wrote:
> > Warnings aren't a stable kernel issue, so why would this be relevant
> > there?
> 
> Oh, sorry about that. I'll go re-read the stable kernel rules again.
> 
> Shall I re-post without the stable Cc:, for only mainline and next?

No need, I'll just remove them when I apply the patch.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-04-05 17:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-04  6:43 [PATCH] topology: Fix compilation warning when not in SMP Vincent Stehlé
2014-04-04 23:49 ` Greg Kroah-Hartman
2014-04-05 12:30   ` Vincent
2014-04-05 17:20     ` Greg Kroah-Hartman

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).