From 33532a9370a8af24bb2332219dedf45570e50531 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sat, 23 Aug 2008 09:52:00 +0200 Subject: tea575x-tuner: replace video_exclusive_open/release From: Hans Verkuil Move the video_exclusive_open/release functionality into the driver itself. Priority: normal Signed-off-by: Hans Verkuil --- linux/sound/i2c/other/tea575x-tuner.c | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 'linux/sound/i2c/other') diff --git a/linux/sound/i2c/other/tea575x-tuner.c b/linux/sound/i2c/other/tea575x-tuner.c index c4bd65c94..0522b1266 100644 --- a/linux/sound/i2c/other/tea575x-tuner.c +++ b/linux/sound/i2c/other/tea575x-tuner.c @@ -186,6 +186,31 @@ static void snd_tea575x_release(struct video_device *vfd) { } +static int snd_tea575x_exclusive_open(struct inode *inode, struct file *file) +{ + struct video_device *dev = video_devdata(file); +#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,17) + tea575x_t *tea = video_get_drvdata(dev); +#else + struct snd_tea575x *tea = video_get_drvdata(dev); +#endif + + return test_and_set_bit(0, &tea->in_use) ? -EBUSY : 0; +} + +static int snd_tea575x_exclusive_release(struct inode *inode, struct file *file) +{ + struct video_device *dev = video_devdata(file); +#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,17) + tea575x_t *tea = video_get_drvdata(dev); +#else + struct snd_tea575x *tea = video_get_drvdata(dev); +#endif + + clear_bit(0, &tea->in_use); + return 0; +} + /* * initialize all the tea575x chips */ @@ -208,9 +233,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"); -- cgit v1.2.3 From db7a0542d2c05792f43c96907b91b938179f07b2 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sat, 23 Aug 2008 13:32:09 +0200 Subject: v4l: replace video_get_drvdata(video_devdata(filp)) with video_drvdata(filp) From: Hans Verkuil Use the new video_drvdata(filp) function where it is safe to do so. Priority: normal Signed-off-by: Hans Verkuil --- linux/sound/i2c/other/tea575x-tuner.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'linux/sound/i2c/other') diff --git a/linux/sound/i2c/other/tea575x-tuner.c b/linux/sound/i2c/other/tea575x-tuner.c index 0522b1266..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; @@ -188,11 +187,10 @@ static void snd_tea575x_release(struct video_device *vfd) static int snd_tea575x_exclusive_open(struct inode *inode, struct file *file) { - 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 return test_and_set_bit(0, &tea->in_use) ? -EBUSY : 0; @@ -200,11 +198,10 @@ static int snd_tea575x_exclusive_open(struct inode *inode, struct file *file) static int snd_tea575x_exclusive_release(struct inode *inode, struct file *file) { - 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 clear_bit(0, &tea->in_use); -- cgit v1.2.3