diff options
Diffstat (limited to 'linux/drivers/media/radio/radio-maxiradio.c')
-rw-r--r-- | linux/drivers/media/radio/radio-maxiradio.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/linux/drivers/media/radio/radio-maxiradio.c b/linux/drivers/media/radio/radio-maxiradio.c index 0f6bbd81b..81cc7cbd6 100644 --- a/linux/drivers/media/radio/radio-maxiradio.c +++ b/linux/drivers/media/radio/radio-maxiradio.c @@ -86,6 +86,7 @@ static const int clk = 1, data = 2, wren = 4, mo_st = 8, power = 16 ; static int radio_nr = -1; module_param(radio_nr, int, 0); +static unsigned long in_use; #define FREQ_LO 50*16000 #define FREQ_HI 150*16000 @@ -100,10 +101,21 @@ module_param(radio_nr, int, 0); #define BITS2FREQ(x) ((x) * FREQ_STEP - FREQ_IF) +static int maxiradio_exclusive_open(struct inode *inode, struct file *file) +{ + return test_and_set_bit(0, &in_use) ? -EBUSY : 0; +} + +static int maxiradio_exclusive_release(struct inode *inode, struct file *file) +{ + clear_bit(0, &in_use); + return 0; +} + static const struct file_operations maxiradio_fops = { .owner = THIS_MODULE, - .open = video_exclusive_open, - .release = video_exclusive_release, + .open = maxiradio_exclusive_open, + .release = maxiradio_exclusive_release, .ioctl = video_ioctl2, #ifdef CONFIG_COMPAT .compat_ioctl = v4l_compat_ioctl32, |