aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/topology.c38
1 files changed, 10 insertions, 28 deletions
diff --git a/drivers/base/topology.c b/drivers/base/topology.c
index fdf4044d2e74..24d29a9fc25b 100644
--- a/drivers/base/topology.c
+++ b/drivers/base/topology.c
@@ -59,60 +59,42 @@ static ssize_t show_cpumap(int type, cpumask_t *mask, char *buf)
59static inline ssize_t show_##name(struct sys_device *dev, char *buf) \ 59static inline ssize_t show_##name(struct sys_device *dev, char *buf) \
60{ \ 60{ \
61 unsigned int cpu = dev->id; \ 61 unsigned int cpu = dev->id; \
62 return show_cpumap(0, &(topology_##name(cpu)), buf); \ 62 cpumask_t siblings = topology_##name(cpu); \
63 return show_cpumap(0, &siblings, buf); \
63} 64}
64 65
65#define define_siblings_show_list(name) \ 66#define define_siblings_show_list(name) \
66static inline ssize_t show_##name##_list(struct sys_device *dev, char *buf) \ 67static inline ssize_t show_##name##_list(struct sys_device *dev, char *buf) \
67{ \ 68{ \
68 unsigned int cpu = dev->id; \ 69 unsigned int cpu = dev->id; \
69 return show_cpumap(1, &(topology_##name(cpu)), buf); \ 70 cpumask_t siblings = topology_##name(cpu); \
71 return show_cpumap(1, &siblings, buf); \
70} 72}
71 73
72#define define_siblings_show_func(name) \ 74#define define_siblings_show_func(name) \
73 define_siblings_show_map(name); define_siblings_show_list(name) 75 define_siblings_show_map(name); define_siblings_show_list(name)
74 76
75#ifdef topology_physical_package_id
76define_id_show_func(physical_package_id); 77define_id_show_func(physical_package_id);
77define_one_ro(physical_package_id); 78define_one_ro(physical_package_id);
78#define ref_physical_package_id_attr &attr_physical_package_id.attr,
79#else
80#define ref_physical_package_id_attr
81#endif
82 79
83#ifdef topology_core_id
84define_id_show_func(core_id); 80define_id_show_func(core_id);
85define_one_ro(core_id); 81define_one_ro(core_id);
86#define ref_core_id_attr &attr_core_id.attr,
87#else
88#define ref_core_id_attr
89#endif
90 82
91#ifdef topology_thread_siblings
92define_siblings_show_func(thread_siblings); 83define_siblings_show_func(thread_siblings);
93define_one_ro(thread_siblings); 84define_one_ro(thread_siblings);
94define_one_ro(thread_siblings_list); 85define_one_ro(thread_siblings_list);
95#define ref_thread_siblings_attr \
96 &attr_thread_siblings.attr, &attr_thread_siblings_list.attr,
97#else
98#define ref_thread_siblings_attr
99#endif
100 86
101#ifdef topology_core_siblings
102define_siblings_show_func(core_siblings); 87define_siblings_show_func(core_siblings);
103define_one_ro(core_siblings); 88define_one_ro(core_siblings);
104define_one_ro(core_siblings_list); 89define_one_ro(core_siblings_list);
105#define ref_core_siblings_attr \
106 &attr_core_siblings.attr, &attr_core_siblings_list.attr,
107#else
108#define ref_core_siblings_attr
109#endif
110 90
111static struct attribute *default_attrs[] = { 91static struct attribute *default_attrs[] = {
112 ref_physical_package_id_attr 92 &attr_physical_package_id.attr,
113 ref_core_id_attr 93 &attr_core_id.attr,
114 ref_thread_siblings_attr 94 &attr_thread_siblings.attr,
115 ref_core_siblings_attr 95 &attr_thread_siblings_list.attr,
96 &attr_core_siblings.attr,
97 &attr_core_siblings_list.attr,
116 NULL 98 NULL
117}; 99};
118 100