aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/node.c
diff options
context:
space:
mode:
authorAndi Kleen <andi@firstfloor.org>2008-07-01 12:48:41 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2008-07-22 00:55:02 -0400
commit4a0b2b4dbe1335b8b9886ba3dc85a145d5d938ed (patch)
treec2d3a0f86ade5061a1bb9a14aa702323d729fd54 /drivers/base/node.c
parent36ce6dad6e3cb3f050ed41e0beac0070d2062b25 (diff)
sysdev: Pass the attribute to the low level sysdev show/store function
This allow to dynamically generate attributes and share show/store functions between attributes. Right now most attributes are generated by special macros and lots of duplicated code. With the attribute passed it's instead possible to attach some data to the attribute and then use that in shared low level functions to do different things. I need this for the dynamically generated bank attributes in the x86 machine check code, but it'll allow some further cleanups. I converted all users in tree to the new show/store prototype. It's a single huge patch to avoid unbisectable sections. Runtime tested: x86-32, x86-64 Compiled only: ia64, powerpc Not compile tested/only grep converted: sh, arm, avr32 Signed-off-by: Andi Kleen <ak@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base/node.c')
-rw-r--r--drivers/base/node.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/base/node.c b/drivers/base/node.c
index 0f867a083338..5116b78c6325 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -36,11 +36,13 @@ static ssize_t node_read_cpumap(struct sys_device *dev, int type, char *buf)
36 return len; 36 return len;
37} 37}
38 38
39static inline ssize_t node_read_cpumask(struct sys_device *dev, char *buf) 39static inline ssize_t node_read_cpumask(struct sys_device *dev,
40 struct sysdev_attribute *attr, char *buf)
40{ 41{
41 return node_read_cpumap(dev, 0, buf); 42 return node_read_cpumap(dev, 0, buf);
42} 43}
43static inline ssize_t node_read_cpulist(struct sys_device *dev, char *buf) 44static inline ssize_t node_read_cpulist(struct sys_device *dev,
45 struct sysdev_attribute *attr, char *buf)
44{ 46{
45 return node_read_cpumap(dev, 1, buf); 47 return node_read_cpumap(dev, 1, buf);
46} 48}
@@ -49,7 +51,8 @@ static SYSDEV_ATTR(cpumap, S_IRUGO, node_read_cpumask, NULL);
49static SYSDEV_ATTR(cpulist, S_IRUGO, node_read_cpulist, NULL); 51static SYSDEV_ATTR(cpulist, S_IRUGO, node_read_cpulist, NULL);
50 52
51#define K(x) ((x) << (PAGE_SHIFT - 10)) 53#define K(x) ((x) << (PAGE_SHIFT - 10))
52static ssize_t node_read_meminfo(struct sys_device * dev, char * buf) 54static ssize_t node_read_meminfo(struct sys_device * dev,
55 struct sysdev_attribute *attr, char * buf)
53{ 56{
54 int n; 57 int n;
55 int nid = dev->id; 58 int nid = dev->id;
@@ -112,7 +115,8 @@ static ssize_t node_read_meminfo(struct sys_device * dev, char * buf)
112#undef K 115#undef K
113static SYSDEV_ATTR(meminfo, S_IRUGO, node_read_meminfo, NULL); 116static SYSDEV_ATTR(meminfo, S_IRUGO, node_read_meminfo, NULL);
114 117
115static ssize_t node_read_numastat(struct sys_device * dev, char * buf) 118static ssize_t node_read_numastat(struct sys_device * dev,
119 struct sysdev_attribute *attr, char * buf)
116{ 120{
117 return sprintf(buf, 121 return sprintf(buf,
118 "numa_hit %lu\n" 122 "numa_hit %lu\n"
@@ -130,7 +134,8 @@ static ssize_t node_read_numastat(struct sys_device * dev, char * buf)
130} 134}
131static SYSDEV_ATTR(numastat, S_IRUGO, node_read_numastat, NULL); 135static SYSDEV_ATTR(numastat, S_IRUGO, node_read_numastat, NULL);
132 136
133static ssize_t node_read_distance(struct sys_device * dev, char * buf) 137static ssize_t node_read_distance(struct sys_device * dev,
138 struct sysdev_attribute *attr, char * buf)
134{ 139{
135 int nid = dev->id; 140 int nid = dev->id;
136 int len = 0; 141 int len = 0;