diff options
Diffstat (limited to 'drivers/base/node.c')
-rw-r--r-- | drivers/base/node.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/drivers/base/node.c b/drivers/base/node.c index 472168cd0c97..a3b82e9c7f20 100644 --- a/drivers/base/node.c +++ b/drivers/base/node.c | |||
@@ -25,32 +25,26 @@ static struct bus_type node_subsys = { | |||
25 | }; | 25 | }; |
26 | 26 | ||
27 | 27 | ||
28 | static ssize_t node_read_cpumap(struct device *dev, int type, char *buf) | 28 | static ssize_t node_read_cpumap(struct device *dev, bool list, char *buf) |
29 | { | 29 | { |
30 | struct node *node_dev = to_node(dev); | 30 | struct node *node_dev = to_node(dev); |
31 | const struct cpumask *mask = cpumask_of_node(node_dev->dev.id); | 31 | const struct cpumask *mask = cpumask_of_node(node_dev->dev.id); |
32 | int len; | ||
33 | 32 | ||
34 | /* 2008/04/07: buf currently PAGE_SIZE, need 9 chars per 32 bits. */ | 33 | /* 2008/04/07: buf currently PAGE_SIZE, need 9 chars per 32 bits. */ |
35 | BUILD_BUG_ON((NR_CPUS/32 * 9) > (PAGE_SIZE-1)); | 34 | BUILD_BUG_ON((NR_CPUS/32 * 9) > (PAGE_SIZE-1)); |
36 | 35 | ||
37 | len = type? | 36 | return cpumap_print_to_pagebuf(list, buf, mask); |
38 | cpulist_scnprintf(buf, PAGE_SIZE-2, mask) : | ||
39 | cpumask_scnprintf(buf, PAGE_SIZE-2, mask); | ||
40 | buf[len++] = '\n'; | ||
41 | buf[len] = '\0'; | ||
42 | return len; | ||
43 | } | 37 | } |
44 | 38 | ||
45 | static inline ssize_t node_read_cpumask(struct device *dev, | 39 | static inline ssize_t node_read_cpumask(struct device *dev, |
46 | struct device_attribute *attr, char *buf) | 40 | struct device_attribute *attr, char *buf) |
47 | { | 41 | { |
48 | return node_read_cpumap(dev, 0, buf); | 42 | return node_read_cpumap(dev, false, buf); |
49 | } | 43 | } |
50 | static inline ssize_t node_read_cpulist(struct device *dev, | 44 | static inline ssize_t node_read_cpulist(struct device *dev, |
51 | struct device_attribute *attr, char *buf) | 45 | struct device_attribute *attr, char *buf) |
52 | { | 46 | { |
53 | return node_read_cpumap(dev, 1, buf); | 47 | return node_read_cpumap(dev, true, buf); |
54 | } | 48 | } |
55 | 49 | ||
56 | static DEVICE_ATTR(cpumap, S_IRUGO, node_read_cpumask, NULL); | 50 | static DEVICE_ATTR(cpumap, S_IRUGO, node_read_cpumask, NULL); |