[Asterisk-cvs] zaptel zaptel.c,1.109,1.110

kpfleming at lists.digium.com kpfleming at lists.digium.com
Fri Jul 8 20:10:39 CDT 2005


Update of /usr/cvsroot/zaptel
In directory localhost.localdomain:/tmp/cvs-serv24466

Modified Files:
	zaptel.c 
Log Message:
update to 2.6.13 sysfs API (bug #4639)


Index: zaptel.c
===================================================================
RCS file: /usr/cvsroot/zaptel/zaptel.c,v
retrieving revision 1.109
retrieving revision 1.110
diff -u -d -r1.109 -r1.110
--- zaptel.c	21 Jun 2005 23:52:40 -0000	1.109
+++ zaptel.c	9 Jul 2005 00:19:13 -0000	1.110
@@ -157,7 +157,15 @@
 
 /* udev necessary data structures.  Yeah! */
 #ifdef CONFIG_ZAP_UDEV
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13)
+static struct class *zap_class = NULL;
+#else
 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
 
 /* There is a table like this in the PPP driver, too */
@@ -4395,7 +4403,7 @@
 	for (x = 0; x < span->channels; x++) {
 		char chan_name[50];
 		sprintf(chan_name, "zap%d", span->chans[x].channo);
-		class_simple_device_add(zap_class, MKDEV(ZT_MAJOR, span->chans[x].channo), NULL, chan_name);
+		class_device_create(zap_class, MKDEV(ZT_MAJOR, span->chans[x].channo), NULL, chan_name);
 	}
 #endif /* CONFIG_ZAP_UDEV */
 
@@ -4445,7 +4453,7 @@
 
 #ifdef CONFIG_ZAP_UDEV
 	for (x = 0; x < span->channels; x++) {
-		class_simple_device_remove(MKDEV(ZT_MAJOR, span->chans[x].channo));
+		class_device_destroy(zap_class, MKDEV(ZT_MAJOR, span->chans[x].channo));
 	}
 #endif /* CONFIG_ZAP_UDEV */
 
@@ -6420,11 +6428,11 @@
 #endif
 
 #ifdef CONFIG_ZAP_UDEV /* udev support functions */
-	zap_class = class_simple_create(THIS_MODULE, "zaptel");
-	class_simple_device_add(zap_class, MKDEV(ZT_MAJOR, 253), NULL, "zaptimer");
-	class_simple_device_add(zap_class, MKDEV(ZT_MAJOR, 254), NULL, "zapchannel");
-	class_simple_device_add(zap_class, MKDEV(ZT_MAJOR, 255), NULL, "zappseudo");
-	class_simple_device_add(zap_class, MKDEV(ZT_MAJOR, 0), NULL, "zapctl");
+	zap_class = class_create(THIS_MODULE, "zaptel");
+	class_device_create(zap_class, MKDEV(ZT_MAJOR, 253), NULL, "zaptimer");
+	class_device_create(zap_class, MKDEV(ZT_MAJOR, 254), NULL, "zapchannel");
+	class_device_create(zap_class, MKDEV(ZT_MAJOR, 255), NULL, "zappseudo");
+	class_device_create(zap_class, MKDEV(ZT_MAJOR, 0), NULL, "zapctl");
 #endif /* CONFIG_ZAP_UDEV */
 
 #ifdef CONFIG_DEVFS_FS
@@ -6477,11 +6485,11 @@
 	devfs_unregister_chrdev(ZT_MAJOR, "zaptel");
 #else
 #ifdef CONFIG_ZAP_UDEV
-	class_simple_device_remove(MKDEV(ZT_MAJOR, 253)); /* timer */
-	class_simple_device_remove(MKDEV(ZT_MAJOR, 254)); /* channel */
-	class_simple_device_remove(MKDEV(ZT_MAJOR, 255)); /* pseudo */
-	class_simple_device_remove(MKDEV(ZT_MAJOR, 0)); /* ctl */
-	class_simple_destroy(zap_class);
+	class_device_destroy(zap_class, MKDEV(ZT_MAJOR, 253)); /* timer */
+	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_destroy(zap_class);
 #endif /* CONFIG_ZAP_UDEV */
 	unregister_chrdev(ZT_MAJOR, "zaptel");
 #endif




More information about the svn-commits mailing list