summaryrefslogtreecommitdiff
path: root/drivers/dahdi/dahdi-base.c
diff options
context:
space:
mode:
authorShaun Ruffell <sruffell@digium.com>2008-08-06 18:09:58 +0000
committerShaun Ruffell <sruffell@digium.com>2008-08-06 18:09:58 +0000
commitcd4763bcfad087a8e2e33464e79b4f69a5f31094 (patch)
treed83edd7008142c8d6c7625b7dde044277925a84f /drivers/dahdi/dahdi-base.c
parent44ff5a846de3b86f60ae420e3e67a2827fb68f11 (diff)
A significant change to the DAHDI transcoder interface and the wctc4xxp
driver which breaks backwards compatibility. Basically, I've replaced the memory mapped interface with a read/write interface that allows codec_dahdi to communicate with the hardware transcoder the exact size of the packet to be transcoded. This eliminates issues with remote devices that send G729.B CNG packets even though asterisk does not support them. From a user standpoint: - The transcoder drivers are much more robust in light of system / external conditions. From a developer standpoint: - DAHDI_TRANSCODE_OP is no longer supported, instead use DAHDI_TC_ALLOCATE, DAHDI_TC_GETINFO, and write/read. - Memory and stack usage is reduced (stack usage could still be reduced some more by continuing the process of getting rid of the users of wctc4xxp_send_cmd and wctc4xxp_create_cmd). - If more than one card is in the system channels will be allocated in a round-robin fashion from all available cards, reducing contention for the supervisor channel. - There is no longer a tc400b workqueue created that will not show up in the process list. - Commands and their responses are now explicitly matched up which elimated certain errors caused by unsolicited messages from the transcoder confusing the driver. - There is now an option to export a network interface for capturing traffic to/from the hardware transcoder. - codec_test has been removed from the dadhi/linux package. git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@4717 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'drivers/dahdi/dahdi-base.c')
-rw-r--r--drivers/dahdi/dahdi-base.c52
1 files changed, 26 insertions, 26 deletions
diff --git a/drivers/dahdi/dahdi-base.c b/drivers/dahdi/dahdi-base.c
index 3a18631..4e0f477 100644
--- a/drivers/dahdi/dahdi-base.c
+++ b/drivers/dahdi/dahdi-base.c
@@ -2620,30 +2620,29 @@ static void dahdi_free_pseudo(struct dahdi_chan *pseudo)
static int dahdi_open(struct inode *inode, struct file *file)
{
int unit = UNIT(file);
- int ret = -ENXIO;
struct dahdi_chan *chan;
/* Minor 0: Special "control" descriptor */
if (!unit)
return dahdi_ctl_open(inode, file);
if (unit == 250) {
- if (!dahdi_transcode_fops)
- request_module("dahdi_transcode");
- if (dahdi_transcode_fops && dahdi_transcode_fops->open) {
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
- if (dahdi_transcode_fops->owner) {
- __MOD_INC_USE_COUNT (dahdi_transcode_fops->owner);
-#else
- if (try_module_get(dahdi_transcode_fops->owner)) {
-#endif
- ret = dahdi_transcode_fops->open(inode, file);
- if (ret)
+ if (!dahdi_transcode_fops) {
+ if (request_module("dahdi_transcode")) {
+ return -ENXIO;
+ }
+ }
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
- __MOD_DEC_USE_COUNT (dahdi_transcode_fops->owner);
+ __MOD_INC_USE_COUNT (dahdi_transcode_fops->owner);
#else
- module_put(dahdi_transcode_fops->owner);
+ if (!try_module_get(dahdi_transcode_fops->owner)) {
+ return -ENXIO;
+ }
#endif
- }
- return ret;
+ if (dahdi_transcode_fops && dahdi_transcode_fops->open) {
+ return dahdi_transcode_fops->open(inode, file);
+ } else {
+ /* dahdi_transcode module should have exported a
+ * file_operations table. */
+ WARN_ON(1);
}
return -ENXIO;
}
@@ -3163,14 +3162,11 @@ static int dahdi_release(struct inode *inode, struct file *file)
return dahdi_timer_release(inode, file);
}
if (unit == 250) {
- res = dahdi_transcode_fops->release(inode, file);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
- if (dahdi_transcode_fops->owner)
- __MOD_DEC_USE_COUNT (dahdi_transcode_fops->owner);
-#else
- module_put(dahdi_transcode_fops->owner);
-#endif
- return res;
+ /* We should not be here because the dahdi_transcode.ko module
+ * should have updated the file_operations for this file
+ * handle when the file was opened. */
+ WARN_ON(1);
+ return -EFAULT;
}
if (unit == 254) {
chan = file->private_data;
@@ -5249,8 +5245,12 @@ static int dahdi_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
if (!unit)
return dahdi_ctl_ioctl(inode, file, cmd, data);
- if (unit == 250)
- return dahdi_transcode_fops->ioctl(inode, file, cmd, data);
+ if (unit == 250) {
+ /* dahdi_transcode should have updated the file_operations on
+ * this file object on open, so we shouldn't be here. */
+ WARN_ON(1);
+ return -EFAULT;
+ }
if (unit == 253) {
timer = file->private_data;