summaryrefslogtreecommitdiff
path: root/linux/drivers/media/common/saa7146_fops.c
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drivers/media/common/saa7146_fops.c')
-rw-r--r--linux/drivers/media/common/saa7146_fops.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/linux/drivers/media/common/saa7146_fops.c b/linux/drivers/media/common/saa7146_fops.c
index 2c5596e77..217b85f14 100644
--- a/linux/drivers/media/common/saa7146_fops.c
+++ b/linux/drivers/media/common/saa7146_fops.c
@@ -4,6 +4,19 @@
#define KBUILD_MODNAME saa7146
#endif
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,48))
+static inline
+int try_module_get(struct module *mod)
+{
+ if (!MOD_CAN_QUERY(mod))
+ return 0;
+ __MOD_INC_USE_COUNT(mod);
+ return 1;
+}
+
+#define module_put(mod) __MOD_DEC_USE_COUNT(mod)
+#endif
+
#define BOARD_CAN_DO_VBI(dev) (dev->revision != 0 && dev->vv_data->vbi_minor != -1)
/********************************************************************************/
@@ -203,17 +216,14 @@ int fops_open(struct inode *inode, struct file *file)
goto out;
}
memset(fh,0,sizeof(*fh));
+
+ // FIXME: do we need to increase *our* usage count?
- /* fixme: increase some usage counts */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,51)
- dev->ext->inc_use(dev);
- MOD_INC_USE_COUNT;
-#else
if( 0 == try_module_get(dev->ext->module)) {
result = -EINVAL;
goto out;
}
-#endif
+
file->private_data = fh;
fh->dev = dev;
fh->type = type;
@@ -247,13 +257,7 @@ static int fops_release(struct inode *inode, struct file *file)
saa7146_vbi_uops.release(dev,fh,file);
}
- /* fixme: decrease some usage counts */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,51)
- dev->ext->dec_use(dev);
- MOD_DEC_USE_COUNT;
-#else
module_put(dev->ext->module);
-#endif
file->private_data = NULL;
kfree(fh);