public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH -tip] x86: cpu/intel_cacheinfo.c fix compilation warnings
@ 2009-04-14 12:43 Jaswinder Singh Rajput
  2009-04-14 13:32 ` Ingo Molnar
  0 siblings, 1 reply; 4+ messages in thread
From: Jaswinder Singh Rajput @ 2009-04-14 12:43 UTC (permalink / raw)
  To: Ingo Molnar, x86 maintainers, LKML, Mark Langsdorf,
	Andreas Herrmann

fix:
  arch/x86/kernel/cpu/intel_cacheinfo.c: In function ‘show_cache_disable’:
  arch/x86/kernel/cpu/intel_cacheinfo.c:712: warning: unused variable ‘node’
  arch/x86/kernel/cpu/intel_cacheinfo.c: In function ‘store_cache_disable’:
  arch/x86/kernel/cpu/intel_cacheinfo.c:739: warning: unused variable ‘node’

Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
---
 arch/x86/kernel/cpu/intel_cacheinfo.c |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c
index 789efe2..6794d3e 100644
--- a/arch/x86/kernel/cpu/intel_cacheinfo.c
+++ b/arch/x86/kernel/cpu/intel_cacheinfo.c
@@ -708,14 +708,15 @@ static ssize_t show_type(struct _cpuid4_info *this_leaf, char *buf)
 static ssize_t show_cache_disable(struct _cpuid4_info *this_leaf, char *buf,
 				  unsigned int index)
 {
-	int cpu = cpumask_first(to_cpumask(this_leaf->shared_cpu_map));
-	int node = cpu_to_node(cpu);
-	struct pci_dev *dev = node_to_k8_nb_misc(node);
+	struct pci_dev *dev;
 	unsigned int reg = 0;
+	int cpu;
 
 	if (!this_leaf->can_disable)
 		return -EINVAL;
 
+	cpu = cpumask_first(to_cpumask(this_leaf->shared_cpu_map));
+	dev = node_to_k8_nb_misc(cpu_to_node(cpu));
 	if (!dev)
 		return -EINVAL;
 
@@ -735,11 +736,10 @@ SHOW_CACHE_DISABLE(1)
 static ssize_t store_cache_disable(struct _cpuid4_info *this_leaf,
 	const char *buf, size_t count, unsigned int index)
 {
-	int cpu = cpumask_first(to_cpumask(this_leaf->shared_cpu_map));
-	int node = cpu_to_node(cpu);
-	struct pci_dev *dev = node_to_k8_nb_misc(node);
-	unsigned long val = 0;
+	struct pci_dev *dev;
 	unsigned int scrubber = 0;
+	unsigned long val = 0;
+	int cpu;
 
 	if (!this_leaf->can_disable)
 		return -EINVAL;
@@ -747,6 +747,8 @@ static ssize_t store_cache_disable(struct _cpuid4_info *this_leaf,
 	if (!capable(CAP_SYS_ADMIN))
 		return -EPERM;
 
+	cpu = cpumask_first(to_cpumask(this_leaf->shared_cpu_map));
+	dev = node_to_k8_nb_misc(cpu_to_node(cpu));
 	if (!dev)
 		return -EINVAL;
 
-- 
1.6.0.6




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

* Re: [PATCH -tip] x86: cpu/intel_cacheinfo.c fix compilation warnings
  2009-04-14 12:43 [PATCH -tip] x86: cpu/intel_cacheinfo.c fix compilation warnings Jaswinder Singh Rajput
@ 2009-04-14 13:32 ` Ingo Molnar
  2009-04-14 16:46   ` Jaswinder Singh Rajput
  0 siblings, 1 reply; 4+ messages in thread
From: Ingo Molnar @ 2009-04-14 13:32 UTC (permalink / raw)
  To: Jaswinder Singh Rajput
  Cc: x86 maintainers, LKML, Mark Langsdorf, Andreas Herrmann


* Jaswinder Singh Rajput <jaswinder@kernel.org> wrote:

> fix:
>   arch/x86/kernel/cpu/intel_cacheinfo.c: In function ‘show_cache_disable’:
>   arch/x86/kernel/cpu/intel_cacheinfo.c:712: warning: unused variable ‘node’
>   arch/x86/kernel/cpu/intel_cacheinfo.c: In function ‘store_cache_disable’:
>   arch/x86/kernel/cpu/intel_cacheinfo.c:739: warning: unused variable ‘node’

you again 'fixed' a warning.

this made you fail to analyze and miss the real reason for this for 
example:

>   arch/x86/kernel/cpu/intel_cacheinfo.c:739: warning: unused variable ‘node’

> -	int node = cpu_to_node(cpu);

the local variable is clearly initialized.

The problem is not with that variable - the problem is most likely 
with the cpu_to_node() macro not creating a reference to the 'cpu' 
variable in a compiler-visible way, in the !NUMA case.

The typical way to solve this is to add a dummy:

	(void)(cpu)

use to the 'cpu' parameter to the macro definition - or, (which is a 
much better solution), to convert it to an inline function.

	Ingo

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

* Re: [PATCH -tip] x86: cpu/intel_cacheinfo.c fix compilation warnings
  2009-04-14 13:32 ` Ingo Molnar
@ 2009-04-14 16:46   ` Jaswinder Singh Rajput
  2009-04-14 16:54     ` Ingo Molnar
  0 siblings, 1 reply; 4+ messages in thread
From: Jaswinder Singh Rajput @ 2009-04-14 16:46 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: x86 maintainers, LKML, Mark Langsdorf, Andreas Herrmann

On Tue, 2009-04-14 at 15:32 +0200, Ingo Molnar wrote:
> * Jaswinder Singh Rajput <jaswinder@kernel.org> wrote:
> 
> > fix:
> >   arch/x86/kernel/cpu/intel_cacheinfo.c: In function ‘show_cache_disable’:
> >   arch/x86/kernel/cpu/intel_cacheinfo.c:712: warning: unused variable ‘node’
> >   arch/x86/kernel/cpu/intel_cacheinfo.c: In function ‘store_cache_disable’:
> >   arch/x86/kernel/cpu/intel_cacheinfo.c:739: warning: unused variable ‘node’
> 
> you again 'fixed' a warning.
> 
> this made you fail to analyze and miss the real reason for this for 
> example:
> 
> >   arch/x86/kernel/cpu/intel_cacheinfo.c:739: warning: unused variable ‘node’
> 
> > -	int node = cpu_to_node(cpu);
> 
> the local variable is clearly initialized.
> 
> The problem is not with that variable - the problem is most likely 
> with the cpu_to_node() macro not creating a reference to the 'cpu' 
> variable in a compiler-visible way, in the !NUMA case.
> 
> The typical way to solve this is to add a dummy:
> 
> 	(void)(cpu)
> 
> use to the 'cpu' parameter to the macro definition - or, (which is a 
> much better solution), to convert it to an inline function.
> 

OK send patch:
[PATCH -tip] x86: k8.h reference to node in node_to_k8_nb_misc for !CONFIG_K8_NB

Thanks,

--
JSR


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

* Re: [PATCH -tip] x86: cpu/intel_cacheinfo.c fix compilation warnings
  2009-04-14 16:46   ` Jaswinder Singh Rajput
@ 2009-04-14 16:54     ` Ingo Molnar
  0 siblings, 0 replies; 4+ messages in thread
From: Ingo Molnar @ 2009-04-14 16:54 UTC (permalink / raw)
  To: Jaswinder Singh Rajput
  Cc: x86 maintainers, LKML, Mark Langsdorf, Andreas Herrmann


* Jaswinder Singh Rajput <jaswinder@kernel.org> wrote:

> On Tue, 2009-04-14 at 15:32 +0200, Ingo Molnar wrote:
> > * Jaswinder Singh Rajput <jaswinder@kernel.org> wrote:
> > 
> > > fix:
> > >   arch/x86/kernel/cpu/intel_cacheinfo.c: In function ‘show_cache_disable’:
> > >   arch/x86/kernel/cpu/intel_cacheinfo.c:712: warning: unused variable ‘node’
> > >   arch/x86/kernel/cpu/intel_cacheinfo.c: In function ‘store_cache_disable’:
> > >   arch/x86/kernel/cpu/intel_cacheinfo.c:739: warning: unused variable ‘node’
> > 
> > you again 'fixed' a warning.
> > 
> > this made you fail to analyze and miss the real reason for this for 
> > example:
> > 
> > >   arch/x86/kernel/cpu/intel_cacheinfo.c:739: warning: unused variable ‘node’
> > 
> > > -	int node = cpu_to_node(cpu);
> > 
> > the local variable is clearly initialized.
> > 
> > The problem is not with that variable - the problem is most likely 
> > with the cpu_to_node() macro not creating a reference to the 'cpu' 
> > variable in a compiler-visible way, in the !NUMA case.
> > 
> > The typical way to solve this is to add a dummy:
> > 
> > 	(void)(cpu)
> > 
> > use to the 'cpu' parameter to the macro definition - or, (which is a 
> > much better solution), to convert it to an inline function.
> > 
> 
> OK send patch:
> [PATCH -tip] x86: k8.h reference to node in node_to_k8_nb_misc for !CONFIG_K8_NB

You sent a patch, but did you read+understand the 
suggestions i made above?

	Ingo

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

end of thread, other threads:[~2009-04-14 16:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-14 12:43 [PATCH -tip] x86: cpu/intel_cacheinfo.c fix compilation warnings Jaswinder Singh Rajput
2009-04-14 13:32 ` Ingo Molnar
2009-04-14 16:46   ` Jaswinder Singh Rajput
2009-04-14 16:54     ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox