aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/topology.c53
1 files changed, 24 insertions, 29 deletions
diff --git a/drivers/base/topology.c b/drivers/base/topology.c
index f7c353843ddf..6491f45200a7 100644
--- a/drivers/base/topology.c
+++ b/drivers/base/topology.c
@@ -29,57 +29,52 @@
29#include <linux/hardirq.h> 29#include <linux/hardirq.h>
30#include <linux/topology.h> 30#include <linux/topology.h>
31 31
32#define define_one_ro_named(_name, _func) \
33 static DEVICE_ATTR(_name, 0444, _func, NULL)
34
35#define define_one_ro(_name) \
36 static DEVICE_ATTR(_name, 0444, show_##_name, NULL)
37
38#define define_id_show_func(name) \ 32#define define_id_show_func(name) \
39static ssize_t show_##name(struct device *dev, \ 33static ssize_t name##_show(struct device *dev, \
40 struct device_attribute *attr, char *buf) \ 34 struct device_attribute *attr, char *buf) \
41{ \ 35{ \
42 return sprintf(buf, "%d\n", topology_##name(dev->id)); \ 36 return sprintf(buf, "%d\n", topology_##name(dev->id)); \
43} 37}
44 38
45#define define_siblings_show_map(name) \ 39#define define_siblings_show_map(name, mask) \
46static ssize_t show_##name(struct device *dev, \ 40static ssize_t name##_show(struct device *dev, \
47 struct device_attribute *attr, char *buf) \ 41 struct device_attribute *attr, char *buf) \
48{ \ 42{ \
49 return cpumap_print_to_pagebuf(false, buf, topology_##name(dev->id));\ 43 return cpumap_print_to_pagebuf(false, buf, topology_##mask(dev->id));\
50} 44}
51 45
52#define define_siblings_show_list(name) \ 46#define define_siblings_show_list(name, mask) \
53static ssize_t show_##name##_list(struct device *dev, \ 47static ssize_t name##_list_show(struct device *dev, \
54 struct device_attribute *attr, \ 48 struct device_attribute *attr, \
55 char *buf) \ 49 char *buf) \
56{ \ 50{ \
57 return cpumap_print_to_pagebuf(true, buf, topology_##name(dev->id));\ 51 return cpumap_print_to_pagebuf(true, buf, topology_##mask(dev->id));\
58} 52}
59 53
60#define define_siblings_show_func(name) \ 54#define define_siblings_show_func(name, mask) \
61 define_siblings_show_map(name); define_siblings_show_list(name) 55 define_siblings_show_map(name, mask); \
56 define_siblings_show_list(name, mask)
62 57
63define_id_show_func(physical_package_id); 58define_id_show_func(physical_package_id);
64define_one_ro(physical_package_id); 59static DEVICE_ATTR_RO(physical_package_id);
65 60
66define_id_show_func(core_id); 61define_id_show_func(core_id);
67define_one_ro(core_id); 62static DEVICE_ATTR_RO(core_id);
68 63
69define_siblings_show_func(thread_cpumask); 64define_siblings_show_func(thread_siblings, thread_cpumask);
70define_one_ro_named(thread_siblings, show_thread_cpumask); 65static DEVICE_ATTR_RO(thread_siblings);
71define_one_ro_named(thread_siblings_list, show_thread_cpumask_list); 66static DEVICE_ATTR_RO(thread_siblings_list);
72 67
73define_siblings_show_func(core_cpumask); 68define_siblings_show_func(core_siblings, core_cpumask);
74define_one_ro_named(core_siblings, show_core_cpumask); 69static DEVICE_ATTR_RO(core_siblings);
75define_one_ro_named(core_siblings_list, show_core_cpumask_list); 70static DEVICE_ATTR_RO(core_siblings_list);
76 71
77#ifdef CONFIG_SCHED_BOOK 72#ifdef CONFIG_SCHED_BOOK
78define_id_show_func(book_id); 73define_id_show_func(book_id);
79define_one_ro(book_id); 74static DEVICE_ATTR_RO(book_id);
80define_siblings_show_func(book_cpumask); 75define_siblings_show_func(book_siblings, book_cpumask);
81define_one_ro_named(book_siblings, show_book_cpumask); 76static DEVICE_ATTR_RO(book_siblings);
82define_one_ro_named(book_siblings_list, show_book_cpumask_list); 77static DEVICE_ATTR_RO(book_siblings_list);
83#endif 78#endif
84 79
85static struct attribute *default_attrs[] = { 80static struct attribute *default_attrs[] = {