summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTzafrir Cohen <tzafrir.cohen@xorcom.com>2011-01-03 10:49:22 +0000
committerTzafrir Cohen <tzafrir.cohen@xorcom.com>2011-01-03 10:49:22 +0000
commitebf065a99b77633016dcf7edb410219bfa362b03 (patch)
treec8d7038a1f2e2e3beaa8a0212ff44fce2ba23246
parentf600f0985529bf2f8f8b1ee6eb5798df3e2086c1 (diff)
constants for ctl, transcode, timer, channel, pseudo
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com> Acked-by: Shaun Ruffell <sruffell@digium.com> git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9552 a0bf4364-ded3-4de4-8d8a-66a801d63aff
-rw-r--r--drivers/dahdi/dahdi-base.c42
-rw-r--r--drivers/dahdi/dahdi_transcode.c2
-rw-r--r--include/dahdi/kernel.h6
3 files changed, 28 insertions, 22 deletions
diff --git a/drivers/dahdi/dahdi-base.c b/drivers/dahdi/dahdi-base.c
index adf31c3..5a5ce57 100644
--- a/drivers/dahdi/dahdi-base.c
+++ b/drivers/dahdi/dahdi-base.c
@@ -2886,7 +2886,7 @@ static int dahdi_open(struct inode *inode, struct file *file)
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 @@ static int dahdi_open(struct inode *inode, struct file *file)
}
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 @@ static int dahdi_release(struct inode *inode, struct file *file)
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 @@ static int dahdi_release(struct inode *inode, struct file *file)
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 @@ static int dahdi_ioctl(struct inode *inode, struct file *file,
lock_kernel();
#endif
- if (!unit) {
+ if (unit == DAHDI_CTL) {
ret = dahdi_ctl_ioctl(file, cmd, data);
goto unlock_exit;
}
@@ -6008,7 +6008,7 @@ static int dahdi_ioctl(struct inode *inode, struct file *file,
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 @@ static int dahdi_ioctl(struct inode *inode, struct file *file,
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 @@ static unsigned int dahdi_poll(struct file *file, struct poll_table_struct *wait
{
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 @@ static int __init dahdi_init(void)
}
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 @@ static void __exit dahdi_cleanup(void)
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");
diff --git a/drivers/dahdi/dahdi_transcode.c b/drivers/dahdi/dahdi_transcode.c
index c12bf5a..8bf886e 100644
--- a/drivers/dahdi/dahdi_transcode.c
+++ b/drivers/dahdi/dahdi_transcode.c
@@ -438,7 +438,7 @@ static struct file_operations __dahdi_transcode_fops = {
static struct dahdi_chardev transcode_chardev = {
.name = "transcode",
- .minor = 250,
+ .minor = DAHDI_TRANSCODE,
};
static int dahdi_transcode_init(void)
diff --git a/include/dahdi/kernel.h b/include/dahdi/kernel.h
index a0ecc32..36eb542 100644
--- a/include/dahdi/kernel.h
+++ b/include/dahdi/kernel.h
@@ -1301,6 +1301,12 @@ wait_for_completion_interruptible_timeout(struct completion *x,
#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, \