diff options
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/topology.c | 53 |
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) \ |
39 | static ssize_t show_##name(struct device *dev, \ | 33 | static 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) \ |
46 | static ssize_t show_##name(struct device *dev, \ | 40 | static 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) \ |
53 | static ssize_t show_##name##_list(struct device *dev, \ | 47 | static 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 | ||
63 | define_id_show_func(physical_package_id); | 58 | define_id_show_func(physical_package_id); |
64 | define_one_ro(physical_package_id); | 59 | static DEVICE_ATTR_RO(physical_package_id); |
65 | 60 | ||
66 | define_id_show_func(core_id); | 61 | define_id_show_func(core_id); |
67 | define_one_ro(core_id); | 62 | static DEVICE_ATTR_RO(core_id); |
68 | 63 | ||
69 | define_siblings_show_func(thread_cpumask); | 64 | define_siblings_show_func(thread_siblings, thread_cpumask); |
70 | define_one_ro_named(thread_siblings, show_thread_cpumask); | 65 | static DEVICE_ATTR_RO(thread_siblings); |
71 | define_one_ro_named(thread_siblings_list, show_thread_cpumask_list); | 66 | static DEVICE_ATTR_RO(thread_siblings_list); |
72 | 67 | ||
73 | define_siblings_show_func(core_cpumask); | 68 | define_siblings_show_func(core_siblings, core_cpumask); |
74 | define_one_ro_named(core_siblings, show_core_cpumask); | 69 | static DEVICE_ATTR_RO(core_siblings); |
75 | define_one_ro_named(core_siblings_list, show_core_cpumask_list); | 70 | static DEVICE_ATTR_RO(core_siblings_list); |
76 | 71 | ||
77 | #ifdef CONFIG_SCHED_BOOK | 72 | #ifdef CONFIG_SCHED_BOOK |
78 | define_id_show_func(book_id); | 73 | define_id_show_func(book_id); |
79 | define_one_ro(book_id); | 74 | static DEVICE_ATTR_RO(book_id); |
80 | define_siblings_show_func(book_cpumask); | 75 | define_siblings_show_func(book_siblings, book_cpumask); |
81 | define_one_ro_named(book_siblings, show_book_cpumask); | 76 | static DEVICE_ATTR_RO(book_siblings); |
82 | define_one_ro_named(book_siblings_list, show_book_cpumask_list); | 77 | static DEVICE_ATTR_RO(book_siblings_list); |
83 | #endif | 78 | #endif |
84 | 79 | ||
85 | static struct attribute *default_attrs[] = { | 80 | static struct attribute *default_attrs[] = { |