aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rapidio/rio-sysfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/rapidio/rio-sysfs.c')
-rw-r--r--drivers/rapidio/rio-sysfs.c38
1 files changed, 24 insertions, 14 deletions
diff --git a/drivers/rapidio/rio-sysfs.c b/drivers/rapidio/rio-sysfs.c
index 795a4776cb0c..e0221c6d0cc2 100644
--- a/drivers/rapidio/rio-sysfs.c
+++ b/drivers/rapidio/rio-sysfs.c
@@ -27,6 +27,7 @@ field##_show(struct device *dev, struct device_attribute *attr, char *buf) \
27 \ 27 \
28 return sprintf(buf, format_string, rdev->field); \ 28 return sprintf(buf, format_string, rdev->field); \
29} \ 29} \
30static DEVICE_ATTR_RO(field);
30 31
31rio_config_attr(did, "0x%04x\n"); 32rio_config_attr(did, "0x%04x\n");
32rio_config_attr(vid, "0x%04x\n"); 33rio_config_attr(vid, "0x%04x\n");
@@ -54,6 +55,7 @@ static ssize_t routes_show(struct device *dev, struct device_attribute *attr, ch
54 55
55 return (str - buf); 56 return (str - buf);
56} 57}
58static DEVICE_ATTR_RO(routes);
57 59
58static ssize_t lprev_show(struct device *dev, 60static ssize_t lprev_show(struct device *dev,
59 struct device_attribute *attr, char *buf) 61 struct device_attribute *attr, char *buf)
@@ -63,6 +65,7 @@ static ssize_t lprev_show(struct device *dev,
63 return sprintf(buf, "%s\n", 65 return sprintf(buf, "%s\n",
64 (rdev->prev) ? rio_name(rdev->prev) : "root"); 66 (rdev->prev) ? rio_name(rdev->prev) : "root");
65} 67}
68static DEVICE_ATTR_RO(lprev);
66 69
67static ssize_t lnext_show(struct device *dev, 70static ssize_t lnext_show(struct device *dev,
68 struct device_attribute *attr, char *buf) 71 struct device_attribute *attr, char *buf)
@@ -83,6 +86,7 @@ static ssize_t lnext_show(struct device *dev,
83 86
84 return str - buf; 87 return str - buf;
85} 88}
89static DEVICE_ATTR_RO(lnext);
86 90
87static ssize_t modalias_show(struct device *dev, 91static ssize_t modalias_show(struct device *dev,
88 struct device_attribute *attr, char *buf) 92 struct device_attribute *attr, char *buf)
@@ -92,23 +96,29 @@ static ssize_t modalias_show(struct device *dev,
92 return sprintf(buf, "rapidio:v%04Xd%04Xav%04Xad%04X\n", 96 return sprintf(buf, "rapidio:v%04Xd%04Xav%04Xad%04X\n",
93 rdev->vid, rdev->did, rdev->asm_vid, rdev->asm_did); 97 rdev->vid, rdev->did, rdev->asm_vid, rdev->asm_did);
94} 98}
99static DEVICE_ATTR_RO(modalias);
100
101static struct attribute *rio_dev_attrs[] = {
102 &dev_attr_did.attr,
103 &dev_attr_vid.attr,
104 &dev_attr_device_rev.attr,
105 &dev_attr_asm_did.attr,
106 &dev_attr_asm_vid.attr,
107 &dev_attr_asm_rev.attr,
108 &dev_attr_lprev.attr,
109 &dev_attr_destid.attr,
110 &dev_attr_modalias.attr,
111 NULL,
112};
95 113
96struct device_attribute rio_dev_attrs[] = { 114static const struct attribute_group rio_dev_group = {
97 __ATTR_RO(did), 115 .attrs = rio_dev_attrs,
98 __ATTR_RO(vid),
99 __ATTR_RO(device_rev),
100 __ATTR_RO(asm_did),
101 __ATTR_RO(asm_vid),
102 __ATTR_RO(asm_rev),
103 __ATTR_RO(lprev),
104 __ATTR_RO(destid),
105 __ATTR_RO(modalias),
106 __ATTR_NULL,
107}; 116};
108 117
109static DEVICE_ATTR(routes, S_IRUGO, routes_show, NULL); 118const struct attribute_group *rio_dev_groups[] = {
110static DEVICE_ATTR(lnext, S_IRUGO, lnext_show, NULL); 119 &rio_dev_group,
111static DEVICE_ATTR(hopcount, S_IRUGO, hopcount_show, NULL); 120 NULL,
121};
112 122
113static ssize_t 123static ssize_t
114rio_read_config(struct file *filp, struct kobject *kobj, 124rio_read_config(struct file *filp, struct kobject *kobj,