mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-13 23:34:05 +08:00
V4L/DVB (8777): tea575x-tuner: replace video_exclusive_open/release
Move the video_exclusive_open/release functionality into the driver itself. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
parent
3ca685aae0
commit
2f3d00250a
@ -43,6 +43,7 @@ struct snd_tea575x {
|
|||||||
unsigned int freq_fixup; /* crystal onboard */
|
unsigned int freq_fixup; /* crystal onboard */
|
||||||
unsigned int val; /* hw value */
|
unsigned int val; /* hw value */
|
||||||
unsigned long freq; /* frequency */
|
unsigned long freq; /* frequency */
|
||||||
|
unsigned long in_use; /* set if the device is in use */
|
||||||
struct snd_tea575x_ops *ops;
|
struct snd_tea575x_ops *ops;
|
||||||
void *private_data;
|
void *private_data;
|
||||||
};
|
};
|
||||||
|
@ -175,6 +175,23 @@ 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);
|
||||||
|
struct snd_tea575x *tea = video_get_drvdata(dev);
|
||||||
|
|
||||||
|
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);
|
||||||
|
struct snd_tea575x *tea = video_get_drvdata(dev);
|
||||||
|
|
||||||
|
clear_bit(0, &tea->in_use);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* initialize all the tea575x chips
|
* initialize all the tea575x chips
|
||||||
*/
|
*/
|
||||||
@ -193,9 +210,10 @@ void snd_tea575x_init(struct snd_tea575x *tea)
|
|||||||
tea->vd.release = snd_tea575x_release;
|
tea->vd.release = snd_tea575x_release;
|
||||||
video_set_drvdata(&tea->vd, tea);
|
video_set_drvdata(&tea->vd, tea);
|
||||||
tea->vd.fops = &tea->fops;
|
tea->vd.fops = &tea->fops;
|
||||||
|
tea->in_use = 0;
|
||||||
tea->fops.owner = tea->card->module;
|
tea->fops.owner = tea->card->module;
|
||||||
tea->fops.open = video_exclusive_open;
|
tea->fops.open = snd_tea575x_exclusive_open;
|
||||||
tea->fops.release = video_exclusive_release;
|
tea->fops.release = snd_tea575x_exclusive_release;
|
||||||
tea->fops.ioctl = snd_tea575x_ioctl;
|
tea->fops.ioctl = snd_tea575x_ioctl;
|
||||||
if (video_register_device(&tea->vd, VFL_TYPE_RADIO, tea->dev_nr - 1) < 0) {
|
if (video_register_device(&tea->vd, VFL_TYPE_RADIO, tea->dev_nr - 1) < 0) {
|
||||||
snd_printk(KERN_ERR "unable to register tea575x tuner\n");
|
snd_printk(KERN_ERR "unable to register tea575x tuner\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user