aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/saa7134/saa7134-dvb.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/saa7134/saa7134-dvb.c')
-rw-r--r--drivers/media/video/saa7134/saa7134-dvb.c24
1 files changed, 7 insertions, 17 deletions
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c
index 8c46115d4c79..d9a5652595b5 100644
--- a/drivers/media/video/saa7134/saa7134-dvb.c
+++ b/drivers/media/video/saa7134/saa7134-dvb.c
@@ -954,20 +954,14 @@ static int dvb_init(struct saa7134_dev *dev)
954 /* FIXME: add support for multi-frontend */ 954 /* FIXME: add support for multi-frontend */
955 mutex_init(&dev->frontends.lock); 955 mutex_init(&dev->frontends.lock);
956 INIT_LIST_HEAD(&dev->frontends.felist); 956 INIT_LIST_HEAD(&dev->frontends.felist);
957 dev->frontends.active_fe_id = 0;
958 957
959 printk(KERN_INFO "%s() allocating 1 frontend\n", __func__); 958 printk(KERN_INFO "%s() allocating 1 frontend\n", __func__);
960 959 fe0 = videobuf_dvb_alloc_frontend(&dev->frontends, 1);
961 if (videobuf_dvb_alloc_frontend(&dev->frontends, 1) == NULL) { 960 if (!fe0) {
962 printk(KERN_ERR "%s() failed to alloc\n", __func__); 961 printk(KERN_ERR "%s() failed to alloc\n", __func__);
963 return -ENOMEM; 962 return -ENOMEM;
964 } 963 }
965 964
966 /* Get the first frontend */
967 fe0 = videobuf_dvb_get_frontend(&dev->frontends, 1);
968 if (!fe0)
969 return -EINVAL;
970
971 /* init struct videobuf_dvb */ 965 /* init struct videobuf_dvb */
972 dev->ts.nr_bufs = 32; 966 dev->ts.nr_bufs = 32;
973 dev->ts.nr_packets = 32*4; 967 dev->ts.nr_packets = 32*4;
@@ -1376,7 +1370,7 @@ static int dvb_init(struct saa7134_dev *dev)
1376 }; 1370 };
1377 1371
1378 if (!fe0->dvb.frontend) 1372 if (!fe0->dvb.frontend)
1379 return -1; 1373 goto dettach_frontend;
1380 1374
1381 fe = dvb_attach(xc2028_attach, fe0->dvb.frontend, &cfg); 1375 fe = dvb_attach(xc2028_attach, fe0->dvb.frontend, &cfg);
1382 if (!fe) { 1376 if (!fe) {
@@ -1388,7 +1382,7 @@ static int dvb_init(struct saa7134_dev *dev)
1388 1382
1389 if (NULL == fe0->dvb.frontend) { 1383 if (NULL == fe0->dvb.frontend) {
1390 printk(KERN_ERR "%s/dvb: frontend initialization failed\n", dev->name); 1384 printk(KERN_ERR "%s/dvb: frontend initialization failed\n", dev->name);
1391 return -1; 1385 goto dettach_frontend;
1392 } 1386 }
1393 /* define general-purpose callback pointer */ 1387 /* define general-purpose callback pointer */
1394 fe0->dvb.frontend->callback = saa7134_tuner_callback; 1388 fe0->dvb.frontend->callback = saa7134_tuner_callback;
@@ -1411,11 +1405,8 @@ static int dvb_init(struct saa7134_dev *dev)
1411 return ret; 1405 return ret;
1412 1406
1413dettach_frontend: 1407dettach_frontend:
1414 if (fe0->dvb.frontend) 1408 videobuf_dvb_dealloc_frontends(&dev->frontends);
1415 dvb_frontend_detach(fe0->dvb.frontend); 1409 return -EINVAL;
1416 fe0->dvb.frontend = NULL;
1417
1418 return -1;
1419} 1410}
1420 1411
1421static int dvb_fini(struct saa7134_dev *dev) 1412static int dvb_fini(struct saa7134_dev *dev)
@@ -1454,8 +1445,7 @@ static int dvb_fini(struct saa7134_dev *dev)
1454 } 1445 }
1455 } 1446 }
1456 } 1447 }
1457 if (fe0->dvb.frontend) 1448 videobuf_dvb_unregister_bus(&dev->frontends);
1458 videobuf_dvb_unregister_bus(&dev->frontends);
1459 return 0; 1449 return 0;
1460} 1450}
1461 1451