[svn-commits] tzafrir: linux/trunk r9552 - in /linux/trunk: drivers/dahdi/ include/dahdi/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Jan 3 10:49:29 UTC 2011


Author: tzafrir
Date: Mon Jan  3 04:49:22 2011
New Revision: 9552

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=9552
Log:
constants for ctl, transcode, timer, channel, pseudo

Signed-off-by: Tzafrir Cohen <tzafrir.cohen at xorcom.com>
Acked-by: Shaun Ruffell <sruffell at digium.com>

Modified:
    linux/trunk/drivers/dahdi/dahdi-base.c
    linux/trunk/drivers/dahdi/dahdi_transcode.c
    linux/trunk/include/dahdi/kernel.h

Modified: linux/trunk/drivers/dahdi/dahdi-base.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/dahdi-base.c?view=diff&rev=9552&r1=9551&r2=9552
==============================================================================
--- linux/trunk/drivers/dahdi/dahdi-base.c (original)
+++ linux/trunk/drivers/dahdi/dahdi-base.c Mon Jan  3 04:49:22 2011
@@ -2886,7 +2886,7 @@
 	int unit = UNIT(file);
 	struct dahdi_chan *chan;
 	/* Minor 0: Special "control" descriptor */
-	if (!unit)
+	if (unit == DAHDI_CTL)
 		return dahdi_ctl_open(file);
 	if (unit == 250) {
 		if (!dahdi_transcode_fops) {
@@ -2910,16 +2910,16 @@
 		}
 		return -ENXIO;
 	}
-	if (unit == 253) {
+	if (unit == DAHDI_TIMER) {
 		if (can_open_timer()) {
 			return dahdi_timing_open(file);
 		} else {
 			return -ENXIO;
 		}
 	}
-	if (unit == 254)
+	if (unit == DAHDI_CHANNEL)
 		return dahdi_chan_open(file);
-	if (unit == 255) {
+	if (unit == DAHDI_PSEUDO) {
 		chan = dahdi_alloc_pseudo();
 		if (chan) {
 			file->private_data = chan;
@@ -3383,9 +3383,9 @@
 	int res;
 	struct dahdi_chan *chan;
 
-	if (!unit)
+	if (unit == DAHDI_CTL)
 		return dahdi_ctl_release(file);
-	if (unit == 253) {
+	if (unit == DAHDI_TIMER) {
 		return dahdi_timer_release(file);
 	}
 	if (unit == 250) {
@@ -3395,14 +3395,14 @@
 		WARN_ON(1);
 		return -EFAULT;
 	}
-	if (unit == 254) {
+	if (unit == DAHDI_CHANNEL) {
 		chan = file->private_data;
 		if (!chan)
 			return dahdi_chan_release(file);
 		else
 			return dahdi_specchan_release(file);
 	}
-	if (unit == 255) {
+	if (unit == DAHDI_PSEUDO) {
 		chan = file->private_data;
 		if (chan) {
 			res = dahdi_specchan_release(file);
@@ -5995,7 +5995,7 @@
 	lock_kernel();
 #endif
 
-	if (!unit) {
+	if (unit == DAHDI_CTL) {
 		ret = dahdi_ctl_ioctl(file, cmd, data);
 		goto unlock_exit;
 	}
@@ -6008,7 +6008,7 @@
 		goto unlock_exit;
 	}
 
-	if (unit == 253) {
+	if (unit == DAHDI_TIMER) {
 		timer = file->private_data;
 		if (timer)
 			ret = dahdi_timer_ioctl(file, cmd, data, timer);
@@ -6016,14 +6016,14 @@
 			ret = -EINVAL;
 		goto unlock_exit;
 	}
-	if (unit == 254) {
+	if (unit == DAHDI_CHANNEL) {
 		if (file->private_data)
 			ret = dahdi_chan_ioctl(file, cmd, data);
 		else
 			ret = dahdi_prechan_ioctl(file, cmd, data);
 		goto unlock_exit;
 	}
-	if (unit == 255) {
+	if (unit == DAHDI_PSEUDO) {
 		if (!file->private_data) {
 			module_printk(KERN_NOTICE, "No pseudo channel structure to read?\n");
 			ret = -EINVAL;
@@ -8211,7 +8211,7 @@
 {
 	const int unit = UNIT(file);
 
-	if (likely(unit == 253))
+	if (likely(unit == DAHDI_TIMER))
 		return dahdi_timer_poll(file, wait_table);
 
 	/* transcoders and channels should have updated their file_operations
@@ -8912,10 +8912,10 @@
 	}
 
 	dahdi_class = class_create(THIS_MODULE, "dahdi");
-	CLASS_DEV_CREATE(dahdi_class, MKDEV(DAHDI_MAJOR, 253), NULL, "dahdi!timer");
-	CLASS_DEV_CREATE(dahdi_class, MKDEV(DAHDI_MAJOR, 254), NULL, "dahdi!channel");
-	CLASS_DEV_CREATE(dahdi_class, MKDEV(DAHDI_MAJOR, 255), NULL, "dahdi!pseudo");
-	CLASS_DEV_CREATE(dahdi_class, MKDEV(DAHDI_MAJOR, 0), NULL, "dahdi!ctl");
+	CLASS_DEV_CREATE(dahdi_class, MKDEV(DAHDI_MAJOR, DAHDI_TIMER), NULL, "dahdi!timer");
+	CLASS_DEV_CREATE(dahdi_class, MKDEV(DAHDI_MAJOR, DAHDI_CHANNEL), NULL, "dahdi!channel");
+	CLASS_DEV_CREATE(dahdi_class, MKDEV(DAHDI_MAJOR, DAHDI_PSEUDO), NULL, "dahdi!pseudo");
+	CLASS_DEV_CREATE(dahdi_class, MKDEV(DAHDI_MAJOR, DAHDI_CTL), NULL, "dahdi!ctl");
 
 	module_printk(KERN_INFO, "Telephony Interface Registered on major %d\n", DAHDI_MAJOR);
 	module_printk(KERN_INFO, "Version: %s\n", DAHDI_VERSION);
@@ -8942,10 +8942,10 @@
 	dahdi_unregister_echocan_factory(&hwec_factory);
 	coretimer_cleanup();
 
-	CLASS_DEV_DESTROY(dahdi_class, MKDEV(DAHDI_MAJOR, 253)); /* timer */
-	CLASS_DEV_DESTROY(dahdi_class, MKDEV(DAHDI_MAJOR, 254)); /* channel */
-	CLASS_DEV_DESTROY(dahdi_class, MKDEV(DAHDI_MAJOR, 255)); /* pseudo */
-	CLASS_DEV_DESTROY(dahdi_class, MKDEV(DAHDI_MAJOR, 0)); /* ctl */
+	CLASS_DEV_DESTROY(dahdi_class, MKDEV(DAHDI_MAJOR, DAHDI_TIMER)); /* timer */
+	CLASS_DEV_DESTROY(dahdi_class, MKDEV(DAHDI_MAJOR, DAHDI_CHANNEL)); /* channel */
+	CLASS_DEV_DESTROY(dahdi_class, MKDEV(DAHDI_MAJOR, DAHDI_PSEUDO)); /* pseudo */
+	CLASS_DEV_DESTROY(dahdi_class, MKDEV(DAHDI_MAJOR, DAHDI_CTL)); /* ctl */
 	class_destroy(dahdi_class);
 
 	unregister_chrdev(DAHDI_MAJOR, "dahdi");

Modified: linux/trunk/drivers/dahdi/dahdi_transcode.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/dahdi_transcode.c?view=diff&rev=9552&r1=9551&r2=9552
==============================================================================
--- linux/trunk/drivers/dahdi/dahdi_transcode.c (original)
+++ linux/trunk/drivers/dahdi/dahdi_transcode.c Mon Jan  3 04:49:22 2011
@@ -438,7 +438,7 @@
 
 static struct dahdi_chardev transcode_chardev = {
 	.name = "transcode",
-	.minor = 250,
+	.minor = DAHDI_TRANSCODE,
 };
 
 static int dahdi_transcode_init(void)

Modified: linux/trunk/include/dahdi/kernel.h
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/include/dahdi/kernel.h?view=diff&rev=9552&r1=9551&r2=9552
==============================================================================
--- linux/trunk/include/dahdi/kernel.h (original)
+++ linux/trunk/include/dahdi/kernel.h Mon Jan  3 04:49:22 2011
@@ -1301,6 +1301,12 @@
 #define DMA_BIT_MASK(n)	(((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
 #endif
 
+#define	DAHDI_CTL	0
+#define	DAHDI_TRANSCODE	250
+#define	DAHDI_TIMER	253
+#define	DAHDI_CHANNEL	254
+#define	DAHDI_PSEUDO	255
+
 /* prink-wrapper macros */
 #define	DAHDI_PRINTK(level, category, fmt, ...)	\
 	printk(KERN_ ## level "%s%s-%s: " fmt, #level, category, \




More information about the svn-commits mailing list