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