2014-04-04 06:43:53

by Vincent Stehlé

[permalink] [raw]
Subject: [PATCH] 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é <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: <[email protected]> # 3.10.x
Cc: <[email protected]> # 3.13.x
Cc: <[email protected]> # 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


2014-04-04 23:47:21

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH] topology: Fix compilation warning when not in SMP

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é <[email protected]>
> Cc: Greg Kroah-Hartman <[email protected]>
> Cc: <[email protected]> # 3.10.x
> Cc: <[email protected]> # 3.13.x
> Cc: <[email protected]> # 3.14.x

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

thanks,

greg k-h

2014-04-05 12:30:39

by Vincent Stehlé

[permalink] [raw]
Subject: Re: [PATCH] topology: Fix compilation warning when not in SMP

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.

2014-04-05 17:17:37

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH] topology: Fix compilation warning when not in SMP

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