FIXME: Do gently via topology_core_cpumask()/topology_thread_cpumask()
cpumask: convert topology_xxx_siblings

Convert topology_xxx_siblings to use struct cpumask.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Mike Travis <travis@sgi.com>
---
 arch/ia64/include/asm/topology.h     |    4 ++--
 arch/powerpc/include/asm/topology.h  |    4 ++--
 arch/s390/include/asm/topology.h     |    2 +-
 arch/sparc/include/asm/topology_64.h |    4 ++--
 arch/x86/include/asm/topology.h      |    4 ++--
 drivers/base/topology.c              |   14 +++++---------
 include/linux/topology.h             |    4 ++--
 7 files changed, 16 insertions(+), 20 deletions(-)

--- linux-2.6.28.orig/arch/ia64/include/asm/topology.h
+++ linux-2.6.28/arch/ia64/include/asm/topology.h
@@ -109,8 +109,8 @@ void build_cpu_to_node_map(void);
 #ifdef CONFIG_SMP
 #define topology_physical_package_id(cpu)	(cpu_data(cpu)->socket_id)
 #define topology_core_id(cpu)			(cpu_data(cpu)->core_id)
-#define topology_core_siblings(cpu)		(cpu_core_map[cpu])
-#define topology_thread_siblings(cpu)		(per_cpu(cpu_sibling_map, cpu))
+#define topology_core_siblings(cpu)		(&cpu_core_map[cpu])
+#define topology_thread_siblings(cpu)		(&per_cpu(cpu_sibling_map, cpu))
 #define smt_capable() 				(smp_num_siblings > 1)
 #endif
 
--- linux-2.6.28.orig/arch/powerpc/include/asm/topology.h
+++ linux-2.6.28/arch/powerpc/include/asm/topology.h
@@ -105,8 +105,8 @@ static inline void sysfs_remove_device_f
 #ifdef CONFIG_PPC64
 #include <asm/smp.h>
 
-#define topology_thread_siblings(cpu)	(per_cpu(cpu_sibling_map, cpu))
-#define topology_core_siblings(cpu)	(per_cpu(cpu_core_map, cpu))
+#define topology_thread_siblings(cpu)	(&per_cpu(cpu_sibling_map, cpu))
+#define topology_core_siblings(cpu)	(&per_cpu(cpu_core_map, cpu))
 #define topology_core_id(cpu)		(cpu_to_core_id(cpu))
 #endif
 #endif
--- linux-2.6.28.orig/arch/s390/include/asm/topology.h
+++ linux-2.6.28/arch/s390/include/asm/topology.h
@@ -9,7 +9,7 @@ const struct cpumask *cpu_coregroup_map(
 
 extern cpumask_t cpu_core_map[NR_CPUS];
 
-#define topology_core_siblings(cpu)	(cpu_core_map[cpu])
+#define topology_core_siblings(cpu)	(&cpu_core_map[cpu])
 
 int topology_set_cpu_management(int fc);
 void topology_schedule_update(void);
--- linux-2.6.28.orig/arch/sparc/include/asm/topology_64.h
+++ linux-2.6.28/arch/sparc/include/asm/topology_64.h
@@ -66,8 +66,8 @@ static inline int pcibus_to_node(struct 
 #ifdef CONFIG_SMP
 #define topology_physical_package_id(cpu)	(cpu_data(cpu).proc_id)
 #define topology_core_id(cpu)			(cpu_data(cpu).core_id)
-#define topology_core_siblings(cpu)		(cpu_core_map[cpu])
-#define topology_thread_siblings(cpu)		(per_cpu(cpu_sibling_map, cpu))
+#define topology_core_siblings(cpu)		(&cpu_core_map[cpu])
+#define topology_thread_siblings(cpu)		(&per_cpu(cpu_sibling_map, cpu))
 #define mc_capable()				(sparc64_multi_core)
 #define smt_capable()				(sparc64_multi_core)
 #endif /* CONFIG_SMP */
--- linux-2.6.28.orig/drivers/base/topology.c
+++ linux-2.6.28/drivers/base/topology.c
@@ -42,7 +42,7 @@ static ssize_t show_##name(struct sys_de
 }
 
 #if defined(topology_thread_siblings) || defined(topology_core_siblings)
-static ssize_t show_cpumap(int type, cpumask_t *mask, char *buf)
+static ssize_t show_cpumap(int type, const struct cpumask *mask, char *buf)
 {
 	ptrdiff_t len = PTR_ALIGN(buf + PAGE_SIZE - 1, PAGE_SIZE) - buf;
 	int n = 0;
@@ -64,7 +64,7 @@ static ssize_t show_##name(struct sys_de
 			   struct sysdev_attribute *attr, char *buf)	\
 {									\
 	unsigned int cpu = dev->id;					\
-	return show_cpumap(0, &(topology_##name(cpu)), buf);		\
+	return show_cpumap(0, topology_##name(cpu), buf);		\
 }
 
 #define define_siblings_show_list(name)					\
@@ -73,7 +73,7 @@ static ssize_t show_##name##_list(struct
 				  char *buf)				\
 {									\
 	unsigned int cpu = dev->id;					\
-	return show_cpumap(1, &(topology_##name(cpu)), buf);		\
+	return show_cpumap(1, topology_##name(cpu), buf);		\
 }
 
 #else
@@ -81,9 +81,7 @@ static ssize_t show_##name##_list(struct
 static ssize_t show_##name(struct sys_device *dev,			\
 			   struct sysdev_attribute *attr, char *buf)	\
 {									\
-	unsigned int cpu = dev->id;					\
-	cpumask_t mask = topology_##name(cpu);				\
-	return show_cpumap(0, &mask, buf);				\
+	return show_cpumap(0, topology_##name(dev->id), buf);		\
 }
 
 #define define_siblings_show_list(name)					\
@@ -91,9 +89,7 @@ static ssize_t show_##name##_list(struct
 				  struct sysdev_attribute *attr,	\
 				  char *buf)				\
 {									\
-	unsigned int cpu = dev->id;					\
-	cpumask_t mask = topology_##name(cpu);				\
-	return show_cpumap(1, &mask, buf);				\
+	return show_cpumap(1, topology_##name(dev->id), buf);		\
 }
 #endif
 
--- linux-2.6.28.orig/arch/x86/include/asm/topology.h
+++ linux-2.6.28/arch/x86/include/asm/topology.h
@@ -181,8 +181,8 @@ extern const struct cpumask *cpu_coregro
 #ifdef ENABLE_TOPO_DEFINES
 #define topology_physical_package_id(cpu)	(cpu_data(cpu).phys_proc_id)
 #define topology_core_id(cpu)			(cpu_data(cpu).cpu_core_id)
-#define topology_core_siblings(cpu)		(per_cpu(cpu_core_map, cpu))
-#define topology_thread_siblings(cpu)		(per_cpu(cpu_sibling_map, cpu))
+#define topology_core_siblings(cpu)		(&per_cpu(cpu_core_map, cpu))
+#define topology_thread_siblings(cpu)		(&per_cpu(cpu_sibling_map, cpu))
 
 /* indicates that pointers to the topology cpumask_t maps are valid */
 #define arch_provides_topology_pointers		yes
--- linux-2.6.28.orig/include/linux/topology.h
+++ linux-2.6.28/include/linux/topology.h
@@ -182,10 +182,10 @@ void arch_update_cpu_topology(void);
 #define topology_core_id(cpu)			((void)(cpu), 0)
 #endif
 #ifndef topology_thread_siblings
-#define topology_thread_siblings(cpu)		cpumask_of_cpu(cpu)
+#define topology_thread_siblings(cpu)		cpumask_of(cpu)
 #endif
 #ifndef topology_core_siblings
-#define topology_core_siblings(cpu)		cpumask_of_cpu(cpu)
+#define topology_core_siblings(cpu)		cpumask_of(cpu)
 #endif
 
 #endif /* _LINUX_TOPOLOGY_H */
