mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/1] Restrict definitions of a couple of static functions
@ 2009-03-21 14:15 Dmitri Vorobiev
  2009-03-21 14:40 ` Ingo Molnar
  0 siblings, 1 reply; 2+ messages in thread
From: Dmitri Vorobiev @ 2009-03-21 14:15 UTC (permalink / raw)
  To: mingo, akpm, linux-kernel; +Cc: Dmitri Vorobiev

The call sites of the static functions free_cache_attributes() and
detect_cache_attributes() in arch/x86/kernel/cpu/intel_cacheinfo.c
are placed under #ifdef CONFIG_SYSFS/#endif, but their definitions
are not. This may produce the following warning:

arch/x86/kernel/cpu/intel_cacheinfo.c:542: warning:
'free_cache_attributes' defined but not used
arch/x86/kernel/cpu/intel_cacheinfo.c:573: warning:
'detect_cache_attributes' defined but not used

This patch fixes the warning by restricting the definitions of the
two functions to the case when CONFIG_SYSFS is enabled.

Signed-off-by: Dmitri Vorobiev <dmitri.vorobiev@movial.com>
---
 arch/x86/kernel/cpu/intel_cacheinfo.c |   64 ++++++++++++++++----------------
 1 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c
index da299eb..f04d351 100644
--- a/arch/x86/kernel/cpu/intel_cacheinfo.c
+++ b/arch/x86/kernel/cpu/intel_cacheinfo.c
@@ -538,17 +538,6 @@ static void __cpuinit cache_shared_cpu_map_setup(unsigned int cpu, int index) {}
 static void __cpuinit cache_remove_shared_cpu_map(unsigned int cpu, int index) {}
 #endif
 
-static void __cpuinit free_cache_attributes(unsigned int cpu)
-{
-	int i;
-
-	for (i = 0; i < num_cache_leaves; i++)
-		cache_remove_shared_cpu_map(cpu, i);
-
-	kfree(per_cpu(cpuid4_info, cpu));
-	per_cpu(cpuid4_info, cpu) = NULL;
-}
-
 static void __cpuinit get_cpu_leaves(void *_retval)
 {
 	int j, *retval = _retval, cpu = smp_processor_id();
@@ -569,27 +558,6 @@ static void __cpuinit get_cpu_leaves(void *_retval)
 	}
 }
 
-static int __cpuinit detect_cache_attributes(unsigned int cpu)
-{
-	int			retval;
-
-	if (num_cache_leaves == 0)
-		return -ENOENT;
-
-	per_cpu(cpuid4_info, cpu) = kzalloc(
-	    sizeof(struct _cpuid4_info) * num_cache_leaves, GFP_KERNEL);
-	if (per_cpu(cpuid4_info, cpu) == NULL)
-		return -ENOMEM;
-
-	smp_call_function_single(cpu, get_cpu_leaves, &retval, true);
-	if (retval) {
-		kfree(per_cpu(cpuid4_info, cpu));
-		per_cpu(cpuid4_info, cpu) = NULL;
-	}
-
-	return retval;
-}
-
 #ifdef CONFIG_SYSFS
 
 #include <linux/kobject.h>
@@ -840,6 +808,38 @@ static struct kobj_type ktype_percpu_entry = {
 	.sysfs_ops	= &sysfs_ops,
 };
 
+static void __cpuinit free_cache_attributes(unsigned int cpu)
+{
+	int i;
+
+	for (i = 0; i < num_cache_leaves; i++)
+		cache_remove_shared_cpu_map(cpu, i);
+
+	kfree(per_cpu(cpuid4_info, cpu));
+	per_cpu(cpuid4_info, cpu) = NULL;
+}
+
+static int __cpuinit detect_cache_attributes(unsigned int cpu)
+{
+	int			retval;
+
+	if (num_cache_leaves == 0)
+		return -ENOENT;
+
+	per_cpu(cpuid4_info, cpu) = kzalloc(
+	    sizeof(struct _cpuid4_info) * num_cache_leaves, GFP_KERNEL);
+	if (per_cpu(cpuid4_info, cpu) == NULL)
+		return -ENOMEM;
+
+	smp_call_function_single(cpu, get_cpu_leaves, &retval, true);
+	if (retval) {
+		kfree(per_cpu(cpuid4_info, cpu));
+		per_cpu(cpuid4_info, cpu) = NULL;
+	}
+
+	return retval;
+}
+
 static void __cpuinit cpuid4_cache_sysfs_exit(unsigned int cpu)
 {
 	kfree(per_cpu(cache_kobject, cpu));
-- 
1.5.6.3


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

* Re: [PATCH 1/1] Restrict definitions of a couple of static functions
  2009-03-21 14:15 [PATCH 1/1] Restrict definitions of a couple of static functions Dmitri Vorobiev
@ 2009-03-21 14:40 ` Ingo Molnar
  0 siblings, 0 replies; 2+ messages in thread
From: Ingo Molnar @ 2009-03-21 14:40 UTC (permalink / raw)
  To: Dmitri Vorobiev; +Cc: akpm, linux-kernel


* Dmitri Vorobiev <dmitri.vorobiev@movial.com> wrote:

> The call sites of the static functions free_cache_attributes() and
> detect_cache_attributes() in arch/x86/kernel/cpu/intel_cacheinfo.c
> are placed under #ifdef CONFIG_SYSFS/#endif, but their definitions
> are not. This may produce the following warning:
> 
> arch/x86/kernel/cpu/intel_cacheinfo.c:542: warning:
> 'free_cache_attributes' defined but not used
> arch/x86/kernel/cpu/intel_cacheinfo.c:573: warning:
> 'detect_cache_attributes' defined but not used
> 
> This patch fixes the warning by restricting the definitions of the
> two functions to the case when CONFIG_SYSFS is enabled.
> 
> Signed-off-by: Dmitri Vorobiev <dmitri.vorobiev@movial.com>
> ---
>  arch/x86/kernel/cpu/intel_cacheinfo.c |   64 ++++++++++++++++----------------
>  1 files changed, 32 insertions(+), 32 deletions(-)

does not apply to the latest x86 tree anymore:

  http://people.redhat.com/mingo/tip.git/README

2 out of 3 hunks FAILED -- rejects in file arch/x86/kernel/cpu/intel_cacheinfo.c

	Ingo

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

end of thread, other threads:[~2009-03-21 14:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-21 14:15 [PATCH 1/1] Restrict definitions of a couple of static functions Dmitri Vorobiev
2009-03-21 14:40 ` Ingo Molnar

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

all inboxes | Powered by JetHome®