1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
|
Index: dahdi-linux-2.11.1~dfsg/drivers/dahdi/dahdi-sysfs.c
===================================================================
--- dahdi-linux-2.11.1~dfsg.orig/drivers/dahdi/dahdi-sysfs.c
+++ dahdi-linux-2.11.1~dfsg/drivers/dahdi/dahdi-sysfs.c
@@ -214,6 +214,7 @@ static BUS_ATTR_READER(linecompat_show,
return len;
}
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
static struct device_attribute span_dev_attrs[] = {
__ATTR_RO(name),
__ATTR_RO(desc),
@@ -230,6 +231,39 @@ static struct device_attribute span_dev_
__ATTR_RO(linecompat),
__ATTR_NULL,
};
+#else
+static DEVICE_ATTR_RO(name);
+static DEVICE_ATTR_RO(desc);
+static DEVICE_ATTR_RO(spantype);
+static DEVICE_ATTR_RO(local_spanno);
+static DEVICE_ATTR_RO(alarms);
+static DEVICE_ATTR_RO(lbo);
+static DEVICE_ATTR_RO(syncsrc);
+static DEVICE_ATTR_RO(is_digital);
+static DEVICE_ATTR_RO(is_sync_master);
+static DEVICE_ATTR_RO(basechan);
+static DEVICE_ATTR_RO(channels);
+static DEVICE_ATTR_RO(lineconfig);
+static DEVICE_ATTR_RO(linecompat);
+
+static struct attribute *span_dev_attrs[] = {
+ &dev_attr_name.attr,
+ &dev_attr_desc.attr,
+ &dev_attr_spantype.attr,
+ &dev_attr_local_spanno.attr,
+ &dev_attr_alarms.attr,
+ &dev_attr_lbo.attr,
+ &dev_attr_syncsrc.attr,
+ &dev_attr_is_digital.attr,
+ &dev_attr_is_sync_master.attr,
+ &dev_attr_basechan.attr,
+ &dev_attr_channels.attr,
+ &dev_attr_lineconfig.attr,
+ &dev_attr_linecompat.attr,
+ NULL,
+};
+ATTRIBUTE_GROUPS(span_dev);
+#endif
static ssize_t master_span_show(struct device_driver *driver, char *buf)
{
@@ -270,10 +304,11 @@ static struct bus_type spans_bus_type =
.name = "dahdi_spans",
.match = span_match,
.uevent = span_uevent,
- .dev_attrs = span_dev_attrs,
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
+ .dev_attrs = span_dev_attrs,
.drv_attrs = dahdi_attrs,
#else
+ .dev_groups = span_dev_groups,
.drv_groups = dahdi_groups,
#endif
};
@@ -690,6 +725,7 @@ dahdi_registration_time_show(struct devi
return count;
}
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
static struct device_attribute dahdi_device_attrs[] = {
__ATTR(manufacturer, S_IRUGO, dahdi_device_manufacturer_show, NULL),
__ATTR(type, S_IRUGO, dahdi_device_type_show, NULL),
@@ -704,11 +740,48 @@ static struct device_attribute dahdi_dev
__ATTR(registration_time, S_IRUGO, dahdi_registration_time_show, NULL),
__ATTR_NULL,
};
+#else
+static DEVICE_ATTR(manufacturer, S_IRUGO, dahdi_device_manufacturer_show, NULL);
+static DEVICE_ATTR(type, S_IRUGO, dahdi_device_type_show, NULL);
+static DEVICE_ATTR(span_count, S_IRUGO, dahdi_device_span_count_show, NULL);
+static DEVICE_ATTR(hardware_id, S_IRUGO, dahdi_device_hardware_id_show, NULL);
+static DEVICE_ATTR(location, S_IRUGO, dahdi_device_location_show, NULL);
+static DEVICE_ATTR(auto_assign, S_IWUSR, NULL, dahdi_device_auto_assign);
+static DEVICE_ATTR(assign_span, S_IWUSR, NULL, dahdi_device_assign_span);
+static DEVICE_ATTR(unassign_span, S_IWUSR, NULL, dahdi_device_unassign_span);
+/*
+ * Using DEVICE_ATTR for spantype attribute here will conflict with the
+ * span device attribute definition above. Define it somewhat more
+ * manually to give it a unique name.
+ */
+static struct device_attribute dahdi_dev_attr_spantype =
+ __ATTR(spantype, S_IWUSR | S_IRUGO, dahdi_spantype_show, dahdi_spantype_store);
+static DEVICE_ATTR(registration_time, S_IRUGO, dahdi_registration_time_show, NULL);
+
+static struct attribute *dahdi_device_attrs[] = {
+ &dev_attr_manufacturer.attr,
+ &dev_attr_type.attr,
+ &dev_attr_span_count.attr,
+ &dev_attr_hardware_id.attr,
+ &dev_attr_location.attr,
+ &dev_attr_auto_assign.attr,
+ &dev_attr_assign_span.attr,
+ &dev_attr_unassign_span.attr,
+ &dahdi_dev_attr_spantype.attr,
+ &dev_attr_registration_time.attr,
+ NULL,
+};
+ATTRIBUTE_GROUPS(dahdi_device);
+#endif
static struct bus_type dahdi_device_bus = {
.name = "dahdi_devices",
.uevent = device_uevent,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
.dev_attrs = dahdi_device_attrs,
+#else
+ .dev_groups = dahdi_device_groups,
+#endif
};
static void dahdi_sysfs_cleanup(void)
Index: dahdi-linux-2.11.1~dfsg/drivers/dahdi/dahdi-sysfs-chan.c
===================================================================
--- dahdi-linux-2.11.1~dfsg.orig/drivers/dahdi/dahdi-sysfs-chan.c
+++ dahdi-linux-2.11.1~dfsg/drivers/dahdi/dahdi-sysfs-chan.c
@@ -158,6 +158,7 @@ static BUS_ATTR_READER(ec_state_show, de
return len;
}
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
static struct device_attribute chan_dev_attrs[] = {
__ATTR_RO(name),
__ATTR_RO(channo),
@@ -174,6 +175,39 @@ static struct device_attribute chan_dev_
__ATTR_RO(in_use),
__ATTR_NULL,
};
+#else
+static DEVICE_ATTR_RO(name);
+static DEVICE_ATTR_RO(channo);
+static DEVICE_ATTR_RO(chanpos);
+static DEVICE_ATTR_RO(sig);
+static DEVICE_ATTR_RO(sigcap);
+static DEVICE_ATTR_RO(alarms);
+static DEVICE_ATTR_RO(ec_factory);
+static DEVICE_ATTR_RO(ec_state);
+static DEVICE_ATTR_RO(blocksize);
+#ifdef OPTIMIZE_CHANMUTE
+static DEVICE_ATTR_RO(chanmute);
+#endif
+static DEVICE_ATTR_RO(in_use);
+
+static struct attribute *chan_dev_attrs[] = {
+ &dev_attr_name.attr,
+ &dev_attr_channo.attr,
+ &dev_attr_chanpos.attr,
+ &dev_attr_sig.attr,
+ &dev_attr_sigcap.attr,
+ &dev_attr_alarms.attr,
+ &dev_attr_ec_factory.attr,
+ &dev_attr_ec_state.attr,
+ &dev_attr_blocksize.attr,
+#ifdef OPTIMIZE_CHANMUTE
+ &dev_attr_chanmute.attr,
+#endif
+ &dev_attr_in_use.attr,
+ NULL,
+};
+ATTRIBUTE_GROUPS(chan_dev);
+#endif
static void chan_release(struct device *dev)
{
@@ -196,7 +230,11 @@ static int chan_match(struct device *dev
static struct bus_type chan_bus_type = {
.name = "dahdi_channels",
.match = chan_match,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
.dev_attrs = chan_dev_attrs,
+#else
+ .dev_groups = chan_dev_groups,
+#endif
};
static int chan_probe(struct device *dev)
Index: dahdi-linux-2.11.1~dfsg/drivers/dahdi/xpp/xbus-sysfs.c
===================================================================
--- dahdi-linux-2.11.1~dfsg.orig/drivers/dahdi/xpp/xbus-sysfs.c
+++ dahdi-linux-2.11.1~dfsg/drivers/dahdi/xpp/xbus-sysfs.c
@@ -339,6 +339,7 @@ static DEVICE_ATTR_READER(dahdi_registra
return len;
}
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
static struct device_attribute xbus_dev_attrs[] = {
__ATTR_RO(connector),
__ATTR_RO(label),
@@ -358,6 +359,42 @@ static struct device_attribute xbus_dev_
dahdi_registration_store),
__ATTR_NULL,
};
+#else
+static DEVICE_ATTR_RO(connector);
+static DEVICE_ATTR_RO(label);
+static DEVICE_ATTR_RO(status);
+static DEVICE_ATTR_RO(timing);
+static DEVICE_ATTR_RO(refcount_xbus);
+static DEVICE_ATTR_RO(waitfor_xpds);
+static DEVICE_ATTR_RO(driftinfo);
+static DEVICE_ATTR(cls, S_IWUSR, NULL, cls_store);
+static DEVICE_ATTR(xbus_state, S_IRUGO | S_IWUSR, xbus_state_show,
+ xbus_state_store);
+#ifdef SAMPLE_TICKS
+static DEVICE_ATTR(samples, S_IWUSR | S_IRUGO, samples_show, samples_store);
+#endif
+static DEVICE_ATTR(dahdi_registration, S_IRUGO | S_IWUSR,
+ dahdi_registration_show,
+ dahdi_registration_store);
+
+static struct attribute *xbus_dev_attrs[] = {
+ &dev_attr_connector.attr,
+ &dev_attr_label.attr,
+ &dev_attr_status.attr,
+ &dev_attr_timing.attr,
+ &dev_attr_refcount_xbus.attr,
+ &dev_attr_waitfor_xpds.attr,
+ &dev_attr_driftinfo.attr,
+ &dev_attr_cls.attr,
+ &dev_attr_xbus_state.attr,
+#ifdef SAMPLE_TICKS
+ &dev_attr_samples.attr,
+#endif
+ &dev_attr_dahdi_registration.attr,
+ NULL,
+};
+ATTRIBUTE_GROUPS(xbus_dev);
+#endif
static int astribank_match(struct device *dev, struct device_driver *driver)
{
@@ -457,10 +494,11 @@ static struct bus_type toplevel_bus_type
.name = "astribanks",
.match = astribank_match,
.uevent = astribank_uevent,
- .dev_attrs = xbus_dev_attrs,
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
+ .dev_attrs = xbus_dev_attrs,
.drv_attrs = xpp_attrs,
#else
+ .dev_groups = xbus_dev_groups,
.drv_groups = xpp_groups,
#endif
};
@@ -744,6 +782,7 @@ static int xpd_match(struct device *dev,
return 1;
}
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
static struct device_attribute xpd_dev_attrs[] = {
__ATTR(chipregs, S_IRUGO | S_IWUSR, chipregs_show, chipregs_store),
__ATTR(blink, S_IRUGO | S_IWUSR, blink_show, blink_store),
@@ -754,11 +793,36 @@ static struct device_attribute xpd_dev_a
__ATTR_RO(refcount_xpd),
__ATTR_NULL,
};
+#else
+DEVICE_ATTR(chipregs, S_IRUGO | S_IWUSR, chipregs_show, chipregs_store);
+DEVICE_ATTR(blink, S_IRUGO | S_IWUSR, blink_show, blink_store);
+DEVICE_ATTR(span, S_IRUGO | S_IWUSR, span_show, span_store);
+DEVICE_ATTR_RO(type);
+DEVICE_ATTR_RO(offhook);
+DEVICE_ATTR_RO(timing_priority);
+DEVICE_ATTR_RO(refcount_xpd);
+
+static struct attribute *xpd_dev_attrs[] = {
+ &dev_attr_chipregs.attr,
+ &dev_attr_blink.attr,
+ &dev_attr_span.attr,
+ &dev_attr_type.attr,
+ &dev_attr_offhook.attr,
+ &dev_attr_timing_priority.attr,
+ &dev_attr_refcount_xpd.attr,
+ NULL,
+};
+ATTRIBUTE_GROUPS(xpd_dev);
+#endif
static struct bus_type xpd_type = {
.name = "xpds",
.match = xpd_match,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
.dev_attrs = xpd_dev_attrs,
+#else
+ .dev_groups = xpd_dev_groups,
+#endif
};
int xpd_driver_register(struct device_driver *driver)
|