LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Robert Fitzsimons <robfitz@273k.net>
To: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: Bongani Hlope <bonganilinux@mweb.co.za>,
	video4linux-list@redhat.com, linux-kernel@vger.kernel.org
Subject: [PATCH] bttv: Re-enabling radio support requires the use of struct bttv_fh.
Date: Wed, 27 Feb 2008 01:47:29 +0000	[thread overview]
Message-ID: <20080227014729.GC2685@localhost> (raw)
In-Reply-To: <20080227014238.GA2685@localhost>

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


  parent reply	other threads:[~2008-02-27  1:47 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-17  8:36 2.6.25-rc[12] Video4Linux Bttv Regression Bongani Hlope
2008-02-18 16:11 ` Mauro Carvalho Chehab
2008-02-18 21:20   ` Bongani Hlope
2008-02-18 23:21     ` Bongani Hlope
2008-02-19 14:16       ` Mauro Carvalho Chehab
2008-02-19 20:37         ` Bongani Hlope
2008-02-21  9:03           ` Bongani Hlope
2008-02-26 15:41         ` Robert Fitzsimons
2008-02-27  1:42           ` Robert Fitzsimons
2008-02-27  1:44             ` [PATCH] bttv: Re-enable radio tuner support for VIDIOCGFREQ/VIDIOCSFREQ ioctls Robert Fitzsimons
2008-02-27  1:47             ` Robert Fitzsimons [this message]
2008-02-27  9:52               ` [PATCH] bttv: Re-enabling radio support requires the use of struct bttv_fh Mauro Carvalho Chehab
2008-02-27 21:45               ` Bongani Hlope
2008-02-28  9:25                 ` Robert Fitzsimons
2008-03-17 21:51             ` 2.6.25-rc[12] Video4Linux Bttv Regression Bongani Hlope
2008-03-20 17:22               ` Mauro Carvalho Chehab
2008-03-21 14:55                 ` Bongani Hlope
2008-03-22  0:05                   ` [PATCH] bttv: Add a radio compat_ioctl file operation Robert Fitzsimons
2008-03-22 18:17                     ` Bongani Hlope
2008-03-23  1:01                       ` Mauro Carvalho Chehab
2008-03-23 13:25                         ` Bongani Hlope
2008-03-23 13:50                           ` Mauro Carvalho Chehab
2008-03-24  6:58                             ` Bongani Hlope

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080227014729.GC2685@localhost \
    --to=robfitz@273k.net \
    --cc=bonganilinux@mweb.co.za \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab@infradead.org \
    --cc=video4linux-list@redhat.com \
    --subject='Re: [PATCH] bttv: Re-enabling radio support requires the use of struct bttv_fh.' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).