Commit 5cd3955c authored by Robert Fitzsimons's avatar Robert Fitzsimons Committed by Mauro Carvalho Chehab

V4L/DVB (7277): bttv: Re-enabling radio support requires the use of struct bttv_fh

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: default avatarRobert Fitzsimons <robfitz@273k.net>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 0e81a8ae
...@@ -3415,6 +3415,7 @@ static int radio_open(struct inode *inode, struct file *file) ...@@ -3415,6 +3415,7 @@ static int radio_open(struct inode *inode, struct file *file)
{ {
int minor = iminor(inode); int minor = iminor(inode);
struct bttv *btv = NULL; struct bttv *btv = NULL;
struct bttv_fh *fh;
unsigned int i; unsigned int i;
dprintk("bttv: open minor=%d\n",minor); dprintk("bttv: open minor=%d\n",minor);
...@@ -3429,12 +3430,19 @@ static int radio_open(struct inode *inode, struct file *file) ...@@ -3429,12 +3430,19 @@ static int radio_open(struct inode *inode, struct file *file)
return -ENODEV; return -ENODEV;
dprintk("bttv%d: open called (radio)\n",btv->c.nr); 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); mutex_lock(&btv->lock);
btv->radio_user++; btv->radio_user++;
file->private_data = btv;
bttv_call_i2c_clients(btv,AUDC_SET_RADIO,NULL); bttv_call_i2c_clients(btv,AUDC_SET_RADIO,NULL);
audio_input(btv,TVAUDIO_INPUT_RADIO); audio_input(btv,TVAUDIO_INPUT_RADIO);
...@@ -3444,7 +3452,8 @@ static int radio_open(struct inode *inode, struct file *file) ...@@ -3444,7 +3452,8 @@ static int radio_open(struct inode *inode, struct file *file)
static int radio_release(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; struct rds_command cmd;
btv->radio_user--; btv->radio_user--;
...@@ -3569,7 +3578,8 @@ static int radio_g_input(struct file *filp, void *priv, unsigned int *i) ...@@ -3569,7 +3578,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, static ssize_t radio_read(struct file *file, char __user *data,
size_t count, loff_t *ppos) 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; struct rds_command cmd;
cmd.block_count = count/3; cmd.block_count = count/3;
cmd.buffer = data; cmd.buffer = data;
...@@ -3583,7 +3593,8 @@ static ssize_t radio_read(struct file *file, char __user *data, ...@@ -3583,7 +3593,8 @@ static ssize_t radio_read(struct file *file, char __user *data,
static unsigned int radio_poll(struct file *file, poll_table *wait) 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; struct rds_command cmd;
cmd.instance = file; cmd.instance = file;
cmd.event_list = wait; cmd.event_list = wait;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment