public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Robert Fitzsimons <robfitz@273k.net>
To: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: video4linux-list@redhat.com, linux-kernel@vger.kernel.org,
	Bongani Hlope <bonganilinux@mweb.co.za>
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

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

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

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200802171036.19619.bonganilinux@mweb.co.za>
2008-02-18 16:11 ` 2.6.25-rc[12] Video4Linux Bttv Regression Mauro Carvalho Chehab
     [not found]   ` <200802182320.40732.bonganilinux@mweb.co.za>
     [not found]     ` <200802190121.36280.bonganilinux@mweb.co.za>
2008-02-19 14:16       ` Mauro Carvalho Chehab
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
     [not found]               ` <200802272345.43209.bonganilinux@mweb.co.za>
2008-02-28  9:25                 ` Robert Fitzsimons
     [not found]             ` <200803172351.56717.bonganilinux@mweb.co.za>
2008-03-20 17:22               ` 2.6.25-rc[12] Video4Linux Bttv Regression Mauro Carvalho Chehab
     [not found]                 ` <200803211655.31085.bonganilinux@mweb.co.za>
2008-03-22  0:05                   ` [PATCH] bttv: Add a radio compat_ioctl file operation Robert Fitzsimons
     [not found]                     ` <200803222017.40862.bonganilinux@mweb.co.za>
2008-03-23  1:01                       ` Mauro Carvalho Chehab
     [not found]                         ` <200803231525.22278.bonganilinux@mweb.co.za>
2008-03-23 13:50                           ` Mauro Carvalho Chehab

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 \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox