diff options
Diffstat (limited to 'sound/i2c/other/tea575x-tuner.c')
-rw-r--r-- | sound/i2c/other/tea575x-tuner.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/sound/i2c/other/tea575x-tuner.c b/sound/i2c/other/tea575x-tuner.c index 83e90057270e..c13a178383ba 100644 --- a/sound/i2c/other/tea575x-tuner.c +++ b/sound/i2c/other/tea575x-tuner.c | |||
@@ -87,8 +87,7 @@ static void snd_tea575x_set_freq(struct snd_tea575x *tea) | |||
87 | static int snd_tea575x_ioctl(struct inode *inode, struct file *file, | 87 | static int snd_tea575x_ioctl(struct inode *inode, struct file *file, |
88 | unsigned int cmd, unsigned long data) | 88 | unsigned int cmd, unsigned long data) |
89 | { | 89 | { |
90 | struct video_device *dev = video_devdata(file); | 90 | struct snd_tea575x *tea = video_drvdata(file); |
91 | struct snd_tea575x *tea = video_get_drvdata(dev); | ||
92 | void __user *arg = (void __user *)data; | 91 | void __user *arg = (void __user *)data; |
93 | 92 | ||
94 | switch(cmd) { | 93 | switch(cmd) { |
@@ -175,6 +174,21 @@ static void snd_tea575x_release(struct video_device *vfd) | |||
175 | { | 174 | { |
176 | } | 175 | } |
177 | 176 | ||
177 | static int snd_tea575x_exclusive_open(struct inode *inode, struct file *file) | ||
178 | { | ||
179 | struct snd_tea575x *tea = video_drvdata(file); | ||
180 | |||
181 | return test_and_set_bit(0, &tea->in_use) ? -EBUSY : 0; | ||
182 | } | ||
183 | |||
184 | static int snd_tea575x_exclusive_release(struct inode *inode, struct file *file) | ||
185 | { | ||
186 | struct snd_tea575x *tea = video_drvdata(file); | ||
187 | |||
188 | clear_bit(0, &tea->in_use); | ||
189 | return 0; | ||
190 | } | ||
191 | |||
178 | /* | 192 | /* |
179 | * initialize all the tea575x chips | 193 | * initialize all the tea575x chips |
180 | */ | 194 | */ |
@@ -193,9 +207,10 @@ void snd_tea575x_init(struct snd_tea575x *tea) | |||
193 | tea->vd.release = snd_tea575x_release; | 207 | tea->vd.release = snd_tea575x_release; |
194 | video_set_drvdata(&tea->vd, tea); | 208 | video_set_drvdata(&tea->vd, tea); |
195 | tea->vd.fops = &tea->fops; | 209 | tea->vd.fops = &tea->fops; |
210 | tea->in_use = 0; | ||
196 | tea->fops.owner = tea->card->module; | 211 | tea->fops.owner = tea->card->module; |
197 | tea->fops.open = video_exclusive_open; | 212 | tea->fops.open = snd_tea575x_exclusive_open; |
198 | tea->fops.release = video_exclusive_release; | 213 | tea->fops.release = snd_tea575x_exclusive_release; |
199 | tea->fops.ioctl = snd_tea575x_ioctl; | 214 | tea->fops.ioctl = snd_tea575x_ioctl; |
200 | if (video_register_device(&tea->vd, VFL_TYPE_RADIO, tea->dev_nr - 1) < 0) { | 215 | if (video_register_device(&tea->vd, VFL_TYPE_RADIO, tea->dev_nr - 1) < 0) { |
201 | snd_printk(KERN_ERR "unable to register tea575x tuner\n"); | 216 | snd_printk(KERN_ERR "unable to register tea575x tuner\n"); |