]> git.pld-linux.org Git - packages/dahdi-linux.git/blob - kernel-4.13.patch
- add fixes required to build with kernel 4.15
[packages/dahdi-linux.git] / kernel-4.13.patch
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,
6         return len;
7  }
8  
9 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
10  static struct device_attribute span_dev_attrs[] = {
11         __ATTR_RO(name),
12         __ATTR_RO(desc),
13 @@ -230,6 +231,39 @@ static struct device_attribute span_dev_
14         __ATTR_RO(linecompat),
15         __ATTR_NULL,
16  };
17 +#else
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);
31 +
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,
38 +       &dev_attr_lbo.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,
46 +       NULL,
47 +};
48 +ATTRIBUTE_GROUPS(span_dev);
49 +#endif
50  
51  static ssize_t master_span_show(struct device_driver *driver, char *buf)
52  {
53 @@ -270,10 +304,11 @@ static struct bus_type spans_bus_type =
54         .name           = "dahdi_spans",
55         .match          = span_match,
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,
61  #else
62 +       .dev_groups     = span_dev_groups,
63         .drv_groups     = dahdi_groups,
64  #endif
65  };
66 @@ -690,6 +725,7 @@ dahdi_registration_time_show(struct devi
67         return count;
68  }
69  
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),
76         __ATTR_NULL,
77  };
78 +#else
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);
87 +/*
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.
91 + */
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);
95 +
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,
107 +       NULL,
108 +};
109 +ATTRIBUTE_GROUPS(dahdi_device);
110 +#endif
111  
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,
117 +#else
118 +       .dev_groups = dahdi_device_groups,
119 +#endif
120  };
121  
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
128         return len;
129  }
130  
131 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
132  static struct device_attribute chan_dev_attrs[] = {
133         __ATTR_RO(name),
134         __ATTR_RO(channo),
135 @@ -174,6 +175,39 @@ static struct device_attribute chan_dev_
136         __ATTR_RO(in_use),
137         __ATTR_NULL,
138  };
139 +#else
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);
151 +#endif
152 +static DEVICE_ATTR_RO(in_use);
153 +
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,
166 +#endif
167 +       &dev_attr_in_use.attr,
168 +       NULL,
169 +};
170 +ATTRIBUTE_GROUPS(chan_dev);
171 +#endif
172  
173  static void chan_release(struct device *dev)
174  {
175 @@ -196,7 +230,11 @@ static int chan_match(struct device *dev
176  static struct bus_type chan_bus_type = {
177         .name           = "dahdi_channels",
178         .match          = chan_match,
179 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
180         .dev_attrs      = chan_dev_attrs,
181 +#else
182 +       .dev_groups     = chan_dev_groups,
183 +#endif
184  };
185  
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
192         return len;
193  }
194  
195 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
196  static struct device_attribute xbus_dev_attrs[] = {
197         __ATTR_RO(connector),
198         __ATTR_RO(label),
199 @@ -358,6 +359,42 @@ static struct device_attribute xbus_dev_
200                 dahdi_registration_store),
201         __ATTR_NULL,
202  };
203 +#else
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,
213 +                  xbus_state_store);
214 +#ifdef SAMPLE_TICKS
215 +static DEVICE_ATTR(samples, S_IWUSR | S_IRUGO, samples_show, samples_store);
216 +#endif
217 +static DEVICE_ATTR(dahdi_registration, S_IRUGO | S_IWUSR,
218 +                  dahdi_registration_show,
219 +                  dahdi_registration_store);
220 +
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,
231 +#ifdef SAMPLE_TICKS
232 +       &dev_attr_samples.attr,
233 +#endif
234 +       &dev_attr_dahdi_registration.attr,
235 +       NULL,
236 +};
237 +ATTRIBUTE_GROUPS(xbus_dev);
238 +#endif
239  
240  static int astribank_match(struct device *dev, struct device_driver *driver)
241  {
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,
250  #else
251 +       .dev_groups = xbus_dev_groups,
252         .drv_groups = xpp_groups,
253  #endif
254  };
255 @@ -744,6 +782,7 @@ static int xpd_match(struct device *dev,
256         return 1;
257  }
258  
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),
265         __ATTR_NULL,
266  };
267 +#else
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);
275 +
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,
284 +       NULL,
285 +};
286 +ATTRIBUTE_GROUPS(xpd_dev);
287 +#endif
288  
289  static struct bus_type xpd_type = {
290         .name = "xpds",
291         .match = xpd_match,
292 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
293         .dev_attrs = xpd_dev_attrs,
294 +#else
295 +       .dev_groups = xpd_dev_groups,
296 +#endif
297  };
298  
299  int xpd_driver_register(struct device_driver *driver)
This page took 0.061111 seconds and 3 git commands to generate.