Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 113860
b: refs/heads/master
c: 2f3d002
h: refs/heads/master
v: v3
  • Loading branch information
Hans Verkuil authored and Mauro Carvalho Chehab committed Oct 12, 2008
1 parent 679dffe commit fd3d956
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3ca685aae04960eaa8b2c97baf384996c20cf9ac
refs/heads/master: 2f3d00250ae5b1d2727e2723da805290ec408503
1 change: 1 addition & 0 deletions trunk/include/sound/tea575x-tuner.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ struct snd_tea575x {
unsigned int freq_fixup; /* crystal onboard */
unsigned int val; /* hw value */
unsigned long freq; /* frequency */
unsigned long in_use; /* set if the device is in use */
struct snd_tea575x_ops *ops;
void *private_data;
};
Expand Down
22 changes: 20 additions & 2 deletions trunk/sound/i2c/other/tea575x-tuner.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -193,9 +210,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");
Expand Down

0 comments on commit fd3d956

Please sign in to comment.