From f972e0bd9361594071d3e68e2342c53b51a1d42b Mon Sep 17 00:00:00 2001
From: Darron Broad <darron@kewl.org>
Date: Sat, 11 Oct 2008 11:24:30 -0300
Subject: V4L/DVB (9224): MFE: bugfix: add missing frontend allocation

When using MFE on a setup with both and HVR-3000 and ASUS P7131
card it was noticed that frontend allocation for saa7134
adapters was missing. This patch adds that allocation for
both saa7134 and cx23885 adapters.

Signed-off-by: Darron Broad <darron@kewl.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
---
 drivers/media/video/cx23885/cx23885-dvb.c | 13 +++++++++++++
 drivers/media/video/saa7134/saa7134-dvb.c | 12 ++++++++++++
 2 files changed, 25 insertions(+)

diff --git a/drivers/media/video/cx23885/cx23885-dvb.c b/drivers/media/video/cx23885/cx23885-dvb.c
index d8c25a80256..c14878f74bc 100644
--- a/drivers/media/video/cx23885/cx23885-dvb.c
+++ b/drivers/media/video/cx23885/cx23885-dvb.c
@@ -314,6 +314,19 @@ static int dvb_register(struct cx23885_tsport *port)
 	struct cx23885_i2c *i2c_bus = NULL;
 	struct videobuf_dvb_frontend *fe0;
 
+	/* FIXME: add support for multi-frontend */
+	mutex_init(&port->frontends.lock);
+	INIT_LIST_HEAD(&port->frontends.frontend.felist);
+	port->frontends.active_fe_id = 0;
+
+	printk(KERN_INFO "%s() allocating 1 frontend\n", __func__);
+
+	if (videobuf_dvb_alloc_frontend(dev, &port->frontends, 1) == NULL) {
+		printk(KERN_ERR "%s() failed to alloc\n", __func__);
+		return -ENOMEM;
+	}
+
+	/* Get the first frontend */
 	fe0 = videobuf_dvb_get_frontend(&port->frontends, 1);
 	if (!fe0)
 		return -EINVAL;
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c
index cdb5f5dfe4d..30ae0cbe78a 100644
--- a/drivers/media/video/saa7134/saa7134-dvb.c
+++ b/drivers/media/video/saa7134/saa7134-dvb.c
@@ -951,6 +951,18 @@ static int dvb_init(struct saa7134_dev *dev)
 	int attach_xc3028 = 0;
 	struct videobuf_dvb_frontend *fe0;
 
+	/* FIXME: add support for multi-frontend */
+	mutex_init(&dev->frontends.lock);
+	INIT_LIST_HEAD(&dev->frontends.frontend.felist);
+	dev->frontends.active_fe_id = 0;
+
+	printk(KERN_INFO "%s() allocating 1 frontend\n", __func__);
+
+	if (videobuf_dvb_alloc_frontend(dev, &dev->frontends, 1) == NULL) {
+		printk(KERN_ERR "%s() failed to alloc\n", __func__);
+		return -ENOMEM;
+	}
+
 	/* Get the first frontend */
 	fe0 = videobuf_dvb_get_frontend(&dev->frontends, 1);
 	if (!fe0)
-- 
cgit v1.2.3-18-g5258