From: Linus Torvalds Date: Tue, 15 Jul 2008 17:32:39 +0000 (-0700) Subject: Merge branch 'core/topology' of git://git.kernel.org/pub/scm/linux/kernel/git/tip... X-Git-Tag: v2.6.27-rc1~1084 X-Git-Url: http://git.samba.org/samba.git/?p=sfrench%2Fcifs-2.6.git;a=commitdiff_plain;h=e7849f16c13476288fe4fbd420975e8456c75aa0;hp=-c Merge branch 'core/topology' of git://git./linux/kernel/git/tip/linux-2.6-tip * 'core/topology' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: cputopology: always define CPU topology information, clean up cpu topology: always define CPU topology information --- e7849f16c13476288fe4fbd420975e8456c75aa0 diff --combined drivers/base/topology.c index 1efe162e16d7,f0cb27011930..3f6d9b0a6abe --- a/drivers/base/topology.c +++ b/drivers/base/topology.c @@@ -40,7 -40,6 +40,7 @@@ static ssize_t show_##name(struct sys_d return sprintf(buf, "%d\n", topology_##name(cpu)); \ } +#if defined(topology_thread_siblings) || defined(topology_core_siblings) static ssize_t show_cpumap(int type, cpumask_t *mask, char *buf) { ptrdiff_t len = PTR_ALIGN(buf + PAGE_SIZE - 1, PAGE_SIZE) - buf; @@@ -55,85 -54,45 +55,65 @@@ } return n; } +#endif +#ifdef arch_provides_topology_pointers #define define_siblings_show_map(name) \ -static inline ssize_t show_##name(struct sys_device *dev, char *buf) \ +static ssize_t show_##name(struct sys_device *dev, char *buf) \ { \ unsigned int cpu = dev->id; \ return show_cpumap(0, &(topology_##name(cpu)), buf); \ } #define define_siblings_show_list(name) \ -static inline ssize_t show_##name##_list(struct sys_device *dev, char *buf) \ +static ssize_t show_##name##_list(struct sys_device *dev, char *buf) \ { \ unsigned int cpu = dev->id; \ return show_cpumap(1, &(topology_##name(cpu)), buf); \ } +#else +#define define_siblings_show_map(name) \ +static ssize_t show_##name(struct sys_device *dev, char *buf) \ +{ \ + unsigned int cpu = dev->id; \ + cpumask_t mask = topology_##name(cpu); \ + return show_cpumap(0, &mask, buf); \ +} + +#define define_siblings_show_list(name) \ +static ssize_t show_##name##_list(struct sys_device *dev, char *buf) \ +{ \ + unsigned int cpu = dev->id; \ + cpumask_t mask = topology_##name(cpu); \ + return show_cpumap(1, &mask, buf); \ +} +#endif + #define define_siblings_show_func(name) \ define_siblings_show_map(name); define_siblings_show_list(name) - #ifdef topology_physical_package_id define_id_show_func(physical_package_id); define_one_ro(physical_package_id); - #define ref_physical_package_id_attr &attr_physical_package_id.attr, - #else - #define ref_physical_package_id_attr - #endif - #ifdef topology_core_id define_id_show_func(core_id); define_one_ro(core_id); - #define ref_core_id_attr &attr_core_id.attr, - #else - #define ref_core_id_attr - #endif - #ifdef topology_thread_siblings define_siblings_show_func(thread_siblings); define_one_ro(thread_siblings); define_one_ro(thread_siblings_list); - #define ref_thread_siblings_attr \ - &attr_thread_siblings.attr, &attr_thread_siblings_list.attr, - #else - #define ref_thread_siblings_attr - #endif - #ifdef topology_core_siblings define_siblings_show_func(core_siblings); define_one_ro(core_siblings); define_one_ro(core_siblings_list); - #define ref_core_siblings_attr \ - &attr_core_siblings.attr, &attr_core_siblings_list.attr, - #else - #define ref_core_siblings_attr - #endif static struct attribute *default_attrs[] = { - ref_physical_package_id_attr - ref_core_id_attr - ref_thread_siblings_attr - ref_core_siblings_attr + &attr_physical_package_id.attr, + &attr_core_id.attr, + &attr_thread_siblings.attr, + &attr_thread_siblings_list.attr, + &attr_core_siblings.attr, + &attr_core_siblings_list.attr, NULL };