[PATCH] topology: Fix compilation warning when not in SMP

From: Vincent StehlÃ
Date: Fri Apr 04 2014 - 02:43:58 EST


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@xxxxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
Cc: <stable@xxxxxxxxxxxxxxx> # 3.10.x
Cc: <stable@xxxxxxxxxxxxxxx> # 3.13.x
Cc: <stable@xxxxxxxxxxxxxxx> # 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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/