Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

topology: Fix compilation warning when not in SMP

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
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Vincent Stehlé and committed by
Greg Kroah-Hartman
53974e06 06d96c0f

+1 -2
+1 -2
drivers/base/topology.c
··· 39 39 static ssize_t show_##name(struct device *dev, \ 40 40 struct device_attribute *attr, char *buf) \ 41 41 { \ 42 - unsigned int cpu = dev->id; \ 43 - return sprintf(buf, "%d\n", topology_##name(cpu)); \ 42 + return sprintf(buf, "%d\n", topology_##name(dev->id)); \ 44 43 } 45 44 46 45 #if defined(topology_thread_cpumask) || defined(topology_core_cpumask) || \