[zaptel-commits] tzafrir: branch 1.4 r4511 - in /branches/1.4: ./ kernel/zaptel-base.c

SVN commits to the Zaptel project zaptel-commits at lists.digium.com
Wed Sep 3 13:52:46 CDT 2008


Author: tzafrir
Date: Wed Sep  3 13:52:46 2008
New Revision: 4511

URL: http://svn.digium.com/view/zaptel?view=rev&rev=4511
Log:
Before creating a device, register the major number.
Otherwise we need to clean-up those devices in case of failure, and we
don't. 

This fixes the case of accidentally loading zaptel after loading dahdi
(Already fixed in DAHDI).

Merged revisions 4509 via svnmerge from 
http://svn.digium.com/svn/zaptel/branches/1.2

Modified:
    branches/1.4/   (props changed)
    branches/1.4/kernel/zaptel-base.c

Propchange: branches/1.4/
------------------------------------------------------------------------------
--- branch-1.2-blocked (original)
+++ branch-1.2-blocked Wed Sep  3 13:52:46 2008
@@ -1,1 +1,1 @@
-/branches/1.2:917,937,1073,1206,1613,2018,2434,2583,2668,2750,2789,2868,2871,2878,3083,3098-3099,3201,3509,3645,3833,3847,3917,3951,4037-4038,4117,4233,4442,4461-4463
+/branches/1.2:917,937,1073,1206,1613,2018,2434,2583,2668,2750,2789,2868,2871,2878,3083,3098-3099,3201,3509,3645,3833,3847,3917,3951,4037-4038,4117,4233,4442,4461-4463,4510

Propchange: branches/1.4/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.

Modified: branches/1.4/kernel/zaptel-base.c
URL: http://svn.digium.com/view/zaptel/branches/1.4/kernel/zaptel-base.c?view=diff&rev=4511&r1=4510&r2=4511
==============================================================================
--- branches/1.4/kernel/zaptel-base.c (original)
+++ branches/1.4/kernel/zaptel-base.c Wed Sep  3 13:52:46 2008
@@ -7736,6 +7736,25 @@
 static int __init zt_init(void) {
 	int res = 0;
 
+#ifdef CONFIG_DEVFS_FS
+	{
+		umode_t mode = S_IFCHR|S_IRUGO|S_IWUGO;
+
+		devfs_register_chrdev(ZT_MAJOR, "zaptel", &zt_fops);
+		if (!(zaptel_devfs_dir = devfs_mk_dir(NULL, "zap", NULL)))
+			return -EBUSY; /* This would be bad */
+		timer = devfs_register(zaptel_devfs_dir, "timer", DEVFS_FL_DEFAULT, ZT_MAJOR, 253, mode, &zt_fops, NULL);
+		channel = devfs_register(zaptel_devfs_dir, "channel", DEVFS_FL_DEFAULT, ZT_MAJOR, 254, mode, &zt_fops, NULL);
+		pseudo = devfs_register(zaptel_devfs_dir, "pseudo", DEVFS_FL_DEFAULT, ZT_MAJOR, 255, mode, &zt_fops, NULL);
+		ctl = devfs_register(zaptel_devfs_dir, "ctl", DEVFS_FL_DEFAULT, ZT_MAJOR, 0, mode, &zt_fops, NULL);
+	}
+#else
+	if ((res = register_chrdev(ZT_MAJOR, "zaptel", &zt_fops))) {
+		printk(KERN_ERR "Unable to register Zaptel character device handler on %d\n", ZT_MAJOR);
+		return res;
+	}
+#endif /* CONFIG_DEVFS_FS */
+
 #ifdef CONFIG_PROC_FS
 	proc_entries[0] = proc_mkdir("zaptel", NULL);
 #endif
@@ -7747,25 +7766,6 @@
 	CLASS_DEV_CREATE(zap_class, MKDEV(ZT_MAJOR, 255), NULL, "zappseudo");
 	CLASS_DEV_CREATE(zap_class, MKDEV(ZT_MAJOR, 0), NULL, "zapctl");
 #endif /* CONFIG_ZAP_UDEV */
-
-#ifdef CONFIG_DEVFS_FS
-	{
-		umode_t mode = S_IFCHR|S_IRUGO|S_IWUGO;
-
-		devfs_register_chrdev(ZT_MAJOR, "zaptel", &zt_fops);
-		if (!(zaptel_devfs_dir = devfs_mk_dir(NULL, "zap", NULL)))
-			return -EBUSY; /* This would be bad */
-		timer = devfs_register(zaptel_devfs_dir, "timer", DEVFS_FL_DEFAULT, ZT_MAJOR, 253, mode, &zt_fops, NULL);
-		channel = devfs_register(zaptel_devfs_dir, "channel", DEVFS_FL_DEFAULT, ZT_MAJOR, 254, mode, &zt_fops, NULL);
-		pseudo = devfs_register(zaptel_devfs_dir, "pseudo", DEVFS_FL_DEFAULT, ZT_MAJOR, 255, mode, &zt_fops, NULL);
-		ctl = devfs_register(zaptel_devfs_dir, "ctl", DEVFS_FL_DEFAULT, ZT_MAJOR, 0, mode, &zt_fops, NULL);
-	}
-#else
-	if ((res = register_chrdev(ZT_MAJOR, "zaptel", &zt_fops))) {
-		printk(KERN_ERR "Unable to register Zaptel character device handler on %d\n", ZT_MAJOR);
-		return res;
-	}
-#endif /* CONFIG_DEVFS_FS */
 
 	printk(KERN_INFO "Zapata Telephony Interface Registered on major %d\n", ZT_MAJOR);
 	printk(KERN_INFO "Zaptel Version: %s\n", ZAPTEL_VERSION);




More information about the zaptel-commits mailing list