diff options
-rw-r--r-- | drivers/edac/edac_device_sysfs.c | 107 |
1 files changed, 0 insertions, 107 deletions
diff --git a/drivers/edac/edac_device_sysfs.c b/drivers/edac/edac_device_sysfs.c index 69305e637810..849d569dd2ce 100644 --- a/drivers/edac/edac_device_sysfs.c +++ b/drivers/edac/edac_device_sysfs.c | |||
@@ -21,113 +21,6 @@ | |||
21 | #define to_edacdev(k) container_of(k, struct edac_device_ctl_info, kobj) | 21 | #define to_edacdev(k) container_of(k, struct edac_device_ctl_info, kobj) |
22 | #define to_edacdev_attr(a) container_of(a, struct edacdev_attribute, attr) | 22 | #define to_edacdev_attr(a) container_of(a, struct edacdev_attribute, attr) |
23 | 23 | ||
24 | #ifdef DKT | ||
25 | |||
26 | static ssize_t edac_dev_ue_count_show(struct edac_device_ctl_info *edac_dev, | ||
27 | char *data) | ||
28 | { | ||
29 | return sprintf(data, "%d\n", edac_dev->ue_count); | ||
30 | } | ||
31 | |||
32 | static ssize_t edac_dev_ce_count_show(struct edac_device_ctl_info *edac_dev, | ||
33 | char *data) | ||
34 | { | ||
35 | return sprintf(data, "%d\n", edac_dev->ce_count); | ||
36 | } | ||
37 | |||
38 | static ssize_t edac_dev_seconds_show(struct edac_device_ctl_info *edac_dev, | ||
39 | char *data) | ||
40 | { | ||
41 | return sprintf(data, "%ld\n", (jiffies - edac_dev->start_time) / HZ); | ||
42 | } | ||
43 | |||
44 | static ssize_t edac_dev_ctl_name_show(struct edac_device_ctl_info *edac_dev, | ||
45 | char *data) | ||
46 | { | ||
47 | return sprintf(data, "%s\n", edac_dev->ctl_name); | ||
48 | } | ||
49 | |||
50 | struct edacdev_attribute { | ||
51 | struct attribute attr; | ||
52 | ssize_t(*show) (struct edac_device_ctl_info *, char *); | ||
53 | ssize_t(*store) (struct edac_device_ctl_info *, const char *, size_t); | ||
54 | }; | ||
55 | |||
56 | /* EDAC DEVICE show/store functions for top most object */ | ||
57 | static ssize_t edacdev_show(struct kobject *kobj, struct attribute *attr, | ||
58 | char *buffer) | ||
59 | { | ||
60 | struct edac_device_ctl_info *edac_dev = to_edacdev(kobj); | ||
61 | struct edacdev_attribute *edacdev_attr = to_edacdev_attr(attr); | ||
62 | |||
63 | if (edacdev_attr->show) | ||
64 | return edacdev_attr->show(edac_dev, buffer); | ||
65 | |||
66 | return -EIO; | ||
67 | } | ||
68 | |||
69 | static ssize_t edacdev_store(struct kobject *kobj, struct attribute *attr, | ||
70 | const char *buffer, size_t count) | ||
71 | { | ||
72 | struct edac_device_ctl_info *edac_dev = to_edacdev(kobj); | ||
73 | struct edacdev_attribute *edacdev_attr = to_edacdev_attr(attr); | ||
74 | |||
75 | if (edacdev_attr->store) | ||
76 | return edacdev_attr->store(edac_dev, buffer, count); | ||
77 | |||
78 | return -EIO; | ||
79 | } | ||
80 | |||
81 | static struct sysfs_ops edac_dev_ops = { | ||
82 | .show = edacdev_show, | ||
83 | .store = edacdev_store | ||
84 | }; | ||
85 | |||
86 | #define EDACDEV_ATTR(_name,_mode,_show,_store) \ | ||
87 | static struct edacdev_attribute edac_dev_attr_##_name = { \ | ||
88 | .attr = {.name = __stringify(_name), .mode = _mode }, \ | ||
89 | .show = _show, \ | ||
90 | .store = _store, \ | ||
91 | }; | ||
92 | |||
93 | /* default Control file */ | ||
94 | EDACDEV_ATTR(reset_counters, S_IWUSR, NULL, edac_dev_reset_counters_store); | ||
95 | |||
96 | /* default Attribute files */ | ||
97 | EDACDEV_ATTR(mc_name, S_IRUGO, edac_dev_ctl_name_show, NULL); | ||
98 | EDACDEV_ATTR(seconds_since_reset, S_IRUGO, edac_dev_seconds_show, NULL); | ||
99 | EDACDEV_ATTR(ue_count, S_IRUGO, edac_dev_ue_count_show, NULL); | ||
100 | EDACDEV_ATTR(ce_count, S_IRUGO, edac_dev_ce_count_show, NULL); | ||
101 | |||
102 | static struct edacdev_attribute *edacdev_attr[] = { | ||
103 | &edacdev_attr_reset_counters, | ||
104 | &edacdev_attr_mc_name, | ||
105 | &edacdev_attr_seconds_since_reset, | ||
106 | &edacdev_attr_ue_count, | ||
107 | &edacdev_attr_ce_count, | ||
108 | NULL | ||
109 | }; | ||
110 | |||
111 | /* | ||
112 | * Release of a Edac Device controlling instance | ||
113 | */ | ||
114 | static void edac_dev_instance_release(struct kobject *kobj) | ||
115 | { | ||
116 | struct edac_device_ctl_info *edac_dev; | ||
117 | |||
118 | edac_dev = to_edacdev(kobj); | ||
119 | debugf0("%s() idx=%d\n", __func__, edac_dev->dev_idx); | ||
120 | complete(&edac_dev->kobj_complete); | ||
121 | } | ||
122 | |||
123 | static struct kobj_type ktype_device = { | ||
124 | .release = edac_dev_instance_release, | ||
125 | .sysfs_ops = &edacdev_ops, | ||
126 | .default_attrs = (struct attribute **)edacdev_attr, | ||
127 | }; | ||
128 | |||
129 | #endif | ||
130 | |||
131 | /************************** edac_device sysfs code and data **************/ | 24 | /************************** edac_device sysfs code and data **************/ |
132 | 25 | ||
133 | /* | 26 | /* |