[package] rework 330-remove_m64_switch patch to be less intrusive, thanks nbd
[openwrt/svn-archive/archive.git] / libs / zaptel-1.4.x / patches / 305-class_device_removed.patch
1 diff -Nru zaptel-1.4.9.2.org/kernel/zaptel-base.c zaptel-1.4.9.2/kernel/zaptel-base.c
2 --- zaptel-1.4.9.2.org/kernel/zaptel-base.c 2008-02-28 20:00:47.000000000 +0100
3 +++ zaptel-1.4.9.2/kernel/zaptel-base.c 2008-11-29 16:01:23.000000000 +0100
4 @@ -163,12 +163,32 @@
5 /* udev necessary data structures. Yeah! */
6 #ifdef CONFIG_ZAP_UDEV
7
8 -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15)
9 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
10 +#define CLASS_DEV_CREATE(class, devt, device, name) \
11 + device_create(class, device, devt, NULL, "%s", name)
12 +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)
13 +#define CLASS_DEV_CREATE(class, devt, device, name) \
14 + device_create(class, device, devt, name)
15 +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15)
16 #define CLASS_DEV_CREATE(class, devt, device, name) \
17 class_device_create(class, NULL, devt, device, name)
18 -#else
19 +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13)
20 #define CLASS_DEV_CREATE(class, devt, device, name) \
21 class_device_create(class, devt, device, name)
22 +#else
23 +#define CLASS_DEV_CREATE(class, devt, device, name) \
24 + class_simple_device_add(class, devt, device, name)
25 +#endif
26 +
27 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)
28 +#define CLASS_DEV_DESTROY(class, devt) \
29 + device_destroy(class, devt)
30 +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13)
31 +#define CLASS_DEV_DESTROY(class, devt) \
32 + class_device_destroy(class, devt)
33 +#else
34 +#define CLASS_DEV_DESTROY(class, devt) \
35 + class_simple_device_remove(class, devt)
36 #endif
37
38 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13)
39 @@ -177,8 +197,6 @@
40 static struct class_simple *zap_class = NULL;
41 #define class_create class_simple_create
42 #define class_destroy class_simple_destroy
43 -#define class_device_create class_simple_device_add
44 -#define class_device_destroy(a, b) class_simple_device_remove(b)
45 #endif
46
47 #endif /* CONFIG_ZAP_UDEV */
48 @@ -4973,7 +4991,7 @@
49 #ifdef CONFIG_ZAP_UDEV
50 for (x = 0; x < span->channels; x++) {
51 if (span->chans[x].channo < 250)
52 - class_device_destroy(zap_class, MKDEV(ZT_MAJOR, span->chans[x].channo));
53 + CLASS_DEV_DESTROY(zap_class, MKDEV(ZT_MAJOR, span->chans[x].channo));
54 }
55 #endif /* CONFIG_ZAP_UDEV */
56
57 @@ -7355,7 +7373,7 @@
58 int zt_unregister_chardev(struct zt_chardev *dev)
59 {
60 #ifdef CONFIG_ZAP_UDEV
61 - class_device_destroy(zap_class, MKDEV(ZT_MAJOR, dev->minor));
62 + CLASS_DEV_DESTROY(zap_class, MKDEV(ZT_MAJOR, dev->minor));
63 #endif /* CONFIG_ZAP_UDEV */
64
65 #ifdef CONFIG_DEVFS_FS
66 @@ -7434,10 +7452,10 @@
67 devfs_unregister_chrdev(ZT_MAJOR, "zaptel");
68 #else
69 #ifdef CONFIG_ZAP_UDEV
70 - class_device_destroy(zap_class, MKDEV(ZT_MAJOR, 253)); /* timer */
71 - class_device_destroy(zap_class, MKDEV(ZT_MAJOR, 254)); /* channel */
72 - class_device_destroy(zap_class, MKDEV(ZT_MAJOR, 255)); /* pseudo */
73 - class_device_destroy(zap_class, MKDEV(ZT_MAJOR, 0)); /* ctl */
74 + CLASS_DEV_DESTROY(zap_class, MKDEV(ZT_MAJOR, 253)); /* timer */
75 + CLASS_DEV_DESTROY(zap_class, MKDEV(ZT_MAJOR, 254)); /* channel */
76 + CLASS_DEV_DESTROY(zap_class, MKDEV(ZT_MAJOR, 255)); /* pseudo */
77 + CLASS_DEV_DESTROY(zap_class, MKDEV(ZT_MAJOR, 0)); /* ctl */
78 class_destroy(zap_class);
79 #endif /* CONFIG_ZAP_UDEV */
80 unregister_chrdev(ZT_MAJOR, "zaptel");