diff options
Diffstat (limited to 'drivers/media/video/bt8xx/bttv-driver.c')
-rw-r--r-- | drivers/media/video/bt8xx/bttv-driver.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c index a080c149cc6c..fc3f57adb729 100644 --- a/drivers/media/video/bt8xx/bttv-driver.c +++ b/drivers/media/video/bt8xx/bttv-driver.c | |||
@@ -3415,6 +3415,7 @@ static int radio_open(struct inode *inode, struct file *file) | |||
3415 | { | 3415 | { |
3416 | int minor = iminor(inode); | 3416 | int minor = iminor(inode); |
3417 | struct bttv *btv = NULL; | 3417 | struct bttv *btv = NULL; |
3418 | struct bttv_fh *fh; | ||
3418 | unsigned int i; | 3419 | unsigned int i; |
3419 | 3420 | ||
3420 | dprintk("bttv: open minor=%d\n",minor); | 3421 | dprintk("bttv: open minor=%d\n",minor); |
@@ -3429,12 +3430,19 @@ static int radio_open(struct inode *inode, struct file *file) | |||
3429 | return -ENODEV; | 3430 | return -ENODEV; |
3430 | 3431 | ||
3431 | dprintk("bttv%d: open called (radio)\n",btv->c.nr); | 3432 | dprintk("bttv%d: open called (radio)\n",btv->c.nr); |
3433 | |||
3434 | /* allocate per filehandle data */ | ||
3435 | fh = kmalloc(sizeof(*fh), GFP_KERNEL); | ||
3436 | if (NULL == fh) | ||
3437 | return -ENOMEM; | ||
3438 | file->private_data = fh; | ||
3439 | *fh = btv->init; | ||
3440 | v4l2_prio_open(&btv->prio, &fh->prio); | ||
3441 | |||
3432 | mutex_lock(&btv->lock); | 3442 | mutex_lock(&btv->lock); |
3433 | 3443 | ||
3434 | btv->radio_user++; | 3444 | btv->radio_user++; |
3435 | 3445 | ||
3436 | file->private_data = btv; | ||
3437 | |||
3438 | bttv_call_i2c_clients(btv,AUDC_SET_RADIO,NULL); | 3446 | bttv_call_i2c_clients(btv,AUDC_SET_RADIO,NULL); |
3439 | audio_input(btv,TVAUDIO_INPUT_RADIO); | 3447 | audio_input(btv,TVAUDIO_INPUT_RADIO); |
3440 | 3448 | ||
@@ -3444,7 +3452,8 @@ static int radio_open(struct inode *inode, struct file *file) | |||
3444 | 3452 | ||
3445 | static int radio_release(struct inode *inode, struct file *file) | 3453 | static int radio_release(struct inode *inode, struct file *file) |
3446 | { | 3454 | { |
3447 | struct bttv *btv = file->private_data; | 3455 | struct bttv_fh *fh = file->private_data; |
3456 | struct bttv *btv = fh->btv; | ||
3448 | struct rds_command cmd; | 3457 | struct rds_command cmd; |
3449 | 3458 | ||
3450 | btv->radio_user--; | 3459 | btv->radio_user--; |
@@ -3569,7 +3578,8 @@ static int radio_g_input(struct file *filp, void *priv, unsigned int *i) | |||
3569 | static ssize_t radio_read(struct file *file, char __user *data, | 3578 | static ssize_t radio_read(struct file *file, char __user *data, |
3570 | size_t count, loff_t *ppos) | 3579 | size_t count, loff_t *ppos) |
3571 | { | 3580 | { |
3572 | struct bttv *btv = file->private_data; | 3581 | struct bttv_fh *fh = file->private_data; |
3582 | struct bttv *btv = fh->btv; | ||
3573 | struct rds_command cmd; | 3583 | struct rds_command cmd; |
3574 | cmd.block_count = count/3; | 3584 | cmd.block_count = count/3; |
3575 | cmd.buffer = data; | 3585 | cmd.buffer = data; |
@@ -3583,7 +3593,8 @@ static ssize_t radio_read(struct file *file, char __user *data, | |||
3583 | 3593 | ||
3584 | static unsigned int radio_poll(struct file *file, poll_table *wait) | 3594 | static unsigned int radio_poll(struct file *file, poll_table *wait) |
3585 | { | 3595 | { |
3586 | struct bttv *btv = file->private_data; | 3596 | struct bttv_fh *fh = file->private_data; |
3597 | struct bttv *btv = fh->btv; | ||
3587 | struct rds_command cmd; | 3598 | struct rds_command cmd; |
3588 | cmd.instance = file; | 3599 | cmd.instance = file; |
3589 | cmd.event_list = wait; | 3600 | cmd.event_list = wait; |