Commit fe8d54f0 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

media: em28xx-dvb: do some coding style improvements

As we're touching a lot on this file, let's solve several
Coding Style issues there using checkpatch --fix-inline --strict,
and manually adjusting the results.
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent ad05ff09
...@@ -96,7 +96,7 @@ struct em28xx_dvb { ...@@ -96,7 +96,7 @@ struct em28xx_dvb {
struct dvb_net net; struct dvb_net net;
/* Due to DRX-K - probably need changes */ /* Due to DRX-K - probably need changes */
int (*gate_ctrl)(struct dvb_frontend *, int); int (*gate_ctrl)(struct dvb_frontend *fe, int gate);
struct semaphore pll_mutex; struct semaphore pll_mutex;
bool dont_attach_fe1; bool dont_attach_fe1;
int lna_gpio; int lna_gpio;
...@@ -276,14 +276,13 @@ static int em28xx_stop_feed(struct dvb_demux_feed *feed) ...@@ -276,14 +276,13 @@ static int em28xx_stop_feed(struct dvb_demux_feed *feed)
mutex_lock(&dvb->lock); mutex_lock(&dvb->lock);
dvb->nfeeds--; dvb->nfeeds--;
if (0 == dvb->nfeeds) if (!dvb->nfeeds)
err = em28xx_stop_streaming(dvb); err = em28xx_stop_streaming(dvb);
mutex_unlock(&dvb->lock); mutex_unlock(&dvb->lock);
return err; return err;
} }
/* ------------------------------------------------------------------ */ /* ------------------------------------------------------------------ */
static int em28xx_dvb_bus_ctrl(struct dvb_frontend *fe, int acquire) static int em28xx_dvb_bus_ctrl(struct dvb_frontend *fe, int acquire)
{ {
...@@ -512,14 +511,15 @@ static void hauppauge_hvr930c_init(struct em28xx *dev) ...@@ -512,14 +511,15 @@ static void hauppauge_hvr930c_init(struct em28xx *dev)
em28xx_gpio_set(dev, hauppauge_hvr930c_init); em28xx_gpio_set(dev, hauppauge_hvr930c_init);
em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x40); em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x40);
msleep(10); usleep_range(10000, 11000);
em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x44); em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x44);
msleep(10); usleep_range(10000, 11000);
dev->i2c_client[dev->def_i2c_bus].addr = 0x82 >> 1; dev->i2c_client[dev->def_i2c_bus].addr = 0x82 >> 1;
for (i = 0; i < ARRAY_SIZE(regs); i++) for (i = 0; i < ARRAY_SIZE(regs); i++)
i2c_master_send(&dev->i2c_client[dev->def_i2c_bus], regs[i].r, regs[i].len); i2c_master_send(&dev->i2c_client[dev->def_i2c_bus],
regs[i].r, regs[i].len);
em28xx_gpio_set(dev, hauppauge_hvr930c_end); em28xx_gpio_set(dev, hauppauge_hvr930c_end);
msleep(100); msleep(100);
...@@ -528,8 +528,7 @@ static void hauppauge_hvr930c_init(struct em28xx *dev) ...@@ -528,8 +528,7 @@ static void hauppauge_hvr930c_init(struct em28xx *dev)
msleep(30); msleep(30);
em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x45); em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x45);
msleep(10); usleep_range(10000, 11000);
} }
static void terratec_h5_init(struct em28xx *dev) static void terratec_h5_init(struct em28xx *dev)
...@@ -569,14 +568,15 @@ static void terratec_h5_init(struct em28xx *dev) ...@@ -569,14 +568,15 @@ static void terratec_h5_init(struct em28xx *dev)
em28xx_gpio_set(dev, terratec_h5_init); em28xx_gpio_set(dev, terratec_h5_init);
em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x40); em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x40);
msleep(10); usleep_range(10000, 11000);
em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x45); em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x45);
msleep(10); usleep_range(10000, 11000);
dev->i2c_client[dev->def_i2c_bus].addr = 0x82 >> 1; dev->i2c_client[dev->def_i2c_bus].addr = 0x82 >> 1;
for (i = 0; i < ARRAY_SIZE(regs); i++) for (i = 0; i < ARRAY_SIZE(regs); i++)
i2c_master_send(&dev->i2c_client[dev->def_i2c_bus], regs[i].r, regs[i].len); i2c_master_send(&dev->i2c_client[dev->def_i2c_bus],
regs[i].r, regs[i].len);
em28xx_gpio_set(dev, terratec_h5_end); em28xx_gpio_set(dev, terratec_h5_end);
}; };
...@@ -622,14 +622,15 @@ static void terratec_htc_stick_init(struct em28xx *dev) ...@@ -622,14 +622,15 @@ static void terratec_htc_stick_init(struct em28xx *dev)
em28xx_gpio_set(dev, terratec_htc_stick_init); em28xx_gpio_set(dev, terratec_htc_stick_init);
em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x40); em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x40);
msleep(10); usleep_range(10000, 11000);
em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x44); em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x44);
msleep(10); usleep_range(10000, 11000);
dev->i2c_client[dev->def_i2c_bus].addr = 0x82 >> 1; dev->i2c_client[dev->def_i2c_bus].addr = 0x82 >> 1;
for (i = 0; i < ARRAY_SIZE(regs); i++) for (i = 0; i < ARRAY_SIZE(regs); i++)
i2c_master_send(&dev->i2c_client[dev->def_i2c_bus], regs[i].r, regs[i].len); i2c_master_send(&dev->i2c_client[dev->def_i2c_bus],
regs[i].r, regs[i].len);
em28xx_gpio_set(dev, terratec_htc_stick_end); em28xx_gpio_set(dev, terratec_htc_stick_end);
}; };
...@@ -680,14 +681,15 @@ static void terratec_htc_usb_xs_init(struct em28xx *dev) ...@@ -680,14 +681,15 @@ static void terratec_htc_usb_xs_init(struct em28xx *dev)
em28xx_gpio_set(dev, terratec_htc_usb_xs_init); em28xx_gpio_set(dev, terratec_htc_usb_xs_init);
em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x40); em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x40);
msleep(10); usleep_range(10000, 11000);
em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x44); em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x44);
msleep(10); usleep_range(10000, 11000);
dev->i2c_client[dev->def_i2c_bus].addr = 0x82 >> 1; dev->i2c_client[dev->def_i2c_bus].addr = 0x82 >> 1;
for (i = 0; i < ARRAY_SIZE(regs); i++) for (i = 0; i < ARRAY_SIZE(regs); i++)
i2c_master_send(&dev->i2c_client[dev->def_i2c_bus], regs[i].r, regs[i].len); i2c_master_send(&dev->i2c_client[dev->def_i2c_bus],
regs[i].r, regs[i].len);
em28xx_gpio_set(dev, terratec_htc_usb_xs_end); em28xx_gpio_set(dev, terratec_htc_usb_xs_end);
}; };
...@@ -716,7 +718,8 @@ static void pctv_520e_init(struct em28xx *dev) ...@@ -716,7 +718,8 @@ static void pctv_520e_init(struct em28xx *dev)
dev->i2c_client[dev->def_i2c_bus].addr = 0x82 >> 1; /* 0x41 */ dev->i2c_client[dev->def_i2c_bus].addr = 0x82 >> 1; /* 0x41 */
for (i = 0; i < ARRAY_SIZE(regs); i++) for (i = 0; i < ARRAY_SIZE(regs); i++)
i2c_master_send(&dev->i2c_client[dev->def_i2c_bus], regs[i].r, regs[i].len); i2c_master_send(&dev->i2c_client[dev->def_i2c_bus],
regs[i].r, regs[i].len);
}; };
static int em28xx_pctv_290e_set_lna(struct dvb_frontend *fe) static int em28xx_pctv_290e_set_lna(struct dvb_frontend *fe)
...@@ -778,7 +781,7 @@ static int em28xx_mt352_terratec_xs_init(struct dvb_frontend *fe) ...@@ -778,7 +781,7 @@ static int em28xx_mt352_terratec_xs_init(struct dvb_frontend *fe)
static u8 tuner_go[] = { TUNER_GO, 0x01}; static u8 tuner_go[] = { TUNER_GO, 0x01};
mt352_write(fe, clock_config, sizeof(clock_config)); mt352_write(fe, clock_config, sizeof(clock_config));
udelay(200); usleep_range(200, 250);
mt352_write(fe, reset, sizeof(reset)); mt352_write(fe, reset, sizeof(reset));
mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg)); mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg));
mt352_write(fe, agc_cfg, sizeof(agc_cfg)); mt352_write(fe, agc_cfg, sizeof(agc_cfg));
...@@ -838,8 +841,8 @@ static void px_bcud_init(struct em28xx *dev) ...@@ -838,8 +841,8 @@ static void px_bcud_init(struct em28xx *dev)
/* sleeping ISDB-T */ /* sleeping ISDB-T */
dev->dvb->i2c_client_demod->addr = 0x14; dev->dvb->i2c_client_demod->addr = 0x14;
for (i = 0; i < ARRAY_SIZE(regs1); i++) for (i = 0; i < ARRAY_SIZE(regs1); i++)
i2c_master_send(dev->dvb->i2c_client_demod, regs1[i].r, i2c_master_send(dev->dvb->i2c_client_demod,
regs1[i].len); regs1[i].r, regs1[i].len);
/* sleeping ISDB-S */ /* sleeping ISDB-S */
dev->dvb->i2c_client_demod->addr = 0x15; dev->dvb->i2c_client_demod->addr = 0x15;
for (i = 0; i < ARRAY_SIZE(regs2); i++) for (i = 0; i < ARRAY_SIZE(regs2); i++)
...@@ -1075,7 +1078,7 @@ static int em28xx_register_dvb(struct em28xx_dvb *dvb, struct module *module, ...@@ -1075,7 +1078,7 @@ static int em28xx_register_dvb(struct em28xx_dvb *dvb, struct module *module,
dvb_net_init(&dvb->adapter, &dvb->net, &dvb->demux.dmx); dvb_net_init(&dvb->adapter, &dvb->net, &dvb->demux.dmx);
/* If the analog part won't create RF connectors, DVB will do it */ /* If the analog part won't create RF connectors, DVB will do it */
if (!dev->has_video || (dev->tuner_type == TUNER_ABSENT)) if (!dev->has_video || dev->tuner_type == TUNER_ABSENT)
create_rf_connector = true; create_rf_connector = true;
result = dvb_create_media_graph(&dvb->adapter, create_rf_connector); result = dvb_create_media_graph(&dvb->adapter, create_rf_connector);
...@@ -1188,8 +1191,8 @@ static int em28178_dvb_init_pctv_461e(struct em28xx *dev) ...@@ -1188,8 +1191,8 @@ static int em28178_dvb_init_pctv_461e(struct em28xx *dev)
ts2020_config.fe = dvb->fe[0]; ts2020_config.fe = dvb->fe[0];
dvb->i2c_client_tuner = dvb_module_probe("ts2020", "ts2022", dvb->i2c_client_tuner = dvb_module_probe("ts2020", "ts2022",
i2c_adapter, i2c_adapter,
0x60, &ts2020_config); 0x60, &ts2020_config);
if (!dvb->i2c_client_tuner) { if (!dvb->i2c_client_tuner) {
dvb_module_release(dvb->i2c_client_demod); dvb_module_release(dvb->i2c_client_demod);
return -ENODEV; return -ENODEV;
...@@ -1202,8 +1205,8 @@ static int em28178_dvb_init_pctv_461e(struct em28xx *dev) ...@@ -1202,8 +1205,8 @@ static int em28178_dvb_init_pctv_461e(struct em28xx *dev)
/* attach SEC */ /* attach SEC */
a8293_pdata.dvb_frontend = dvb->fe[0]; a8293_pdata.dvb_frontend = dvb->fe[0];
dvb->i2c_client_sec = dvb_module_probe("a8293", NULL, dvb->i2c_client_sec = dvb_module_probe("a8293", NULL,
&dev->i2c_adap[dev->def_i2c_bus], &dev->i2c_adap[dev->def_i2c_bus],
0x08, &a8293_pdata); 0x08, &a8293_pdata);
if (!dvb->i2c_client_sec) { if (!dvb->i2c_client_sec) {
dvb_module_release(dvb->i2c_client_tuner); dvb_module_release(dvb->i2c_client_tuner);
dvb_module_release(dvb->i2c_client_demod); dvb_module_release(dvb->i2c_client_demod);
...@@ -1414,12 +1417,13 @@ static int em28xx_dvb_init(struct em28xx *dev) ...@@ -1414,12 +1417,13 @@ static int em28xx_dvb_init(struct em28xx *dev)
dev_info(&dev->intf->dev, "Binding DVB extension\n"); dev_info(&dev->intf->dev, "Binding DVB extension\n");
dvb = kzalloc(sizeof(struct em28xx_dvb), GFP_KERNEL); dvb = kzalloc(sizeof(*dvb), GFP_KERNEL);
if (!dvb) if (!dvb)
return -ENOMEM; return -ENOMEM;
dev->dvb = dvb; dev->dvb = dvb;
dvb->fe[0] = dvb->fe[1] = NULL; dvb->fe[0] = NULL;
dvb->fe[1] = NULL;
/* pre-allocate DVB usb transfer buffers */ /* pre-allocate DVB usb transfer buffers */
if (dev->dvb_xfer_bulk) { if (dev->dvb_xfer_bulk) {
...@@ -1449,7 +1453,8 @@ static int em28xx_dvb_init(struct em28xx *dev) ...@@ -1449,7 +1453,8 @@ static int em28xx_dvb_init(struct em28xx *dev)
switch (dev->model) { switch (dev->model) {
case EM2874_BOARD_LEADERSHIP_ISDBT: case EM2874_BOARD_LEADERSHIP_ISDBT:
dvb->fe[0] = dvb_attach(s921_attach, dvb->fe[0] = dvb_attach(s921_attach,
&sharp_isdbt, &dev->i2c_adap[dev->def_i2c_bus]); &sharp_isdbt,
&dev->i2c_adap[dev->def_i2c_bus]);
if (!dvb->fe[0]) { if (!dvb->fe[0]) {
result = -EINVAL; result = -EINVAL;
...@@ -1462,8 +1467,8 @@ static int em28xx_dvb_init(struct em28xx *dev) ...@@ -1462,8 +1467,8 @@ static int em28xx_dvb_init(struct em28xx *dev)
case EM2880_BOARD_PINNACLE_PCTV_HD_PRO: case EM2880_BOARD_PINNACLE_PCTV_HD_PRO:
case EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600: case EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600:
dvb->fe[0] = dvb_attach(lgdt330x_attach, dvb->fe[0] = dvb_attach(lgdt330x_attach,
&em2880_lgdt3303_dev, &em2880_lgdt3303_dev,
&dev->i2c_adap[dev->def_i2c_bus]); &dev->i2c_adap[dev->def_i2c_bus]);
if (em28xx_attach_xc3028(0x61, dev) < 0) { if (em28xx_attach_xc3028(0x61, dev) < 0) {
result = -EINVAL; result = -EINVAL;
goto out_free; goto out_free;
...@@ -1471,8 +1476,8 @@ static int em28xx_dvb_init(struct em28xx *dev) ...@@ -1471,8 +1476,8 @@ static int em28xx_dvb_init(struct em28xx *dev)
break; break;
case EM2880_BOARD_KWORLD_DVB_310U: case EM2880_BOARD_KWORLD_DVB_310U:
dvb->fe[0] = dvb_attach(zl10353_attach, dvb->fe[0] = dvb_attach(zl10353_attach,
&em28xx_zl10353_with_xc3028, &em28xx_zl10353_with_xc3028,
&dev->i2c_adap[dev->def_i2c_bus]); &dev->i2c_adap[dev->def_i2c_bus]);
if (em28xx_attach_xc3028(0x61, dev) < 0) { if (em28xx_attach_xc3028(0x61, dev) < 0) {
result = -EINVAL; result = -EINVAL;
goto out_free; goto out_free;
...@@ -1482,8 +1487,8 @@ static int em28xx_dvb_init(struct em28xx *dev) ...@@ -1482,8 +1487,8 @@ static int em28xx_dvb_init(struct em28xx *dev)
case EM2882_BOARD_TERRATEC_HYBRID_XS: case EM2882_BOARD_TERRATEC_HYBRID_XS:
case EM2880_BOARD_EMPIRE_DUAL_TV: case EM2880_BOARD_EMPIRE_DUAL_TV:
dvb->fe[0] = dvb_attach(zl10353_attach, dvb->fe[0] = dvb_attach(zl10353_attach,
&em28xx_zl10353_xc3028_no_i2c_gate, &em28xx_zl10353_xc3028_no_i2c_gate,
&dev->i2c_adap[dev->def_i2c_bus]); &dev->i2c_adap[dev->def_i2c_bus]);
if (em28xx_attach_xc3028(0x61, dev) < 0) { if (em28xx_attach_xc3028(0x61, dev) < 0) {
result = -EINVAL; result = -EINVAL;
goto out_free; goto out_free;
...@@ -1494,16 +1499,17 @@ static int em28xx_dvb_init(struct em28xx *dev) ...@@ -1494,16 +1499,17 @@ static int em28xx_dvb_init(struct em28xx *dev)
case EM2881_BOARD_PINNACLE_HYBRID_PRO: case EM2881_BOARD_PINNACLE_HYBRID_PRO:
case EM2882_BOARD_DIKOM_DK300: case EM2882_BOARD_DIKOM_DK300:
case EM2882_BOARD_KWORLD_VS_DVBT: case EM2882_BOARD_KWORLD_VS_DVBT:
/*
* Those boards could have either a zl10353 or a mt352.
* If the chip id isn't for zl10353, try mt352.
*/
dvb->fe[0] = dvb_attach(zl10353_attach, dvb->fe[0] = dvb_attach(zl10353_attach,
&em28xx_zl10353_xc3028_no_i2c_gate, &em28xx_zl10353_xc3028_no_i2c_gate,
&dev->i2c_adap[dev->def_i2c_bus]); &dev->i2c_adap[dev->def_i2c_bus]);
if (dvb->fe[0] == NULL) { if (!dvb->fe[0])
/* This board could have either a zl10353 or a mt352.
If the chip id isn't for zl10353, try mt352 */
dvb->fe[0] = dvb_attach(mt352_attach, dvb->fe[0] = dvb_attach(mt352_attach,
&terratec_xs_mt352_cfg, &terratec_xs_mt352_cfg,
&dev->i2c_adap[dev->def_i2c_bus]); &dev->i2c_adap[dev->def_i2c_bus]);
}
if (em28xx_attach_xc3028(0x61, dev) < 0) { if (em28xx_attach_xc3028(0x61, dev) < 0) {
result = -EINVAL; result = -EINVAL;
...@@ -1512,27 +1518,28 @@ static int em28xx_dvb_init(struct em28xx *dev) ...@@ -1512,27 +1518,28 @@ static int em28xx_dvb_init(struct em28xx *dev)
break; break;
case EM2870_BOARD_TERRATEC_XS_MT2060: case EM2870_BOARD_TERRATEC_XS_MT2060:
dvb->fe[0] = dvb_attach(zl10353_attach, dvb->fe[0] = dvb_attach(zl10353_attach,
&em28xx_zl10353_no_i2c_gate_dev, &em28xx_zl10353_no_i2c_gate_dev,
&dev->i2c_adap[dev->def_i2c_bus]); &dev->i2c_adap[dev->def_i2c_bus]);
if (dvb->fe[0] != NULL) { if (dvb->fe[0]) {
dvb_attach(mt2060_attach, dvb->fe[0], dvb_attach(mt2060_attach, dvb->fe[0],
&dev->i2c_adap[dev->def_i2c_bus], &dev->i2c_adap[dev->def_i2c_bus],
&em28xx_mt2060_config, 1220); &em28xx_mt2060_config, 1220);
} }
break; break;
case EM2870_BOARD_KWORLD_355U: case EM2870_BOARD_KWORLD_355U:
dvb->fe[0] = dvb_attach(zl10353_attach, dvb->fe[0] = dvb_attach(zl10353_attach,
&em28xx_zl10353_no_i2c_gate_dev, &em28xx_zl10353_no_i2c_gate_dev,
&dev->i2c_adap[dev->def_i2c_bus]); &dev->i2c_adap[dev->def_i2c_bus]);
if (dvb->fe[0] != NULL) if (dvb->fe[0])
dvb_attach(qt1010_attach, dvb->fe[0], dvb_attach(qt1010_attach, dvb->fe[0],
&dev->i2c_adap[dev->def_i2c_bus], &em28xx_qt1010_config); &dev->i2c_adap[dev->def_i2c_bus],
&em28xx_qt1010_config);
break; break;
case EM2883_BOARD_KWORLD_HYBRID_330U: case EM2883_BOARD_KWORLD_HYBRID_330U:
case EM2882_BOARD_EVGA_INDTUBE: case EM2882_BOARD_EVGA_INDTUBE:
dvb->fe[0] = dvb_attach(s5h1409_attach, dvb->fe[0] = dvb_attach(s5h1409_attach,
&em28xx_s5h1409_with_xc3028, &em28xx_s5h1409_with_xc3028,
&dev->i2c_adap[dev->def_i2c_bus]); &dev->i2c_adap[dev->def_i2c_bus]);
if (em28xx_attach_xc3028(0x61, dev) < 0) { if (em28xx_attach_xc3028(0x61, dev) < 0) {
result = -EINVAL; result = -EINVAL;
goto out_free; goto out_free;
...@@ -1540,9 +1547,9 @@ static int em28xx_dvb_init(struct em28xx *dev) ...@@ -1540,9 +1547,9 @@ static int em28xx_dvb_init(struct em28xx *dev)
break; break;
case EM2882_BOARD_KWORLD_ATSC_315U: case EM2882_BOARD_KWORLD_ATSC_315U:
dvb->fe[0] = dvb_attach(lgdt330x_attach, dvb->fe[0] = dvb_attach(lgdt330x_attach,
&em2880_lgdt3303_dev, &em2880_lgdt3303_dev,
&dev->i2c_adap[dev->def_i2c_bus]); &dev->i2c_adap[dev->def_i2c_bus]);
if (dvb->fe[0] != NULL) { if (dvb->fe[0]) {
if (!dvb_attach(simple_tuner_attach, dvb->fe[0], if (!dvb_attach(simple_tuner_attach, dvb->fe[0],
&dev->i2c_adap[dev->def_i2c_bus], &dev->i2c_adap[dev->def_i2c_bus],
0x61, TUNER_THOMSON_DTT761X)) { 0x61, TUNER_THOMSON_DTT761X)) {
...@@ -1564,8 +1571,9 @@ static int em28xx_dvb_init(struct em28xx *dev) ...@@ -1564,8 +1571,9 @@ static int em28xx_dvb_init(struct em28xx *dev)
case EM2870_BOARD_REDDO_DVB_C_USB_BOX: case EM2870_BOARD_REDDO_DVB_C_USB_BOX:
/* Philips CU1216L NIM (Philips TDA10023 + Infineon TUA6034) */ /* Philips CU1216L NIM (Philips TDA10023 + Infineon TUA6034) */
dvb->fe[0] = dvb_attach(tda10023_attach, dvb->fe[0] = dvb_attach(tda10023_attach,
&em28xx_tda10023_config, &em28xx_tda10023_config,
&dev->i2c_adap[dev->def_i2c_bus], 0x48); &dev->i2c_adap[dev->def_i2c_bus],
0x48);
if (dvb->fe[0]) { if (dvb->fe[0]) {
if (!dvb_attach(simple_tuner_attach, dvb->fe[0], if (!dvb_attach(simple_tuner_attach, dvb->fe[0],
&dev->i2c_adap[dev->def_i2c_bus], &dev->i2c_adap[dev->def_i2c_bus],
...@@ -1577,18 +1585,18 @@ static int em28xx_dvb_init(struct em28xx *dev) ...@@ -1577,18 +1585,18 @@ static int em28xx_dvb_init(struct em28xx *dev)
break; break;
case EM2870_BOARD_KWORLD_A340: case EM2870_BOARD_KWORLD_A340:
dvb->fe[0] = dvb_attach(lgdt3305_attach, dvb->fe[0] = dvb_attach(lgdt3305_attach,
&em2870_lgdt3304_dev, &em2870_lgdt3304_dev,
&dev->i2c_adap[dev->def_i2c_bus]); &dev->i2c_adap[dev->def_i2c_bus]);
if (!dvb->fe[0]) { if (!dvb->fe[0]) {
result = -EINVAL; result = -EINVAL;
goto out_free; goto out_free;
} }
if (!dvb_attach(tda18271_attach, dvb->fe[0], 0x60, if (!dvb_attach(tda18271_attach, dvb->fe[0], 0x60,
&dev->i2c_adap[dev->def_i2c_bus], &dev->i2c_adap[dev->def_i2c_bus],
&kworld_a340_config)) { &kworld_a340_config)) {
dvb_frontend_detach(dvb->fe[0]); dvb_frontend_detach(dvb->fe[0]);
result = -EINVAL; result = -EINVAL;
goto out_free; goto out_free;
} }
break; break;
case EM28174_BOARD_PCTV_290E: case EM28174_BOARD_PCTV_290E:
...@@ -1606,7 +1614,6 @@ static int em28xx_dvb_init(struct em28xx *dev) ...@@ -1606,7 +1614,6 @@ static int em28xx_dvb_init(struct em28xx *dev)
0x60, 0x60,
&dev->i2c_adap[dev->def_i2c_bus], &dev->i2c_adap[dev->def_i2c_bus],
&em28xx_cxd2820r_tda18271_config)) { &em28xx_cxd2820r_tda18271_config)) {
dvb_frontend_detach(dvb->fe[0]); dvb_frontend_detach(dvb->fe[0]);
result = -EINVAL; result = -EINVAL;
goto out_free; goto out_free;
...@@ -1636,7 +1643,8 @@ static int em28xx_dvb_init(struct em28xx *dev) ...@@ -1636,7 +1643,8 @@ static int em28xx_dvb_init(struct em28xx *dev)
hauppauge_hvr930c_init(dev); hauppauge_hvr930c_init(dev);
dvb->fe[0] = dvb_attach(drxk_attach, dvb->fe[0] = dvb_attach(drxk_attach,
&hauppauge_930c_drxk, &dev->i2c_adap[dev->def_i2c_bus]); &hauppauge_930c_drxk,
&dev->i2c_adap[dev->def_i2c_bus]);
if (!dvb->fe[0]) { if (!dvb->fe[0]) {
result = -EINVAL; result = -EINVAL;
goto out_free; goto out_free;
...@@ -1653,8 +1661,8 @@ static int em28xx_dvb_init(struct em28xx *dev) ...@@ -1653,8 +1661,8 @@ static int em28xx_dvb_init(struct em28xx *dev)
if (dvb->fe[0]->ops.i2c_gate_ctrl) if (dvb->fe[0]->ops.i2c_gate_ctrl)
dvb->fe[0]->ops.i2c_gate_ctrl(dvb->fe[0], 1); dvb->fe[0]->ops.i2c_gate_ctrl(dvb->fe[0], 1);
if (!dvb_attach(xc5000_attach, dvb->fe[0], &dev->i2c_adap[dev->def_i2c_bus], if (!dvb_attach(xc5000_attach, dvb->fe[0],
&cfg)) { &dev->i2c_adap[dev->def_i2c_bus], &cfg)) {
result = -EINVAL; result = -EINVAL;
goto out_free; goto out_free;
} }
...@@ -1666,7 +1674,8 @@ static int em28xx_dvb_init(struct em28xx *dev) ...@@ -1666,7 +1674,8 @@ static int em28xx_dvb_init(struct em28xx *dev)
case EM2884_BOARD_TERRATEC_H5: case EM2884_BOARD_TERRATEC_H5:
terratec_h5_init(dev); terratec_h5_init(dev);
dvb->fe[0] = dvb_attach(drxk_attach, &terratec_h5_drxk, &dev->i2c_adap[dev->def_i2c_bus]); dvb->fe[0] = dvb_attach(drxk_attach, &terratec_h5_drxk,
&dev->i2c_adap[dev->def_i2c_bus]);
if (!dvb->fe[0]) { if (!dvb->fe[0]) {
result = -EINVAL; result = -EINVAL;
goto out_free; goto out_free;
...@@ -1680,7 +1689,8 @@ static int em28xx_dvb_init(struct em28xx *dev) ...@@ -1680,7 +1689,8 @@ static int em28xx_dvb_init(struct em28xx *dev)
/* Attach tda18271 to DVB-C frontend */ /* Attach tda18271 to DVB-C frontend */
if (dvb->fe[0]->ops.i2c_gate_ctrl) if (dvb->fe[0]->ops.i2c_gate_ctrl)
dvb->fe[0]->ops.i2c_gate_ctrl(dvb->fe[0], 1); dvb->fe[0]->ops.i2c_gate_ctrl(dvb->fe[0], 1);
if (!dvb_attach(tda18271c2dd_attach, dvb->fe[0], &dev->i2c_adap[dev->def_i2c_bus], 0x60)) { if (!dvb_attach(tda18271c2dd_attach, dvb->fe[0],
&dev->i2c_adap[dev->def_i2c_bus], 0x60)) {
result = -EINVAL; result = -EINVAL;
goto out_free; goto out_free;
} }
...@@ -1690,9 +1700,9 @@ static int em28xx_dvb_init(struct em28xx *dev) ...@@ -1690,9 +1700,9 @@ static int em28xx_dvb_init(struct em28xx *dev)
break; break;
case EM2884_BOARD_C3TECH_DIGITAL_DUO: case EM2884_BOARD_C3TECH_DIGITAL_DUO:
dvb->fe[0] = dvb_attach(mb86a20s_attach, dvb->fe[0] = dvb_attach(mb86a20s_attach,
&c3tech_duo_mb86a20s_config, &c3tech_duo_mb86a20s_config,
&dev->i2c_adap[dev->def_i2c_bus]); &dev->i2c_adap[dev->def_i2c_bus]);
if (dvb->fe[0] != NULL) if (dvb->fe[0])
dvb_attach(tda18271_attach, dvb->fe[0], 0x60, dvb_attach(tda18271_attach, dvb->fe[0], 0x60,
&dev->i2c_adap[dev->def_i2c_bus], &dev->i2c_adap[dev->def_i2c_bus],
&c3tech_duo_tda18271_config); &c3tech_duo_tda18271_config);
...@@ -1706,7 +1716,7 @@ static int em28xx_dvb_init(struct em28xx *dev) ...@@ -1706,7 +1716,7 @@ static int em28xx_dvb_init(struct em28xx *dev)
case EM2874_BOARD_MAXMEDIA_UB425_TC: case EM2874_BOARD_MAXMEDIA_UB425_TC:
/* attach demodulator */ /* attach demodulator */
dvb->fe[0] = dvb_attach(drxk_attach, &maxmedia_ub425_tc_drxk, dvb->fe[0] = dvb_attach(drxk_attach, &maxmedia_ub425_tc_drxk,
&dev->i2c_adap[dev->def_i2c_bus]); &dev->i2c_adap[dev->def_i2c_bus]);
if (dvb->fe[0]) { if (dvb->fe[0]) {
/* disable I2C-gate */ /* disable I2C-gate */
...@@ -1728,7 +1738,7 @@ static int em28xx_dvb_init(struct em28xx *dev) ...@@ -1728,7 +1738,7 @@ static int em28xx_dvb_init(struct em28xx *dev)
/* attach demodulator */ /* attach demodulator */
dvb->fe[0] = dvb_attach(drxk_attach, &pctv_520e_drxk, dvb->fe[0] = dvb_attach(drxk_attach, &pctv_520e_drxk,
&dev->i2c_adap[dev->def_i2c_bus]); &dev->i2c_adap[dev->def_i2c_bus]);
if (dvb->fe[0]) { if (dvb->fe[0]) {
/* attach tuner */ /* attach tuner */
...@@ -1814,8 +1824,7 @@ static int em28xx_dvb_init(struct em28xx *dev) ...@@ -1814,8 +1824,7 @@ static int em28xx_dvb_init(struct em28xx *dev)
kworld_ub435q_v3_config.fe = dvb->fe[0]; kworld_ub435q_v3_config.fe = dvb->fe[0];
dvb->i2c_client_tuner = dvb_module_probe("tda18212", NULL, dvb->i2c_client_tuner = dvb_module_probe("tda18212", NULL,
adapter, adapter, 0x60,
0x60,
&kworld_ub435q_v3_config); &kworld_ub435q_v3_config);
if (!dvb->i2c_client_tuner) { if (!dvb->i2c_client_tuner) {
dvb_frontend_detach(dvb->fe[0]); dvb_frontend_detach(dvb->fe[0]);
...@@ -1825,9 +1834,11 @@ static int em28xx_dvb_init(struct em28xx *dev) ...@@ -1825,9 +1834,11 @@ static int em28xx_dvb_init(struct em28xx *dev)
break; break;
} }
case EM2874_BOARD_PCTV_HD_MINI_80E: case EM2874_BOARD_PCTV_HD_MINI_80E:
dvb->fe[0] = dvb_attach(drx39xxj_attach, &dev->i2c_adap[dev->def_i2c_bus]); dvb->fe[0] = dvb_attach(drx39xxj_attach,
if (dvb->fe[0] != NULL) { &dev->i2c_adap[dev->def_i2c_bus]);
dvb->fe[0] = dvb_attach(tda18271_attach, dvb->fe[0], 0x60, if (dvb->fe[0]) {
dvb->fe[0] = dvb_attach(tda18271_attach, dvb->fe[0],
0x60,
&dev->i2c_adap[dev->def_i2c_bus], &dev->i2c_adap[dev->def_i2c_bus],
&pinnacle_80e_dvb_config); &pinnacle_80e_dvb_config);
if (!dvb->fe[0]) { if (!dvb->fe[0]) {
...@@ -1871,7 +1882,7 @@ static int em28xx_dvb_init(struct em28xx *dev) ...@@ -1871,7 +1882,7 @@ static int em28xx_dvb_init(struct em28xx *dev)
"The frontend of your DVB/ATSC card isn't supported yet\n"); "The frontend of your DVB/ATSC card isn't supported yet\n");
break; break;
} }
if (NULL == dvb->fe[0]) { if (!dvb->fe[0]) {
dev_err(&dev->intf->dev, "frontend initialization failed\n"); dev_err(&dev->intf->dev, "frontend initialization failed\n");
result = -EINVAL; result = -EINVAL;
goto out_free; goto out_free;
...@@ -1941,8 +1952,10 @@ static int em28xx_dvb_fini(struct em28xx *dev) ...@@ -1941,8 +1952,10 @@ static int em28xx_dvb_fini(struct em28xx *dev)
em28xx_uninit_usb_xfer(dev, EM28XX_DIGITAL_MODE); em28xx_uninit_usb_xfer(dev, EM28XX_DIGITAL_MODE);
if (dev->disconnected) { if (dev->disconnected) {
/* We cannot tell the device to sleep /*
* once it has been unplugged. */ * We cannot tell the device to sleep
* once it has been unplugged.
*/
if (dvb->fe[0]) { if (dvb->fe[0]) {
prevent_sleep(&dvb->fe[0]->ops); prevent_sleep(&dvb->fe[0]->ops);
dvb->fe[0]->exit = DVB_FE_DEVICE_REMOVED; dvb->fe[0]->exit = DVB_FE_DEVICE_REMOVED;
......
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