[PATCH] bttv: Re-enabling radio support requires the use of struct bttv_fh.

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Robert Fitzsimons
Date: Tuesday, February 26, 2008 - 6:47 pm

A number of the radio tuner ioctl functions are shared with the TV
tuner, these functions require a struct bttv_fh data structure to be
allocated and initialized.

Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
---
 drivers/media/video/bt8xx/bttv-driver.c |   21 ++++++++++++++++-----
 1 files changed, 16 insertions(+), 5 deletions(-)


Mauro, the radio_open function may want to do more initialisation then
the amount I copied from bttv_open.


diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c
index 817a961..04a8263 100644
--- a/drivers/media/video/bt8xx/bttv-driver.c
+++ b/drivers/media/video/bt8xx/bttv-driver.c
@@ -3417,6 +3417,7 @@ static int radio_open(struct inode *inode, struct file *file)
 {
 	int minor = iminor(inode);
 	struct bttv *btv = NULL;
+	struct bttv_fh *fh;
 	unsigned int i;
 
 	dprintk("bttv: open minor=%d\n",minor);
@@ -3431,12 +3432,19 @@ static int radio_open(struct inode *inode, struct file *file)
 		return -ENODEV;
 
 	dprintk("bttv%d: open called (radio)\n",btv->c.nr);
+
+	/* allocate per filehandle data */
+	fh = kmalloc(sizeof(*fh),GFP_KERNEL);
+	if (NULL == fh)
+		return -ENOMEM;
+	file->private_data = fh;
+	*fh = btv->init;
+	v4l2_prio_open(&btv->prio,&fh->prio);
+
 	mutex_lock(&btv->lock);
 
 	btv->radio_user++;
 
-	file->private_data = btv;
-
 	bttv_call_i2c_clients(btv,AUDC_SET_RADIO,NULL);
 	audio_input(btv,TVAUDIO_INPUT_RADIO);
 
@@ -3446,7 +3454,8 @@ static int radio_open(struct inode *inode, struct file *file)
 
 static int radio_release(struct inode *inode, struct file *file)
 {
-	struct bttv *btv = file->private_data;
+	struct bttv_fh *fh = file->private_data;
+	struct bttv *btv = fh->btv;
 	struct rds_command cmd;
 
 	btv->radio_user--;
@@ -3571,7 +3580,8 @@ static int radio_g_input(struct file *filp, void *priv, unsigned int *i)
 static ssize_t radio_read(struct file *file, char __user *data,
 			 size_t count, loff_t *ppos)
 {
-	struct bttv    *btv = file->private_data;
+	struct bttv_fh *fh = file->private_data;
+	struct bttv *btv = fh->btv;
 	struct rds_command cmd;
 	cmd.block_count = count/3;
 	cmd.buffer = data;
@@ -3585,7 +3595,8 @@ static ssize_t radio_read(struct file *file, char __user *data,
 
 static unsigned int radio_poll(struct file *file, poll_table *wait)
 {
-	struct bttv    *btv = file->private_data;
+	struct bttv_fh *fh = file->private_data;
+	struct bttv *btv = fh->btv;
 	struct rds_command cmd;
 	cmd.instance = file;
 	cmd.event_list = wait;
-- 
1.5.4.34.g053d9

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
2.6.25-rc[12] Video4Linux Bttv Regression, Bongani Hlope, (Sun Feb 17, 1:36 am)
Re: 2.6.25-rc[12] Video4Linux Bttv Regression, Mauro Carvalho Chehab, (Mon Feb 18, 9:11 am)
Re: 2.6.25-rc[12] Video4Linux Bttv Regression, Bongani Hlope, (Mon Feb 18, 2:20 pm)
Re: 2.6.25-rc[12] Video4Linux Bttv Regression, Bongani Hlope, (Mon Feb 18, 4:21 pm)
Re: 2.6.25-rc[12] Video4Linux Bttv Regression, Mauro Carvalho Chehab, (Tue Feb 19, 7:16 am)
Re: 2.6.25-rc[12] Video4Linux Bttv Regression, Bongani Hlope, (Tue Feb 19, 1:37 pm)
Re: 2.6.25-rc[12] Video4Linux Bttv Regression, Bongani Hlope, (Thu Feb 21, 2:03 am)
Re: 2.6.25-rc[12] Video4Linux Bttv Regression, Robert Fitzsimons, (Tue Feb 26, 8:41 am)
Re: 2.6.25-rc[12] Video4Linux Bttv Regression, Robert Fitzsimons, (Tue Feb 26, 6:42 pm)
[PATCH] bttv: Re-enable radio tuner support for VIDIOCGFRE ..., Robert Fitzsimons, (Tue Feb 26, 6:44 pm)
[PATCH] bttv: Re-enabling radio support requires the use o ..., Robert Fitzsimons, (Tue Feb 26, 6:47 pm)
Re: [PATCH] bttv: Re-enabling radio support requires the u ..., Mauro Carvalho Chehab, (Wed Feb 27, 2:52 am)
Re: [PATCH] bttv: Re-enabling radio support requires the u ..., Robert Fitzsimons, (Thu Feb 28, 2:25 am)
Re: 2.6.25-rc[12] Video4Linux Bttv Regression, Bongani Hlope, (Mon Mar 17, 2:51 pm)
Re: 2.6.25-rc[12] Video4Linux Bttv Regression, Mauro Carvalho Chehab, (Thu Mar 20, 10:22 am)
Re: 2.6.25-rc[12] Video4Linux Bttv Regression, Bongani Hlope, (Fri Mar 21, 7:55 am)
[PATCH] bttv: Add a radio compat_ioctl file operation., Robert Fitzsimons, (Fri Mar 21, 5:05 pm)
Re: [PATCH] bttv: Add a radio compat_ioctl file operation., Bongani Hlope, (Sat Mar 22, 11:17 am)
Re: [PATCH] bttv: Add a radio compat_ioctl file operation., Mauro Carvalho Chehab, (Sat Mar 22, 6:01 pm)
Re: [PATCH] bttv: Add a radio compat_ioctl file operation., Mauro Carvalho Chehab, (Sun Mar 23, 6:50 am)
Re: [PATCH] bttv: Add a radio compat_ioctl file operation., Bongani Hlope, (Sun Mar 23, 11:58 pm)