diff options
-rw-r--r-- | drivers/media/radio/radio-aimslab.c | 16 | ||||
-rw-r--r-- | drivers/media/radio/radio-aztech.c | 16 | ||||
-rw-r--r-- | drivers/media/radio/radio-gemtek-pci.c | 18 | ||||
-rw-r--r-- | drivers/media/radio/radio-gemtek.c | 16 | ||||
-rw-r--r-- | drivers/media/radio/radio-maestro.c | 18 | ||||
-rw-r--r-- | drivers/media/radio/radio-maxiradio.c | 16 | ||||
-rw-r--r-- | drivers/media/radio/radio-rtrack2.c | 16 | ||||
-rw-r--r-- | drivers/media/radio/radio-sf16fmi.c | 16 | ||||
-rw-r--r-- | drivers/media/radio/radio-sf16fmr2.c | 16 | ||||
-rw-r--r-- | drivers/media/radio/radio-terratec.c | 16 | ||||
-rw-r--r-- | drivers/media/radio/radio-trust.c | 16 | ||||
-rw-r--r-- | drivers/media/radio/radio-typhoon.c | 20 | ||||
-rw-r--r-- | drivers/media/radio/radio-zoltrix.c | 16 |
13 files changed, 185 insertions, 31 deletions
diff --git a/drivers/media/radio/radio-aimslab.c b/drivers/media/radio/radio-aimslab.c index 1f064f4b32df..b657c7bb47cc 100644 --- a/drivers/media/radio/radio-aimslab.c +++ b/drivers/media/radio/radio-aimslab.c | |||
@@ -51,6 +51,7 @@ static struct mutex lock; | |||
51 | 51 | ||
52 | struct rt_device | 52 | struct rt_device |
53 | { | 53 | { |
54 | unsigned long in_use; | ||
54 | int port; | 55 | int port; |
55 | int curvol; | 56 | int curvol; |
56 | unsigned long curfreq; | 57 | unsigned long curfreq; |
@@ -378,10 +379,21 @@ static int vidioc_s_audio(struct file *file, void *priv, | |||
378 | 379 | ||
379 | static struct rt_device rtrack_unit; | 380 | static struct rt_device rtrack_unit; |
380 | 381 | ||
382 | static int rtrack_exclusive_open(struct inode *inode, struct file *file) | ||
383 | { | ||
384 | return test_and_set_bit(0, &rtrack_unit.in_use) ? -EBUSY : 0; | ||
385 | } | ||
386 | |||
387 | static int rtrack_exclusive_release(struct inode *inode, struct file *file) | ||
388 | { | ||
389 | clear_bit(0, &rtrack_unit.in_use); | ||
390 | return 0; | ||
391 | } | ||
392 | |||
381 | static const struct file_operations rtrack_fops = { | 393 | static const struct file_operations rtrack_fops = { |
382 | .owner = THIS_MODULE, | 394 | .owner = THIS_MODULE, |
383 | .open = video_exclusive_open, | 395 | .open = rtrack_exclusive_open, |
384 | .release = video_exclusive_release, | 396 | .release = rtrack_exclusive_release, |
385 | .ioctl = video_ioctl2, | 397 | .ioctl = video_ioctl2, |
386 | #ifdef CONFIG_COMPAT | 398 | #ifdef CONFIG_COMPAT |
387 | .compat_ioctl = v4l_compat_ioctl32, | 399 | .compat_ioctl = v4l_compat_ioctl32, |
diff --git a/drivers/media/radio/radio-aztech.c b/drivers/media/radio/radio-aztech.c index 628c689e3ffe..ae18a7cf0d59 100644 --- a/drivers/media/radio/radio-aztech.c +++ b/drivers/media/radio/radio-aztech.c | |||
@@ -70,6 +70,7 @@ static struct mutex lock; | |||
70 | 70 | ||
71 | struct az_device | 71 | struct az_device |
72 | { | 72 | { |
73 | unsigned long in_use; | ||
73 | int curvol; | 74 | int curvol; |
74 | unsigned long curfreq; | 75 | unsigned long curfreq; |
75 | int stereo; | 76 | int stereo; |
@@ -342,10 +343,21 @@ static int vidioc_s_ctrl (struct file *file, void *priv, | |||
342 | 343 | ||
343 | static struct az_device aztech_unit; | 344 | static struct az_device aztech_unit; |
344 | 345 | ||
346 | static int aztech_exclusive_open(struct inode *inode, struct file *file) | ||
347 | { | ||
348 | return test_and_set_bit(0, &aztech_unit.in_use) ? -EBUSY : 0; | ||
349 | } | ||
350 | |||
351 | static int aztech_exclusive_release(struct inode *inode, struct file *file) | ||
352 | { | ||
353 | clear_bit(0, &aztech_unit.in_use); | ||
354 | return 0; | ||
355 | } | ||
356 | |||
345 | static const struct file_operations aztech_fops = { | 357 | static const struct file_operations aztech_fops = { |
346 | .owner = THIS_MODULE, | 358 | .owner = THIS_MODULE, |
347 | .open = video_exclusive_open, | 359 | .open = aztech_exclusive_open, |
348 | .release = video_exclusive_release, | 360 | .release = aztech_exclusive_release, |
349 | .ioctl = video_ioctl2, | 361 | .ioctl = video_ioctl2, |
350 | #ifdef CONFIG_COMPAT | 362 | #ifdef CONFIG_COMPAT |
351 | .compat_ioctl = v4l_compat_ioctl32, | 363 | .compat_ioctl = v4l_compat_ioctl32, |
diff --git a/drivers/media/radio/radio-gemtek-pci.c b/drivers/media/radio/radio-gemtek-pci.c index 5cd7f032298d..a7b9a5df4ca7 100644 --- a/drivers/media/radio/radio-gemtek-pci.c +++ b/drivers/media/radio/radio-gemtek-pci.c | |||
@@ -100,9 +100,8 @@ struct gemtek_pci_card { | |||
100 | u8 mute; | 100 | u8 mute; |
101 | }; | 101 | }; |
102 | 102 | ||
103 | static const char rcsid[] = "$Id: radio-gemtek-pci.c,v 1.1 2001/07/23 08:08:16 ted Exp ted $"; | ||
104 | |||
105 | static int nr_radio = -1; | 103 | static int nr_radio = -1; |
104 | static unsigned long in_use; | ||
106 | 105 | ||
107 | static inline u8 gemtek_pci_out( u16 value, u32 port ) | 106 | static inline u8 gemtek_pci_out( u16 value, u32 port ) |
108 | { | 107 | { |
@@ -364,10 +363,21 @@ MODULE_DEVICE_TABLE( pci, gemtek_pci_id ); | |||
364 | 363 | ||
365 | static int mx = 1; | 364 | static int mx = 1; |
366 | 365 | ||
366 | static int gemtek_pci_exclusive_open(struct inode *inode, struct file *file) | ||
367 | { | ||
368 | return test_and_set_bit(0, &in_use) ? -EBUSY : 0; | ||
369 | } | ||
370 | |||
371 | static int gemtek_pci_exclusive_release(struct inode *inode, struct file *file) | ||
372 | { | ||
373 | clear_bit(0, &in_use); | ||
374 | return 0; | ||
375 | } | ||
376 | |||
367 | static const struct file_operations gemtek_pci_fops = { | 377 | static const struct file_operations gemtek_pci_fops = { |
368 | .owner = THIS_MODULE, | 378 | .owner = THIS_MODULE, |
369 | .open = video_exclusive_open, | 379 | .open = gemtek_pci_exclusive_open, |
370 | .release = video_exclusive_release, | 380 | .release = gemtek_pci_exclusive_release, |
371 | .ioctl = video_ioctl2, | 381 | .ioctl = video_ioctl2, |
372 | #ifdef CONFIG_COMPAT | 382 | #ifdef CONFIG_COMPAT |
373 | .compat_ioctl = v4l_compat_ioctl32, | 383 | .compat_ioctl = v4l_compat_ioctl32, |
diff --git a/drivers/media/radio/radio-gemtek.c b/drivers/media/radio/radio-gemtek.c index 0a0f956bb308..cc90329026f2 100644 --- a/drivers/media/radio/radio-gemtek.c +++ b/drivers/media/radio/radio-gemtek.c | |||
@@ -57,6 +57,7 @@ static int shutdown = 1; | |||
57 | static int keepmuted = 1; | 57 | static int keepmuted = 1; |
58 | static int initmute = 1; | 58 | static int initmute = 1; |
59 | static int radio_nr = -1; | 59 | static int radio_nr = -1; |
60 | static unsigned long in_use; | ||
60 | 61 | ||
61 | module_param(io, int, 0444); | 62 | module_param(io, int, 0444); |
62 | MODULE_PARM_DESC(io, "Force I/O port for the GemTek Radio card if automatic " | 63 | MODULE_PARM_DESC(io, "Force I/O port for the GemTek Radio card if automatic " |
@@ -393,10 +394,21 @@ static struct v4l2_queryctrl radio_qctrl[] = { | |||
393 | } | 394 | } |
394 | }; | 395 | }; |
395 | 396 | ||
397 | static int gemtek_exclusive_open(struct inode *inode, struct file *file) | ||
398 | { | ||
399 | return test_and_set_bit(0, &in_use) ? -EBUSY : 0; | ||
400 | } | ||
401 | |||
402 | static int gemtek_exclusive_release(struct inode *inode, struct file *file) | ||
403 | { | ||
404 | clear_bit(0, &in_use); | ||
405 | return 0; | ||
406 | } | ||
407 | |||
396 | static const struct file_operations gemtek_fops = { | 408 | static const struct file_operations gemtek_fops = { |
397 | .owner = THIS_MODULE, | 409 | .owner = THIS_MODULE, |
398 | .open = video_exclusive_open, | 410 | .open = gemtek_exclusive_open, |
399 | .release = video_exclusive_release, | 411 | .release = gemtek_exclusive_release, |
400 | .ioctl = video_ioctl2, | 412 | .ioctl = video_ioctl2, |
401 | #ifdef CONFIG_COMPAT | 413 | #ifdef CONFIG_COMPAT |
402 | .compat_ioctl = v4l_compat_ioctl32, | 414 | .compat_ioctl = v4l_compat_ioctl32, |
diff --git a/drivers/media/radio/radio-maestro.c b/drivers/media/radio/radio-maestro.c index 9ef0a763eeb7..03c20948eef2 100644 --- a/drivers/media/radio/radio-maestro.c +++ b/drivers/media/radio/radio-maestro.c | |||
@@ -75,7 +75,21 @@ static struct v4l2_queryctrl radio_qctrl[] = { | |||
75 | static int radio_nr = -1; | 75 | static int radio_nr = -1; |
76 | module_param(radio_nr, int, 0); | 76 | module_param(radio_nr, int, 0); |
77 | 77 | ||
78 | static unsigned long in_use; | ||
79 | |||
78 | static int maestro_probe(struct pci_dev *pdev, const struct pci_device_id *ent); | 80 | static int maestro_probe(struct pci_dev *pdev, const struct pci_device_id *ent); |
81 | |||
82 | static int maestro_exclusive_open(struct inode *inode, struct file *file) | ||
83 | { | ||
84 | return test_and_set_bit(0, &in_use) ? -EBUSY : 0; | ||
85 | } | ||
86 | |||
87 | static int maestro_exclusive_release(struct inode *inode, struct file *file) | ||
88 | { | ||
89 | clear_bit(0, &in_use); | ||
90 | return 0; | ||
91 | } | ||
92 | |||
79 | static void maestro_remove(struct pci_dev *pdev); | 93 | static void maestro_remove(struct pci_dev *pdev); |
80 | 94 | ||
81 | static struct pci_device_id maestro_r_pci_tbl[] = { | 95 | static struct pci_device_id maestro_r_pci_tbl[] = { |
@@ -98,8 +112,8 @@ static struct pci_driver maestro_r_driver = { | |||
98 | 112 | ||
99 | static const struct file_operations maestro_fops = { | 113 | static const struct file_operations maestro_fops = { |
100 | .owner = THIS_MODULE, | 114 | .owner = THIS_MODULE, |
101 | .open = video_exclusive_open, | 115 | .open = maestro_exclusive_open, |
102 | .release = video_exclusive_release, | 116 | .release = maestro_exclusive_release, |
103 | .ioctl = video_ioctl2, | 117 | .ioctl = video_ioctl2, |
104 | #ifdef CONFIG_COMPAT | 118 | #ifdef CONFIG_COMPAT |
105 | .compat_ioctl = v4l_compat_ioctl32, | 119 | .compat_ioctl = v4l_compat_ioctl32, |
diff --git a/drivers/media/radio/radio-maxiradio.c b/drivers/media/radio/radio-maxiradio.c index 0cc6fcb041fd..263ef8b02fd8 100644 --- a/drivers/media/radio/radio-maxiradio.c +++ b/drivers/media/radio/radio-maxiradio.c | |||
@@ -85,6 +85,7 @@ static const int clk = 1, data = 2, wren = 4, mo_st = 8, power = 16 ; | |||
85 | static int radio_nr = -1; | 85 | static int radio_nr = -1; |
86 | module_param(radio_nr, int, 0); | 86 | module_param(radio_nr, int, 0); |
87 | 87 | ||
88 | static unsigned long in_use; | ||
88 | 89 | ||
89 | #define FREQ_LO 50*16000 | 90 | #define FREQ_LO 50*16000 |
90 | #define FREQ_HI 150*16000 | 91 | #define FREQ_HI 150*16000 |
@@ -99,10 +100,21 @@ module_param(radio_nr, int, 0); | |||
99 | #define BITS2FREQ(x) ((x) * FREQ_STEP - FREQ_IF) | 100 | #define BITS2FREQ(x) ((x) * FREQ_STEP - FREQ_IF) |
100 | 101 | ||
101 | 102 | ||
103 | static int maxiradio_exclusive_open(struct inode *inode, struct file *file) | ||
104 | { | ||
105 | return test_and_set_bit(0, &in_use) ? -EBUSY : 0; | ||
106 | } | ||
107 | |||
108 | static int maxiradio_exclusive_release(struct inode *inode, struct file *file) | ||
109 | { | ||
110 | clear_bit(0, &in_use); | ||
111 | return 0; | ||
112 | } | ||
113 | |||
102 | static const struct file_operations maxiradio_fops = { | 114 | static const struct file_operations maxiradio_fops = { |
103 | .owner = THIS_MODULE, | 115 | .owner = THIS_MODULE, |
104 | .open = video_exclusive_open, | 116 | .open = maxiradio_exclusive_open, |
105 | .release = video_exclusive_release, | 117 | .release = maxiradio_exclusive_release, |
106 | .ioctl = video_ioctl2, | 118 | .ioctl = video_ioctl2, |
107 | #ifdef CONFIG_COMPAT | 119 | #ifdef CONFIG_COMPAT |
108 | .compat_ioctl = v4l_compat_ioctl32, | 120 | .compat_ioctl = v4l_compat_ioctl32, |
diff --git a/drivers/media/radio/radio-rtrack2.c b/drivers/media/radio/radio-rtrack2.c index 6d820e2481e7..5b93b47be714 100644 --- a/drivers/media/radio/radio-rtrack2.c +++ b/drivers/media/radio/radio-rtrack2.c | |||
@@ -52,6 +52,7 @@ static spinlock_t lock; | |||
52 | 52 | ||
53 | struct rt_device | 53 | struct rt_device |
54 | { | 54 | { |
55 | unsigned long in_use; | ||
55 | int port; | 56 | int port; |
56 | unsigned long curfreq; | 57 | unsigned long curfreq; |
57 | int muted; | 58 | int muted; |
@@ -284,10 +285,21 @@ static int vidioc_s_audio(struct file *file, void *priv, | |||
284 | 285 | ||
285 | static struct rt_device rtrack2_unit; | 286 | static struct rt_device rtrack2_unit; |
286 | 287 | ||
288 | static int rtrack2_exclusive_open(struct inode *inode, struct file *file) | ||
289 | { | ||
290 | return test_and_set_bit(0, &rtrack2_unit.in_use) ? -EBUSY : 0; | ||
291 | } | ||
292 | |||
293 | static int rtrack2_exclusive_release(struct inode *inode, struct file *file) | ||
294 | { | ||
295 | clear_bit(0, &rtrack2_unit.in_use); | ||
296 | return 0; | ||
297 | } | ||
298 | |||
287 | static const struct file_operations rtrack2_fops = { | 299 | static const struct file_operations rtrack2_fops = { |
288 | .owner = THIS_MODULE, | 300 | .owner = THIS_MODULE, |
289 | .open = video_exclusive_open, | 301 | .open = rtrack2_exclusive_open, |
290 | .release = video_exclusive_release, | 302 | .release = rtrack2_exclusive_release, |
291 | .ioctl = video_ioctl2, | 303 | .ioctl = video_ioctl2, |
292 | #ifdef CONFIG_COMPAT | 304 | #ifdef CONFIG_COMPAT |
293 | .compat_ioctl = v4l_compat_ioctl32, | 305 | .compat_ioctl = v4l_compat_ioctl32, |
diff --git a/drivers/media/radio/radio-sf16fmi.c b/drivers/media/radio/radio-sf16fmi.c index 0d478f54a907..55f8334513f3 100644 --- a/drivers/media/radio/radio-sf16fmi.c +++ b/drivers/media/radio/radio-sf16fmi.c | |||
@@ -45,6 +45,7 @@ static struct v4l2_queryctrl radio_qctrl[] = { | |||
45 | 45 | ||
46 | struct fmi_device | 46 | struct fmi_device |
47 | { | 47 | { |
48 | unsigned long in_use; | ||
48 | int port; | 49 | int port; |
49 | int curvol; /* 1 or 0 */ | 50 | int curvol; /* 1 or 0 */ |
50 | unsigned long curfreq; /* freq in kHz */ | 51 | unsigned long curfreq; /* freq in kHz */ |
@@ -284,10 +285,21 @@ static int vidioc_s_audio(struct file *file, void *priv, | |||
284 | 285 | ||
285 | static struct fmi_device fmi_unit; | 286 | static struct fmi_device fmi_unit; |
286 | 287 | ||
288 | static int fmi_exclusive_open(struct inode *inode, struct file *file) | ||
289 | { | ||
290 | return test_and_set_bit(0, &fmi_unit.in_use) ? -EBUSY : 0; | ||
291 | } | ||
292 | |||
293 | static int fmi_exclusive_release(struct inode *inode, struct file *file) | ||
294 | { | ||
295 | clear_bit(0, &fmi_unit.in_use); | ||
296 | return 0; | ||
297 | } | ||
298 | |||
287 | static const struct file_operations fmi_fops = { | 299 | static const struct file_operations fmi_fops = { |
288 | .owner = THIS_MODULE, | 300 | .owner = THIS_MODULE, |
289 | .open = video_exclusive_open, | 301 | .open = fmi_exclusive_open, |
290 | .release = video_exclusive_release, | 302 | .release = fmi_exclusive_release, |
291 | .ioctl = video_ioctl2, | 303 | .ioctl = video_ioctl2, |
292 | #ifdef CONFIG_COMPAT | 304 | #ifdef CONFIG_COMPAT |
293 | .compat_ioctl = v4l_compat_ioctl32, | 305 | .compat_ioctl = v4l_compat_ioctl32, |
diff --git a/drivers/media/radio/radio-sf16fmr2.c b/drivers/media/radio/radio-sf16fmr2.c index 6290553d24be..14153ed939d0 100644 --- a/drivers/media/radio/radio-sf16fmr2.c +++ b/drivers/media/radio/radio-sf16fmr2.c | |||
@@ -64,6 +64,7 @@ static struct v4l2_queryctrl radio_qctrl[] = { | |||
64 | /* this should be static vars for module size */ | 64 | /* this should be static vars for module size */ |
65 | struct fmr2_device | 65 | struct fmr2_device |
66 | { | 66 | { |
67 | unsigned long in_use; | ||
67 | int port; | 68 | int port; |
68 | int curvol; /* 0-15 */ | 69 | int curvol; /* 0-15 */ |
69 | int mute; | 70 | int mute; |
@@ -400,10 +401,21 @@ static int vidioc_s_audio(struct file *file, void *priv, | |||
400 | 401 | ||
401 | static struct fmr2_device fmr2_unit; | 402 | static struct fmr2_device fmr2_unit; |
402 | 403 | ||
404 | static int fmr2_exclusive_open(struct inode *inode, struct file *file) | ||
405 | { | ||
406 | return test_and_set_bit(0, &fmr2_unit.in_use) ? -EBUSY : 0; | ||
407 | } | ||
408 | |||
409 | static int fmr2_exclusive_release(struct inode *inode, struct file *file) | ||
410 | { | ||
411 | clear_bit(0, &fmr2_unit.in_use); | ||
412 | return 0; | ||
413 | } | ||
414 | |||
403 | static const struct file_operations fmr2_fops = { | 415 | static const struct file_operations fmr2_fops = { |
404 | .owner = THIS_MODULE, | 416 | .owner = THIS_MODULE, |
405 | .open = video_exclusive_open, | 417 | .open = fmr2_exclusive_open, |
406 | .release = video_exclusive_release, | 418 | .release = fmr2_exclusive_release, |
407 | .ioctl = video_ioctl2, | 419 | .ioctl = video_ioctl2, |
408 | #ifdef CONFIG_COMPAT | 420 | #ifdef CONFIG_COMPAT |
409 | .compat_ioctl = v4l_compat_ioctl32, | 421 | .compat_ioctl = v4l_compat_ioctl32, |
diff --git a/drivers/media/radio/radio-terratec.c b/drivers/media/radio/radio-terratec.c index 0876fecc5f27..eed14972a940 100644 --- a/drivers/media/radio/radio-terratec.c +++ b/drivers/media/radio/radio-terratec.c | |||
@@ -79,6 +79,7 @@ static spinlock_t lock; | |||
79 | 79 | ||
80 | struct tt_device | 80 | struct tt_device |
81 | { | 81 | { |
82 | unsigned long in_use; | ||
82 | int port; | 83 | int port; |
83 | int curvol; | 84 | int curvol; |
84 | unsigned long curfreq; | 85 | unsigned long curfreq; |
@@ -356,10 +357,21 @@ static int vidioc_s_audio(struct file *file, void *priv, | |||
356 | 357 | ||
357 | static struct tt_device terratec_unit; | 358 | static struct tt_device terratec_unit; |
358 | 359 | ||
360 | static int terratec_exclusive_open(struct inode *inode, struct file *file) | ||
361 | { | ||
362 | return test_and_set_bit(0, &terratec_unit.in_use) ? -EBUSY : 0; | ||
363 | } | ||
364 | |||
365 | static int terratec_exclusive_release(struct inode *inode, struct file *file) | ||
366 | { | ||
367 | clear_bit(0, &terratec_unit.in_use); | ||
368 | return 0; | ||
369 | } | ||
370 | |||
359 | static const struct file_operations terratec_fops = { | 371 | static const struct file_operations terratec_fops = { |
360 | .owner = THIS_MODULE, | 372 | .owner = THIS_MODULE, |
361 | .open = video_exclusive_open, | 373 | .open = terratec_exclusive_open, |
362 | .release = video_exclusive_release, | 374 | .release = terratec_exclusive_release, |
363 | .ioctl = video_ioctl2, | 375 | .ioctl = video_ioctl2, |
364 | #ifdef CONFIG_COMPAT | 376 | #ifdef CONFIG_COMPAT |
365 | .compat_ioctl = v4l_compat_ioctl32, | 377 | .compat_ioctl = v4l_compat_ioctl32, |
diff --git a/drivers/media/radio/radio-trust.c b/drivers/media/radio/radio-trust.c index 193161956253..dd0c425ef3b8 100644 --- a/drivers/media/radio/radio-trust.c +++ b/drivers/media/radio/radio-trust.c | |||
@@ -78,6 +78,7 @@ static __u16 curtreble; | |||
78 | static unsigned long curfreq; | 78 | static unsigned long curfreq; |
79 | static int curstereo; | 79 | static int curstereo; |
80 | static int curmute; | 80 | static int curmute; |
81 | static unsigned long in_use; | ||
81 | 82 | ||
82 | /* i2c addresses */ | 83 | /* i2c addresses */ |
83 | #define TDA7318_ADDR 0x88 | 84 | #define TDA7318_ADDR 0x88 |
@@ -336,10 +337,21 @@ static int vidioc_s_audio(struct file *file, void *priv, | |||
336 | return 0; | 337 | return 0; |
337 | } | 338 | } |
338 | 339 | ||
340 | static int trust_exclusive_open(struct inode *inode, struct file *file) | ||
341 | { | ||
342 | return test_and_set_bit(0, &in_use) ? -EBUSY : 0; | ||
343 | } | ||
344 | |||
345 | static int trust_exclusive_release(struct inode *inode, struct file *file) | ||
346 | { | ||
347 | clear_bit(0, &in_use); | ||
348 | return 0; | ||
349 | } | ||
350 | |||
339 | static const struct file_operations trust_fops = { | 351 | static const struct file_operations trust_fops = { |
340 | .owner = THIS_MODULE, | 352 | .owner = THIS_MODULE, |
341 | .open = video_exclusive_open, | 353 | .open = trust_exclusive_open, |
342 | .release = video_exclusive_release, | 354 | .release = trust_exclusive_release, |
343 | .ioctl = video_ioctl2, | 355 | .ioctl = video_ioctl2, |
344 | #ifdef CONFIG_COMPAT | 356 | #ifdef CONFIG_COMPAT |
345 | .compat_ioctl = v4l_compat_ioctl32, | 357 | .compat_ioctl = v4l_compat_ioctl32, |
diff --git a/drivers/media/radio/radio-typhoon.c b/drivers/media/radio/radio-typhoon.c index f8d62cfea774..878468507237 100644 --- a/drivers/media/radio/radio-typhoon.c +++ b/drivers/media/radio/radio-typhoon.c | |||
@@ -79,7 +79,7 @@ static struct v4l2_queryctrl radio_qctrl[] = { | |||
79 | #endif | 79 | #endif |
80 | 80 | ||
81 | struct typhoon_device { | 81 | struct typhoon_device { |
82 | int users; | 82 | unsigned long in_use; |
83 | int iobase; | 83 | int iobase; |
84 | int curvol; | 84 | int curvol; |
85 | int muted; | 85 | int muted; |
@@ -334,10 +334,21 @@ static struct typhoon_device typhoon_unit = | |||
334 | .mutefreq = CONFIG_RADIO_TYPHOON_MUTEFREQ, | 334 | .mutefreq = CONFIG_RADIO_TYPHOON_MUTEFREQ, |
335 | }; | 335 | }; |
336 | 336 | ||
337 | static int typhoon_exclusive_open(struct inode *inode, struct file *file) | ||
338 | { | ||
339 | return test_and_set_bit(0, &typhoon_unit.in_use) ? -EBUSY : 0; | ||
340 | } | ||
341 | |||
342 | static int typhoon_exclusive_release(struct inode *inode, struct file *file) | ||
343 | { | ||
344 | clear_bit(0, &typhoon_unit.in_use); | ||
345 | return 0; | ||
346 | } | ||
347 | |||
337 | static const struct file_operations typhoon_fops = { | 348 | static const struct file_operations typhoon_fops = { |
338 | .owner = THIS_MODULE, | 349 | .owner = THIS_MODULE, |
339 | .open = video_exclusive_open, | 350 | .open = typhoon_exclusive_open, |
340 | .release = video_exclusive_release, | 351 | .release = typhoon_exclusive_release, |
341 | .ioctl = video_ioctl2, | 352 | .ioctl = video_ioctl2, |
342 | #ifdef CONFIG_COMPAT | 353 | #ifdef CONFIG_COMPAT |
343 | .compat_ioctl = v4l_compat_ioctl32, | 354 | .compat_ioctl = v4l_compat_ioctl32, |
@@ -447,8 +458,7 @@ static int __init typhoon_init(void) | |||
447 | } | 458 | } |
448 | 459 | ||
449 | typhoon_radio.priv = &typhoon_unit; | 460 | typhoon_radio.priv = &typhoon_unit; |
450 | if (video_register_device(&typhoon_radio, VFL_TYPE_RADIO, radio_nr) == -1) | 461 | if (video_register_device(&typhoon_radio, VFL_TYPE_RADIO, radio_nr) < 0) { |
451 | { | ||
452 | release_region(io, 8); | 462 | release_region(io, 8); |
453 | return -EINVAL; | 463 | return -EINVAL; |
454 | } | 464 | } |
diff --git a/drivers/media/radio/radio-zoltrix.c b/drivers/media/radio/radio-zoltrix.c index 51d57ed3b3e1..4d76e710194b 100644 --- a/drivers/media/radio/radio-zoltrix.c +++ b/drivers/media/radio/radio-zoltrix.c | |||
@@ -69,6 +69,7 @@ static int io = CONFIG_RADIO_ZOLTRIX_PORT; | |||
69 | static int radio_nr = -1; | 69 | static int radio_nr = -1; |
70 | 70 | ||
71 | struct zol_device { | 71 | struct zol_device { |
72 | unsigned long in_use; | ||
72 | int port; | 73 | int port; |
73 | int curvol; | 74 | int curvol; |
74 | unsigned long curfreq; | 75 | unsigned long curfreq; |
@@ -396,11 +397,22 @@ static int vidioc_s_audio(struct file *file, void *priv, | |||
396 | 397 | ||
397 | static struct zol_device zoltrix_unit; | 398 | static struct zol_device zoltrix_unit; |
398 | 399 | ||
400 | static int zoltrix_exclusive_open(struct inode *inode, struct file *file) | ||
401 | { | ||
402 | return test_and_set_bit(0, &zoltrix_unit.in_use) ? -EBUSY : 0; | ||
403 | } | ||
404 | |||
405 | static int zoltrix_exclusive_release(struct inode *inode, struct file *file) | ||
406 | { | ||
407 | clear_bit(0, &zoltrix_unit.in_use); | ||
408 | return 0; | ||
409 | } | ||
410 | |||
399 | static const struct file_operations zoltrix_fops = | 411 | static const struct file_operations zoltrix_fops = |
400 | { | 412 | { |
401 | .owner = THIS_MODULE, | 413 | .owner = THIS_MODULE, |
402 | .open = video_exclusive_open, | 414 | .open = zoltrix_exclusive_open, |
403 | .release = video_exclusive_release, | 415 | .release = zoltrix_exclusive_release, |
404 | .ioctl = video_ioctl2, | 416 | .ioctl = video_ioctl2, |
405 | #ifdef CONFIG_COMPAT | 417 | #ifdef CONFIG_COMPAT |
406 | .compat_ioctl = v4l_compat_ioctl32, | 418 | .compat_ioctl = v4l_compat_ioctl32, |