summaryrefslogtreecommitdiff
path: root/linux/sound/i2c/other/tea575x-tuner.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2008-08-29 18:35:43 -0300
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-08-29 18:35:43 -0300
commite8beadde87198bcede646d9a96042f017d115d7b (patch)
tree49621d71d57cff7daacae777f234f62e00f6dd5a /linux/sound/i2c/other/tea575x-tuner.c
parentb411ce2ea34831c61d02f0ce0278f525abd2e3c3 (diff)
parentfcf7b1133c054c011cd1cb75ac466333f61812f8 (diff)
downloadmediapointer-dvb-s2-e8beadde87198bcede646d9a96042f017d115d7b.tar.gz
mediapointer-dvb-s2-e8beadde87198bcede646d9a96042f017d115d7b.tar.bz2
merge? http://www.linuxtv.org/hg/~hverkuil/v4l-dvb-empress
From: Mauro Carvalho Chehab <mchehab@infradead.org> Priority: normal Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'linux/sound/i2c/other/tea575x-tuner.c')
-rw-r--r--linux/sound/i2c/other/tea575x-tuner.c33
1 files changed, 28 insertions, 5 deletions
diff --git a/linux/sound/i2c/other/tea575x-tuner.c b/linux/sound/i2c/other/tea575x-tuner.c
index c4bd65c94..2d07c8ea5 100644
--- a/linux/sound/i2c/other/tea575x-tuner.c
+++ b/linux/sound/i2c/other/tea575x-tuner.c
@@ -92,11 +92,10 @@ static void snd_tea575x_set_freq(struct snd_tea575x *tea)
static int snd_tea575x_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long data)
{
- struct video_device *dev = video_devdata(file);
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,17)
- tea575x_t *tea = video_get_drvdata(dev);
+ tea575x_t *tea = video_drvdata(file);
#else
- struct snd_tea575x *tea = video_get_drvdata(dev);
+ struct snd_tea575x *tea = video_drvdata(file);
#endif
void __user *arg = (void __user *)data;
@@ -186,6 +185,29 @@ static void snd_tea575x_release(struct video_device *vfd)
{
}
+static int snd_tea575x_exclusive_open(struct inode *inode, struct file *file)
+{
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,17)
+ tea575x_t *tea = video_drvdata(file);
+#else
+ struct snd_tea575x *tea = video_drvdata(file);
+#endif
+
+ return test_and_set_bit(0, &tea->in_use) ? -EBUSY : 0;
+}
+
+static int snd_tea575x_exclusive_release(struct inode *inode, struct file *file)
+{
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,17)
+ tea575x_t *tea = video_drvdata(file);
+#else
+ struct snd_tea575x *tea = video_drvdata(file);
+#endif
+
+ clear_bit(0, &tea->in_use);
+ return 0;
+}
+
/*
* initialize all the tea575x chips
*/
@@ -208,9 +230,10 @@ void snd_tea575x_init(struct snd_tea575x *tea)
tea->vd.release = snd_tea575x_release;
video_set_drvdata(&tea->vd, tea);
tea->vd.fops = &tea->fops;
+ tea->in_use = 0;
tea->fops.owner = tea->card->module;
- tea->fops.open = video_exclusive_open;
- tea->fops.release = video_exclusive_release;
+ tea->fops.open = snd_tea575x_exclusive_open;
+ tea->fops.release = snd_tea575x_exclusive_release;
tea->fops.ioctl = snd_tea575x_ioctl;
if (video_register_device(&tea->vd, VFL_TYPE_RADIO, tea->dev_nr - 1) < 0) {
snd_printk(KERN_ERR "unable to register tea575x tuner\n");