diff options
Diffstat (limited to 'drivers/base/topology.c')
-rw-r--r-- | drivers/base/topology.c | 22 |
1 files changed, 2 insertions, 20 deletions
diff --git a/drivers/base/topology.c b/drivers/base/topology.c index be7c1fb7c0c9..f7c353843ddf 100644 --- a/drivers/base/topology.c +++ b/drivers/base/topology.c | |||
@@ -42,29 +42,11 @@ static ssize_t show_##name(struct device *dev, \ | |||
42 | return sprintf(buf, "%d\n", topology_##name(dev->id)); \ | 42 | return sprintf(buf, "%d\n", topology_##name(dev->id)); \ |
43 | } | 43 | } |
44 | 44 | ||
45 | #if defined(topology_thread_cpumask) || defined(topology_core_cpumask) || \ | ||
46 | defined(topology_book_cpumask) | ||
47 | static ssize_t show_cpumap(int type, const struct cpumask *mask, char *buf) | ||
48 | { | ||
49 | ptrdiff_t len = PTR_ALIGN(buf + PAGE_SIZE - 1, PAGE_SIZE) - buf; | ||
50 | int n = 0; | ||
51 | |||
52 | if (len > 1) { | ||
53 | n = type? | ||
54 | cpulist_scnprintf(buf, len-2, mask) : | ||
55 | cpumask_scnprintf(buf, len-2, mask); | ||
56 | buf[n++] = '\n'; | ||
57 | buf[n] = '\0'; | ||
58 | } | ||
59 | return n; | ||
60 | } | ||
61 | #endif | ||
62 | |||
63 | #define define_siblings_show_map(name) \ | 45 | #define define_siblings_show_map(name) \ |
64 | static ssize_t show_##name(struct device *dev, \ | 46 | static ssize_t show_##name(struct device *dev, \ |
65 | struct device_attribute *attr, char *buf) \ | 47 | struct device_attribute *attr, char *buf) \ |
66 | { \ | 48 | { \ |
67 | return show_cpumap(0, topology_##name(dev->id), buf); \ | 49 | return cpumap_print_to_pagebuf(false, buf, topology_##name(dev->id));\ |
68 | } | 50 | } |
69 | 51 | ||
70 | #define define_siblings_show_list(name) \ | 52 | #define define_siblings_show_list(name) \ |
@@ -72,7 +54,7 @@ static ssize_t show_##name##_list(struct device *dev, \ | |||
72 | struct device_attribute *attr, \ | 54 | struct device_attribute *attr, \ |
73 | char *buf) \ | 55 | char *buf) \ |
74 | { \ | 56 | { \ |
75 | return show_cpumap(1, topology_##name(dev->id), buf); \ | 57 | return cpumap_print_to_pagebuf(true, buf, topology_##name(dev->id));\ |
76 | } | 58 | } |
77 | 59 | ||
78 | #define define_siblings_show_func(name) \ | 60 | #define define_siblings_show_func(name) \ |