Commit f3f741e7 authored by Darron Broad's avatar Darron Broad Committed by Mauro Carvalho Chehab

V4L/DVB (9577): saa7134-dvb: MFE attachment clean-up for saa-7134 dvb

This cleans-up MFE attachment for saa-7134 dvb
devices.

note: MFE is not fully implemented here yet.
Signed-off-by: default avatarDarron Broad <darron@kewl.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 60a5a927
...@@ -954,20 +954,14 @@ static int dvb_init(struct saa7134_dev *dev) ...@@ -954,20 +954,14 @@ static int dvb_init(struct saa7134_dev *dev)
/* FIXME: add support for multi-frontend */ /* FIXME: add support for multi-frontend */
mutex_init(&dev->frontends.lock); mutex_init(&dev->frontends.lock);
INIT_LIST_HEAD(&dev->frontends.felist); INIT_LIST_HEAD(&dev->frontends.felist);
dev->frontends.active_fe_id = 0;
printk(KERN_INFO "%s() allocating 1 frontend\n", __func__); printk(KERN_INFO "%s() allocating 1 frontend\n", __func__);
fe0 = videobuf_dvb_alloc_frontend(&dev->frontends, 1);
if (videobuf_dvb_alloc_frontend(&dev->frontends, 1) == NULL) { if (!fe0) {
printk(KERN_ERR "%s() failed to alloc\n", __func__); printk(KERN_ERR "%s() failed to alloc\n", __func__);
return -ENOMEM; return -ENOMEM;
} }
/* Get the first frontend */
fe0 = videobuf_dvb_get_frontend(&dev->frontends, 1);
if (!fe0)
return -EINVAL;
/* init struct videobuf_dvb */ /* init struct videobuf_dvb */
dev->ts.nr_bufs = 32; dev->ts.nr_bufs = 32;
dev->ts.nr_packets = 32*4; dev->ts.nr_packets = 32*4;
...@@ -1376,7 +1370,7 @@ static int dvb_init(struct saa7134_dev *dev) ...@@ -1376,7 +1370,7 @@ static int dvb_init(struct saa7134_dev *dev)
}; };
if (!fe0->dvb.frontend) if (!fe0->dvb.frontend)
return -1; goto dettach_frontend;
fe = dvb_attach(xc2028_attach, fe0->dvb.frontend, &cfg); fe = dvb_attach(xc2028_attach, fe0->dvb.frontend, &cfg);
if (!fe) { if (!fe) {
...@@ -1388,7 +1382,7 @@ static int dvb_init(struct saa7134_dev *dev) ...@@ -1388,7 +1382,7 @@ static int dvb_init(struct saa7134_dev *dev)
if (NULL == fe0->dvb.frontend) { if (NULL == fe0->dvb.frontend) {
printk(KERN_ERR "%s/dvb: frontend initialization failed\n", dev->name); printk(KERN_ERR "%s/dvb: frontend initialization failed\n", dev->name);
return -1; goto dettach_frontend;
} }
/* define general-purpose callback pointer */ /* define general-purpose callback pointer */
fe0->dvb.frontend->callback = saa7134_tuner_callback; fe0->dvb.frontend->callback = saa7134_tuner_callback;
...@@ -1411,11 +1405,8 @@ static int dvb_init(struct saa7134_dev *dev) ...@@ -1411,11 +1405,8 @@ static int dvb_init(struct saa7134_dev *dev)
return ret; return ret;
dettach_frontend: dettach_frontend:
if (fe0->dvb.frontend) videobuf_dvb_dealloc_frontends(&dev->frontends);
dvb_frontend_detach(fe0->dvb.frontend); return -EINVAL;
fe0->dvb.frontend = NULL;
return -1;
} }
static int dvb_fini(struct saa7134_dev *dev) static int dvb_fini(struct saa7134_dev *dev)
...@@ -1454,8 +1445,7 @@ static int dvb_fini(struct saa7134_dev *dev) ...@@ -1454,8 +1445,7 @@ static int dvb_fini(struct saa7134_dev *dev)
} }
} }
} }
if (fe0->dvb.frontend) videobuf_dvb_unregister_bus(&dev->frontends);
videobuf_dvb_unregister_bus(&dev->frontends);
return 0; return 0;
} }
......
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