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
This commit is contained in:
parent
e26a4d25c8
commit
5759e5a6a6
@ -2886,7 +2886,7 @@ static int dahdi_open(struct inode *inode, struct file *file)
|
|||||||
int unit = UNIT(file);
|
int unit = UNIT(file);
|
||||||
struct dahdi_chan *chan;
|
struct dahdi_chan *chan;
|
||||||
/* Minor 0: Special "control" descriptor */
|
/* Minor 0: Special "control" descriptor */
|
||||||
if (!unit)
|
if (unit == DAHDI_CTL)
|
||||||
return dahdi_ctl_open(file);
|
return dahdi_ctl_open(file);
|
||||||
if (unit == 250) {
|
if (unit == 250) {
|
||||||
if (!dahdi_transcode_fops) {
|
if (!dahdi_transcode_fops) {
|
||||||
@ -2910,16 +2910,16 @@ static int dahdi_open(struct inode *inode, struct file *file)
|
|||||||
}
|
}
|
||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
}
|
}
|
||||||
if (unit == 253) {
|
if (unit == DAHDI_TIMER) {
|
||||||
if (can_open_timer()) {
|
if (can_open_timer()) {
|
||||||
return dahdi_timing_open(file);
|
return dahdi_timing_open(file);
|
||||||
} else {
|
} else {
|
||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (unit == 254)
|
if (unit == DAHDI_CHANNEL)
|
||||||
return dahdi_chan_open(file);
|
return dahdi_chan_open(file);
|
||||||
if (unit == 255) {
|
if (unit == DAHDI_PSEUDO) {
|
||||||
chan = dahdi_alloc_pseudo();
|
chan = dahdi_alloc_pseudo();
|
||||||
if (chan) {
|
if (chan) {
|
||||||
file->private_data = chan;
|
file->private_data = chan;
|
||||||
@ -3383,9 +3383,9 @@ static int dahdi_release(struct inode *inode, struct file *file)
|
|||||||
int res;
|
int res;
|
||||||
struct dahdi_chan *chan;
|
struct dahdi_chan *chan;
|
||||||
|
|
||||||
if (!unit)
|
if (unit == DAHDI_CTL)
|
||||||
return dahdi_ctl_release(file);
|
return dahdi_ctl_release(file);
|
||||||
if (unit == 253) {
|
if (unit == DAHDI_TIMER) {
|
||||||
return dahdi_timer_release(file);
|
return dahdi_timer_release(file);
|
||||||
}
|
}
|
||||||
if (unit == 250) {
|
if (unit == 250) {
|
||||||
@ -3395,14 +3395,14 @@ static int dahdi_release(struct inode *inode, struct file *file)
|
|||||||
WARN_ON(1);
|
WARN_ON(1);
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
}
|
}
|
||||||
if (unit == 254) {
|
if (unit == DAHDI_CHANNEL) {
|
||||||
chan = file->private_data;
|
chan = file->private_data;
|
||||||
if (!chan)
|
if (!chan)
|
||||||
return dahdi_chan_release(file);
|
return dahdi_chan_release(file);
|
||||||
else
|
else
|
||||||
return dahdi_specchan_release(file);
|
return dahdi_specchan_release(file);
|
||||||
}
|
}
|
||||||
if (unit == 255) {
|
if (unit == DAHDI_PSEUDO) {
|
||||||
chan = file->private_data;
|
chan = file->private_data;
|
||||||
if (chan) {
|
if (chan) {
|
||||||
res = dahdi_specchan_release(file);
|
res = dahdi_specchan_release(file);
|
||||||
@ -5995,7 +5995,7 @@ static int dahdi_ioctl(struct inode *inode, struct file *file,
|
|||||||
lock_kernel();
|
lock_kernel();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!unit) {
|
if (unit == DAHDI_CTL) {
|
||||||
ret = dahdi_ctl_ioctl(file, cmd, data);
|
ret = dahdi_ctl_ioctl(file, cmd, data);
|
||||||
goto unlock_exit;
|
goto unlock_exit;
|
||||||
}
|
}
|
||||||
@ -6008,7 +6008,7 @@ static int dahdi_ioctl(struct inode *inode, struct file *file,
|
|||||||
goto unlock_exit;
|
goto unlock_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (unit == 253) {
|
if (unit == DAHDI_TIMER) {
|
||||||
timer = file->private_data;
|
timer = file->private_data;
|
||||||
if (timer)
|
if (timer)
|
||||||
ret = dahdi_timer_ioctl(file, cmd, data, 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;
|
ret = -EINVAL;
|
||||||
goto unlock_exit;
|
goto unlock_exit;
|
||||||
}
|
}
|
||||||
if (unit == 254) {
|
if (unit == DAHDI_CHANNEL) {
|
||||||
if (file->private_data)
|
if (file->private_data)
|
||||||
ret = dahdi_chan_ioctl(file, cmd, data);
|
ret = dahdi_chan_ioctl(file, cmd, data);
|
||||||
else
|
else
|
||||||
ret = dahdi_prechan_ioctl(file, cmd, data);
|
ret = dahdi_prechan_ioctl(file, cmd, data);
|
||||||
goto unlock_exit;
|
goto unlock_exit;
|
||||||
}
|
}
|
||||||
if (unit == 255) {
|
if (unit == DAHDI_PSEUDO) {
|
||||||
if (!file->private_data) {
|
if (!file->private_data) {
|
||||||
module_printk(KERN_NOTICE, "No pseudo channel structure to read?\n");
|
module_printk(KERN_NOTICE, "No pseudo channel structure to read?\n");
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
@ -8211,7 +8211,7 @@ static unsigned int dahdi_poll(struct file *file, struct poll_table_struct *wait
|
|||||||
{
|
{
|
||||||
const int unit = UNIT(file);
|
const int unit = UNIT(file);
|
||||||
|
|
||||||
if (likely(unit == 253))
|
if (likely(unit == DAHDI_TIMER))
|
||||||
return dahdi_timer_poll(file, wait_table);
|
return dahdi_timer_poll(file, wait_table);
|
||||||
|
|
||||||
/* transcoders and channels should have updated their file_operations
|
/* 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");
|
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, DAHDI_TIMER), NULL, "dahdi!timer");
|
||||||
CLASS_DEV_CREATE(dahdi_class, MKDEV(DAHDI_MAJOR, 254), NULL, "dahdi!channel");
|
CLASS_DEV_CREATE(dahdi_class, MKDEV(DAHDI_MAJOR, DAHDI_CHANNEL), NULL, "dahdi!channel");
|
||||||
CLASS_DEV_CREATE(dahdi_class, MKDEV(DAHDI_MAJOR, 255), NULL, "dahdi!pseudo");
|
CLASS_DEV_CREATE(dahdi_class, MKDEV(DAHDI_MAJOR, DAHDI_PSEUDO), NULL, "dahdi!pseudo");
|
||||||
CLASS_DEV_CREATE(dahdi_class, MKDEV(DAHDI_MAJOR, 0), NULL, "dahdi!ctl");
|
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, "Telephony Interface Registered on major %d\n", DAHDI_MAJOR);
|
||||||
module_printk(KERN_INFO, "Version: %s\n", DAHDI_VERSION);
|
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);
|
dahdi_unregister_echocan_factory(&hwec_factory);
|
||||||
coretimer_cleanup();
|
coretimer_cleanup();
|
||||||
|
|
||||||
CLASS_DEV_DESTROY(dahdi_class, MKDEV(DAHDI_MAJOR, 253)); /* timer */
|
CLASS_DEV_DESTROY(dahdi_class, MKDEV(DAHDI_MAJOR, DAHDI_TIMER)); /* timer */
|
||||||
CLASS_DEV_DESTROY(dahdi_class, MKDEV(DAHDI_MAJOR, 254)); /* channel */
|
CLASS_DEV_DESTROY(dahdi_class, MKDEV(DAHDI_MAJOR, DAHDI_CHANNEL)); /* channel */
|
||||||
CLASS_DEV_DESTROY(dahdi_class, MKDEV(DAHDI_MAJOR, 255)); /* pseudo */
|
CLASS_DEV_DESTROY(dahdi_class, MKDEV(DAHDI_MAJOR, DAHDI_PSEUDO)); /* pseudo */
|
||||||
CLASS_DEV_DESTROY(dahdi_class, MKDEV(DAHDI_MAJOR, 0)); /* ctl */
|
CLASS_DEV_DESTROY(dahdi_class, MKDEV(DAHDI_MAJOR, DAHDI_CTL)); /* ctl */
|
||||||
class_destroy(dahdi_class);
|
class_destroy(dahdi_class);
|
||||||
|
|
||||||
unregister_chrdev(DAHDI_MAJOR, "dahdi");
|
unregister_chrdev(DAHDI_MAJOR, "dahdi");
|
||||||
|
@ -438,7 +438,7 @@ static struct file_operations __dahdi_transcode_fops = {
|
|||||||
|
|
||||||
static struct dahdi_chardev transcode_chardev = {
|
static struct dahdi_chardev transcode_chardev = {
|
||||||
.name = "transcode",
|
.name = "transcode",
|
||||||
.minor = 250,
|
.minor = DAHDI_TRANSCODE,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int dahdi_transcode_init(void)
|
static int dahdi_transcode_init(void)
|
||||||
|
@ -1301,6 +1301,12 @@ wait_for_completion_interruptible_timeout(struct completion *x,
|
|||||||
#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
|
#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define DAHDI_CTL 0
|
||||||
|
#define DAHDI_TRANSCODE 250
|
||||||
|
#define DAHDI_TIMER 253
|
||||||
|
#define DAHDI_CHANNEL 254
|
||||||
|
#define DAHDI_PSEUDO 255
|
||||||
|
|
||||||
/* prink-wrapper macros */
|
/* prink-wrapper macros */
|
||||||
#define DAHDI_PRINTK(level, category, fmt, ...) \
|
#define DAHDI_PRINTK(level, category, fmt, ...) \
|
||||||
printk(KERN_ ## level "%s%s-%s: " fmt, #level, category, \
|
printk(KERN_ ## level "%s%s-%s: " fmt, #level, category, \
|
||||||
|
Loading…
Reference in New Issue
Block a user