[packages] libs/zaptel-1.4.x: Fix compilation on 2.6.26 and later
[openwrt/svn-archive/archive.git] / libs / zaptel-1.4.x / patches / 305-class_device_removed.patch
1 --- zaptel-1.4.x/kernel/zaptel-base.c.orig 2008-08-18 12:55:48.000000000 +0200
2 +++ zaptel-1.4.x/kernel/zaptel-base.c 2008-08-18 12:49:25.000000000 +0200
3 @@ -163,13 +163,29 @@
4
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,26)
10 +#define CLASS_DEV_CREATE(class, devt, device, name) \
11 + device_create(class, device, devt, name)
12 +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15)
13 #define CLASS_DEV_CREATE(class, devt, device, name) \
14 class_device_create(class, NULL, devt, device, name)
15 -#else
16 +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13)
17 #define CLASS_DEV_CREATE(class, devt, device, name) \
18 class_device_create(class, devt, device, name)
19 +#else
20 +#define CLASS_DEV_CREATE(class, devt, device, name) \
21 + class_simple_device_add(class, devt, device, name)
22 +#endif
23 +
24 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)
25 +#define CLASS_DEV_DESTROY(class, devt) \
26 + device_destroy(class, devt)
27 +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13)
28 +#define CLASS_DEV_DESTROY(class, devt) \
29 + class_device_destroy(class, devt)
30 +#else
31 +#define CLASS_DEV_DESTROY(class, devt) \
32 + class_simple_device_remove(class, devt)
33 #endif
34
35 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13)
36 @@ -178,8 +194,6 @@
37 static struct class_simple *zap_class = NULL;
38 #define class_create class_simple_create
39 #define class_destroy class_simple_destroy
40 -#define class_device_create class_simple_device_add
41 -#define class_device_destroy(a, b) class_simple_device_remove(b)
42 #endif
43
44 #endif /* CONFIG_ZAP_UDEV */
45 @@ -5337,7 +5351,7 @@
46 #ifdef CONFIG_ZAP_UDEV
47 for (x = 0; x < span->channels; x++) {
48 if (span->chans[x].channo < 250)
49 - class_device_destroy(zap_class, MKDEV(ZT_MAJOR, span->chans[x].channo));
50 + CLASS_DEV_DESTROY(zap_class, MKDEV(ZT_MAJOR, span->chans[x].channo));
51 }
52 #endif /* CONFIG_ZAP_UDEV */
53
54 @@ -7825,7 +7839,7 @@
55 int zt_unregister_chardev(struct zt_chardev *dev)
56 {
57 #ifdef CONFIG_ZAP_UDEV
58 - class_device_destroy(zap_class, MKDEV(ZT_MAJOR, dev->minor));
59 + CLASS_DEV_DESTROY(zap_class, MKDEV(ZT_MAJOR, dev->minor));
60 #endif /* CONFIG_ZAP_UDEV */
61
62 #ifdef CONFIG_DEVFS_FS
63 @@ -7904,10 +7918,10 @@
64 devfs_unregister_chrdev(ZT_MAJOR, "zaptel");
65 #else
66 #ifdef CONFIG_ZAP_UDEV
67 - class_device_destroy(zap_class, MKDEV(ZT_MAJOR, 253)); /* timer */
68 - class_device_destroy(zap_class, MKDEV(ZT_MAJOR, 254)); /* channel */
69 - class_device_destroy(zap_class, MKDEV(ZT_MAJOR, 255)); /* pseudo */
70 - class_device_destroy(zap_class, MKDEV(ZT_MAJOR, 0)); /* ctl */
71 + CLASS_DEV_DESTROY(zap_class, MKDEV(ZT_MAJOR, 253)); /* timer */
72 + CLASS_DEV_DESTROY(zap_class, MKDEV(ZT_MAJOR, 254)); /* channel */
73 + CLASS_DEV_DESTROY(zap_class, MKDEV(ZT_MAJOR, 255)); /* pseudo */
74 + CLASS_DEV_DESTROY(zap_class, MKDEV(ZT_MAJOR, 0)); /* ctl */
75 class_destroy(zap_class);
76 #endif /* CONFIG_ZAP_UDEV */
77 unregister_chrdev(ZT_MAJOR, "zaptel");