summaryrefslogtreecommitdiff
path: root/kernel/zaptel-base.c
diff options
context:
space:
mode:
authorkpfleming <kpfleming@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2008-08-14 01:57:01 +0000
committerkpfleming <kpfleming@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2008-08-14 01:57:01 +0000
commitc990a6d6901cc88a727578ab95a85280ec9a710d (patch)
tree252ca25de7a51b22ae82fd2c5298ed303d9af356 /kernel/zaptel-base.c
parent3001c9701d58c20c8f5b574cb34db89171191981 (diff)
backport new transcoder interface and driver from DAHDI
git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.4@4483 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'kernel/zaptel-base.c')
-rw-r--r--kernel/zaptel-base.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/kernel/zaptel-base.c b/kernel/zaptel-base.c
index 53b6f15..deeb01c 100644
--- a/kernel/zaptel-base.c
+++ b/kernel/zaptel-base.c
@@ -2579,30 +2579,29 @@ static void zt_free_pseudo(struct zt_chan *pseudo)
static int zt_open(struct inode *inode, struct file *file)
{
int unit = UNIT(file);
- int ret = -ENXIO;
+
struct zt_chan *chan;
/* Minor 0: Special "control" descriptor */
if (!unit)
return zt_ctl_open(inode, file);
if (unit == 250) {
if (!zt_transcode_fops)
- request_module("zttranscode");
- if (zt_transcode_fops && zt_transcode_fops->open) {
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
- if (zt_transcode_fops->owner) {
- __MOD_INC_USE_COUNT (zt_transcode_fops->owner);
-#else
- if (try_module_get(zt_transcode_fops->owner)) {
-#endif
- ret = zt_transcode_fops->open(inode, file);
- if (ret)
+ if (request_module("zttranscode")) {
+ return -ENXIO;
+ }
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
- __MOD_DEC_USE_COUNT (zt_transcode_fops->owner);
+ __MOD_INC_USE_COUNT (zt_transcode_fops->owner);
#else
- module_put(zt_transcode_fops->owner);
+ if (!try_module_get(zt_transcode_fops->owner)) {
+ return -ENXIO;
+ }
#endif
- }
- return ret;
+ if (zt_transcode_fops && zt_transcode_fops->open) {
+ return zt_transcode_fops->open(inode, file);
+ } else {
+ /* zttranscode module should have exported a
+ * file_operations table. */
+ WARN_ON(1);
}
return -ENXIO;
}
@@ -3124,14 +3123,11 @@ static int zt_release(struct inode *inode, struct file *file)
return zt_timer_release(inode, file);
}
if (unit == 250) {
- res = zt_transcode_fops->release(inode, file);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
- if (zt_transcode_fops->owner)
- __MOD_DEC_USE_COUNT (zt_transcode_fops->owner);
-#else
- module_put(zt_transcode_fops->owner);
-#endif
- return res;
+ /* We should not be here because the zttranscode.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;
@@ -5147,8 +5143,12 @@ static int zt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
if (!unit)
return zt_ctl_ioctl(inode, file, cmd, data);
- if (unit == 250)
- return zt_transcode_fops->ioctl(inode, file, cmd, data);
+ if (unit == 250) {
+ /* zttranscode 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;