summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2008-07-21 09:12:32 +0000
committertzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2008-07-21 09:12:32 +0000
commitebed9806361dd77b7c840282e48dee261d247ab2 (patch)
tree3918ffa9dd965136f27e2f4e687b3e75719c3a09
parentca6ee333c18fdc3b5ed68d9a44eb32bb23a09539 (diff)
Fix building zaptel 1.2 with kernel 2.6.26. Taken from DAHDI-linux rev.
4522. For issue #12944 . git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.2@4424 5390a7c7-147a-4af0-8ec9-7488f05a26cb
-rw-r--r--zaptel-base.c33
1 files changed, 24 insertions, 9 deletions
diff --git a/zaptel-base.c b/zaptel-base.c
index 3b8d175..7c55a40 100644
--- a/zaptel-base.c
+++ b/zaptel-base.c
@@ -156,12 +156,29 @@ static devfs_handle_t transcode;
/* udev necessary data structures. Yeah! */
#ifdef CONFIG_ZAP_UDEV
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)
+#define CLASS_DEV_CREATE(class, devt, device, name) \
+ device_create(class, device, devt, name)
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15)
#define CLASS_DEV_CREATE(class, devt, device, name) \
class_device_create(class, NULL, devt, device, name)
-#else
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13)
#define CLASS_DEV_CREATE(class, devt, device, name) \
class_device_create(class, devt, device, name)
+#else
+#define CLASS_DEV_CREATE(class, devt, device, name) \
+ class_simple_device_add(class, devt, device, name)
+#endif
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)
+#define CLASS_DEV_DESTROY(class, devt) \
+ device_destroy(class, devt)
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13)
+#define CLASS_DEV_DESTROY(class, devt) \
+ class_device_destroy(class, devt)
+#else
+#define CLASS_DEV_DESTROY(class, devt) \
+ class_simple_device_remove(class, devt)
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13)
@@ -170,8 +187,6 @@ static struct class *zap_class = NULL;
static struct class_simple *zap_class = NULL;
#define class_create class_simple_create
#define class_destroy class_simple_destroy
-#define class_device_create class_simple_device_add
-#define class_device_destroy(a, b) class_simple_device_remove(b)
#endif
#endif /* CONFIG_ZAP_UDEV */
@@ -6809,11 +6824,11 @@ static void __exit zt_cleanup(void) {
devfs_unregister_chrdev(ZT_MAJOR, "zaptel");
#else
#ifdef CONFIG_ZAP_UDEV
- class_device_destroy(zap_class, MKDEV(ZT_MAJOR, 253)); /* timer */
- class_device_destroy(zap_class, MKDEV(ZT_MAJOR, 250)); /* transcode */
- class_device_destroy(zap_class, MKDEV(ZT_MAJOR, 254)); /* channel */
- class_device_destroy(zap_class, MKDEV(ZT_MAJOR, 255)); /* pseudo */
- class_device_destroy(zap_class, MKDEV(ZT_MAJOR, 0)); /* ctl */
+ CLASS_DEV_DESTROY(zap_class, MKDEV(ZT_MAJOR, 253)); /* timer */
+ CLASS_DEV_DESTROY(zap_class, MKDEV(ZT_MAJOR, 250)); /* transcode */
+ CLASS_DEV_DESTROY(zap_class, MKDEV(ZT_MAJOR, 254)); /* channel */
+ CLASS_DEV_DESTROY(zap_class, MKDEV(ZT_MAJOR, 255)); /* pseudo */
+ CLASS_DEV_DESTROY(zap_class, MKDEV(ZT_MAJOR, 0)); /* ctl */
class_destroy(zap_class);
#endif /* CONFIG_ZAP_UDEV */
unregister_chrdev(ZT_MAJOR, "zaptel");