Skip to contentSkip to conversation

Fix warnings in intel_cacheinfo.c

PATCH In review Eric Sesterhenn / snakebyte 2 participants 2 messages Dec 8, 2005 – Dec 14, 2005 Kernel janitors

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix warnings in intel_cacheinfo.c

This patch fixes two compiler warnings in intel_cacheinfo.c when sysfs is not defined.

---

I hope the patch arrives unmangled and the format and the patch itself are ok. Thanks for reviewing/forwarding.
Eric

arch/i386/kernel/cpu/intel_cacheinfo.c renamed from arch/i386/kernel/cpu/intel_cacheinfo.c.orig +6 -0
@@ -287,10 +287,13 @@ unsigned int __cpuinit init_intel_cachei
 }
 
 /* pointer to _cpuid4_info array (for each cache leaf) */
+#ifdef CONFIG_SYSFS
 static struct _cpuid4_info *cpuid4_info[NR_CPUS];
 #define CPUID4_INFO_IDX(x,y)    (&((cpuid4_info[x])[y]))
+#endif
 
 #ifdef CONFIG_SMP
+#ifdef CONFIG_SYSFS
 static void __cpuinit cache_shared_cpu_map_setup(unsigned int cpu, int index)
 {
 	struct _cpuid4_info	*this_leaf, *sibling_leaf;
@@ -329,11 +332,13 @@ static void __devinit cache_remove_share
 		cpu_clear(cpu, sibling_leaf->shared_cpu_map);
 	}
 }
+#endif
 #else
 static void __init cache_shared_cpu_map_setup(unsigned int cpu, int index) {}
 static void __init cache_remove_shared_cpu_map(unsigned int cpu, int index) {}
 #endif
 
+#ifdef CONFIG_SYSFS
 static void free_cache_attributes(unsigned int cpu)
 {
 	kfree(cpuid4_info[cpu]);
@@ -378,6 +383,7 @@ out:
 		free_cache_attributes(cpu);
 	return retval;
 }
+#endif
 
 #ifdef CONFIG_SYSFS
 

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors

#1 lore raw
Quoted 1 line · Eric Sesterhenn / snakebyte

This patch fixes two compiler warnings in intel_cacheinfo.c when sysfs is not defined.

I think I have a cleaner fix.

---

 arch/i386/kernel/cpu/intel_cacheinfo.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
arch/i386/kernel/cpu/intel_cacheinfo.c +5 -5
@@ -286,6 +286,11 @@ unsigned int __cpuinit init_intel_cachei
 	return l2;
 }
 
+#ifdef CONFIG_SYSFS
+
+#include <linux/kobject.h>
+#include <linux/sysfs.h>
+
 /* pointer to _cpuid4_info array (for each cache leaf) */
 static struct _cpuid4_info *cpuid4_info[NR_CPUS];
 #define CPUID4_INFO_IDX(x,y)    (&((cpuid4_info[x])[y]))
@@ -379,11 +384,6 @@ out:
 	return retval;
 }
 
-#ifdef CONFIG_SYSFS
-
-#include <linux/kobject.h>
-#include <linux/sysfs.h>
-
 extern struct sysdev_class cpu_sysdev_class; /* from drivers/base/cpu.c */
 
 /* pointer to kobject for cpuX/cache */
Quoted 31 lines
arch/i386/kernel/cpu/intel_cacheinfo.c renamed from arch/i386/kernel/cpu/intel_cacheinfo.c.orig +5 -0
@@ -287,10 +287,13 @@ unsigned int __cpuinit init_intel_cachei
 }
 
 /* pointer to _cpuid4_info array (for each cache leaf) */
+#ifdef CONFIG_SYSFS
 static struct _cpuid4_info *cpuid4_info[NR_CPUS];
 #define CPUID4_INFO_IDX(x,y)    (&((cpuid4_info[x])[y]))
+#endif
 
 #ifdef CONFIG_SMP
+#ifdef CONFIG_SYSFS
 static void __cpuinit cache_shared_cpu_map_setup(unsigned int cpu, int index)
 {
 	struct _cpuid4_info	*this_leaf, *sibling_leaf;
@@ -329,11 +332,13 @@ static void __devinit cache_remove_share
 		cpu_clear(cpu, sibling_leaf->shared_cpu_map);
 	}
 }
+#endif
 #else
 static void __init cache_shared_cpu_map_setup(unsigned int cpu, int index) {}
 static void __init cache_remove_shared_cpu_map(unsigned int cpu, int index) {}
 #endif
 
+#ifdef CONFIG_SYSFS
 static void free_cache_attributes(unsigned int cpu)
 {
 	kfree(cpuid4_info[cpu]);

arch/i386/kernel/cpu/intel_cacheinfo.c out: · line 388

Quoted 6 lines
arch/i386/kernel/cpu/intel_cacheinfo.c renamed from arch/i386/kernel/cpu/intel_cacheinfo.c.orig +1 -0
@@ -378,6 +383,7 @@ out:
 		free_cache_attributes(cpu);
 	return retval;
 }
+#endif
 
 #ifdef CONFIG_SYSFS

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors