diff options
author | Patrick Boettcher <pb@linuxtv.org> | 2006-05-14 04:01:31 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-06-25 01:00:42 -0400 |
commit | dea74869f3c62b0b7addd67017b22b394e942aac (patch) | |
tree | d1a597caea6615c76f34896cc832fd1371f2e776 /drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c | |
parent | 332bed5fc25ab0eb84215ecd89a4acd48219eee0 (diff) |
V4L/DVB (4028): Change dvb_frontend_ops to be a real field instead of a pointer field inside dvb_frontend
The dvb_frontend_ops is a pointer inside dvb_frontend. That's why every demod-driver
is having a field of dvb_frontend_ops in its private-state-struct and
using the reference for filling the pointer-field in dvb_frontend.
- It saves at least two lines of code per demod-driver,
- reduces object size (one less dereference per frontend_ops-access),
- be coherent with dvb_tuner_ops,
- makes it a little bit easier for newbies to understand how it works and
- avoids stupid mistakes because you would have to copy the dvb_frontend_ops
always, before you could assign the static pointer directly, which was
dangerous.
Signed-off-by: Patrick Boettcher <pb@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c')
-rw-r--r-- | drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c index e540dacf5ce2..14559ef6153c 100644 --- a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c +++ b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c | |||
@@ -1039,8 +1039,8 @@ static int alps_tdmb7_tuner_set_params(struct dvb_frontend* fe, struct dvb_front | |||
1039 | data[2] = ((div >> 10) & 0x60) | 0x85; | 1039 | data[2] = ((div >> 10) & 0x60) | 0x85; |
1040 | data[3] = params->frequency < 592000000 ? 0x40 : 0x80; | 1040 | data[3] = params->frequency < 592000000 ? 0x40 : 0x80; |
1041 | 1041 | ||
1042 | if (fe->ops->i2c_gate_ctrl) | 1042 | if (fe->ops.i2c_gate_ctrl) |
1043 | fe->ops->i2c_gate_ctrl(fe, 1); | 1043 | fe->ops.i2c_gate_ctrl(fe, 1); |
1044 | if (i2c_transfer(&ttusb->i2c_adap, &msg, 1) != 1) return -EIO; | 1044 | if (i2c_transfer(&ttusb->i2c_adap, &msg, 1) != 1) return -EIO; |
1045 | return 0; | 1045 | return 0; |
1046 | } | 1046 | } |
@@ -1061,8 +1061,8 @@ static int philips_tdm1316l_tuner_init(struct dvb_frontend* fe) | |||
1061 | struct i2c_msg tuner_msg = { .addr=0x60, .flags=0, .buf=td1316_init, .len=sizeof(td1316_init) }; | 1061 | struct i2c_msg tuner_msg = { .addr=0x60, .flags=0, .buf=td1316_init, .len=sizeof(td1316_init) }; |
1062 | 1062 | ||
1063 | // setup PLL configuration | 1063 | // setup PLL configuration |
1064 | if (fe->ops->i2c_gate_ctrl) | 1064 | if (fe->ops.i2c_gate_ctrl) |
1065 | fe->ops->i2c_gate_ctrl(fe, 1); | 1065 | fe->ops.i2c_gate_ctrl(fe, 1); |
1066 | if (i2c_transfer(&ttusb->i2c_adap, &tuner_msg, 1) != 1) return -EIO; | 1066 | if (i2c_transfer(&ttusb->i2c_adap, &tuner_msg, 1) != 1) return -EIO; |
1067 | msleep(1); | 1067 | msleep(1); |
1068 | 1068 | ||
@@ -1070,8 +1070,8 @@ static int philips_tdm1316l_tuner_init(struct dvb_frontend* fe) | |||
1070 | tuner_msg.addr = 0x65; | 1070 | tuner_msg.addr = 0x65; |
1071 | tuner_msg.buf = disable_mc44BC374c; | 1071 | tuner_msg.buf = disable_mc44BC374c; |
1072 | tuner_msg.len = sizeof(disable_mc44BC374c); | 1072 | tuner_msg.len = sizeof(disable_mc44BC374c); |
1073 | if (fe->ops->i2c_gate_ctrl) | 1073 | if (fe->ops.i2c_gate_ctrl) |
1074 | fe->ops->i2c_gate_ctrl(fe, 1); | 1074 | fe->ops.i2c_gate_ctrl(fe, 1); |
1075 | if (i2c_transfer(&ttusb->i2c_adap, &tuner_msg, 1) != 1) { | 1075 | if (i2c_transfer(&ttusb->i2c_adap, &tuner_msg, 1) != 1) { |
1076 | i2c_transfer(&ttusb->i2c_adap, &tuner_msg, 1); | 1076 | i2c_transfer(&ttusb->i2c_adap, &tuner_msg, 1); |
1077 | } | 1077 | } |
@@ -1139,8 +1139,8 @@ static int philips_tdm1316l_tuner_set_params(struct dvb_frontend* fe, struct dvb | |||
1139 | tuner_buf[2] = 0xca; | 1139 | tuner_buf[2] = 0xca; |
1140 | tuner_buf[3] = (cp << 5) | (filter << 3) | band; | 1140 | tuner_buf[3] = (cp << 5) | (filter << 3) | band; |
1141 | 1141 | ||
1142 | if (fe->ops->i2c_gate_ctrl) | 1142 | if (fe->ops.i2c_gate_ctrl) |
1143 | fe->ops->i2c_gate_ctrl(fe, 1); | 1143 | fe->ops.i2c_gate_ctrl(fe, 1); |
1144 | if (i2c_transfer(&ttusb->i2c_adap, &tuner_msg, 1) != 1) | 1144 | if (i2c_transfer(&ttusb->i2c_adap, &tuner_msg, 1) != 1) |
1145 | return -EIO; | 1145 | return -EIO; |
1146 | 1146 | ||
@@ -1304,8 +1304,8 @@ static int philips_tsa5059_tuner_set_params(struct dvb_frontend *fe, struct dvb_ | |||
1304 | if (ttusb->revision == TTUSB_REV_2_2) | 1304 | if (ttusb->revision == TTUSB_REV_2_2) |
1305 | buf[3] |= 0x20; | 1305 | buf[3] |= 0x20; |
1306 | 1306 | ||
1307 | if (fe->ops->i2c_gate_ctrl) | 1307 | if (fe->ops.i2c_gate_ctrl) |
1308 | fe->ops->i2c_gate_ctrl(fe, 1); | 1308 | fe->ops.i2c_gate_ctrl(fe, 1); |
1309 | if (i2c_transfer(&ttusb->i2c_adap, &msg, 1) != 1) | 1309 | if (i2c_transfer(&ttusb->i2c_adap, &msg, 1) != 1) |
1310 | return -EIO; | 1310 | return -EIO; |
1311 | 1311 | ||
@@ -1338,8 +1338,8 @@ static int ttusb_novas_grundig_29504_491_tuner_set_params(struct dvb_frontend *f | |||
1338 | buf[2] = 0x8e; | 1338 | buf[2] = 0x8e; |
1339 | buf[3] = 0x00; | 1339 | buf[3] = 0x00; |
1340 | 1340 | ||
1341 | if (fe->ops->i2c_gate_ctrl) | 1341 | if (fe->ops.i2c_gate_ctrl) |
1342 | fe->ops->i2c_gate_ctrl(fe, 1); | 1342 | fe->ops.i2c_gate_ctrl(fe, 1); |
1343 | if (i2c_transfer(&ttusb->i2c_adap, &msg, 1) != 1) | 1343 | if (i2c_transfer(&ttusb->i2c_adap, &msg, 1) != 1) |
1344 | return -EIO; | 1344 | return -EIO; |
1345 | 1345 | ||
@@ -1365,8 +1365,8 @@ static int alps_tdbe2_tuner_set_params(struct dvb_frontend* fe, struct dvb_front | |||
1365 | data[2] = 0x85 | ((div >> 10) & 0x60); | 1365 | data[2] = 0x85 | ((div >> 10) & 0x60); |
1366 | data[3] = (params->frequency < 174000000 ? 0x88 : params->frequency < 470000000 ? 0x84 : 0x81); | 1366 | data[3] = (params->frequency < 174000000 ? 0x88 : params->frequency < 470000000 ? 0x84 : 0x81); |
1367 | 1367 | ||
1368 | if (fe->ops->i2c_gate_ctrl) | 1368 | if (fe->ops.i2c_gate_ctrl) |
1369 | fe->ops->i2c_gate_ctrl(fe, 1); | 1369 | fe->ops.i2c_gate_ctrl(fe, 1); |
1370 | if (i2c_transfer (&ttusb->i2c_adap, &msg, 1) != 1) | 1370 | if (i2c_transfer (&ttusb->i2c_adap, &msg, 1) != 1) |
1371 | return -EIO; | 1371 | return -EIO; |
1372 | 1372 | ||
@@ -1434,8 +1434,8 @@ static int dvbc_philips_tdm1316l_tuner_set_params(struct dvb_frontend *fe, struc | |||
1434 | tuner_buf[3] = (cp << 5) | (filter << 3) | band; | 1434 | tuner_buf[3] = (cp << 5) | (filter << 3) | band; |
1435 | tuner_buf[4] = 0x80; | 1435 | tuner_buf[4] = 0x80; |
1436 | 1436 | ||
1437 | if (fe->ops->i2c_gate_ctrl) | 1437 | if (fe->ops.i2c_gate_ctrl) |
1438 | fe->ops->i2c_gate_ctrl(fe, 1); | 1438 | fe->ops.i2c_gate_ctrl(fe, 1); |
1439 | if (i2c_transfer(&ttusb->i2c_adap, &tuner_msg, 1) != 1) { | 1439 | if (i2c_transfer(&ttusb->i2c_adap, &tuner_msg, 1) != 1) { |
1440 | printk("dvb-ttusb-budget: dvbc_philips_tdm1316l_pll_set Error 1\n"); | 1440 | printk("dvb-ttusb-budget: dvbc_philips_tdm1316l_pll_set Error 1\n"); |
1441 | return -EIO; | 1441 | return -EIO; |
@@ -1443,8 +1443,8 @@ static int dvbc_philips_tdm1316l_tuner_set_params(struct dvb_frontend *fe, struc | |||
1443 | 1443 | ||
1444 | msleep(50); | 1444 | msleep(50); |
1445 | 1445 | ||
1446 | if (fe->ops->i2c_gate_ctrl) | 1446 | if (fe->ops.i2c_gate_ctrl) |
1447 | fe->ops->i2c_gate_ctrl(fe, 1); | 1447 | fe->ops.i2c_gate_ctrl(fe, 1); |
1448 | if (i2c_transfer(&ttusb->i2c_adap, &tuner_msg, 1) != 1) { | 1448 | if (i2c_transfer(&ttusb->i2c_adap, &tuner_msg, 1) != 1) { |
1449 | printk("dvb-ttusb-budget: dvbc_philips_tdm1316l_pll_set Error 2\n"); | 1449 | printk("dvb-ttusb-budget: dvbc_philips_tdm1316l_pll_set Error 2\n"); |
1450 | return -EIO; | 1450 | return -EIO; |
@@ -1570,13 +1570,13 @@ static void frontend_init(struct ttusb* ttusb) | |||
1570 | // try the stv0299 based first | 1570 | // try the stv0299 based first |
1571 | ttusb->fe = stv0299_attach(&alps_stv0299_config, &ttusb->i2c_adap); | 1571 | ttusb->fe = stv0299_attach(&alps_stv0299_config, &ttusb->i2c_adap); |
1572 | if (ttusb->fe != NULL) { | 1572 | if (ttusb->fe != NULL) { |
1573 | ttusb->fe->ops->tuner_ops.set_params = philips_tsa5059_tuner_set_params; | 1573 | ttusb->fe->ops.tuner_ops.set_params = philips_tsa5059_tuner_set_params; |
1574 | 1574 | ||
1575 | if(ttusb->revision == TTUSB_REV_2_2) { // ALPS BSBE1 | 1575 | if(ttusb->revision == TTUSB_REV_2_2) { // ALPS BSBE1 |
1576 | alps_stv0299_config.inittab = alps_bsbe1_inittab; | 1576 | alps_stv0299_config.inittab = alps_bsbe1_inittab; |
1577 | lnbp21_attach(ttusb->fe, &ttusb->i2c_adap, 0, 0); | 1577 | lnbp21_attach(ttusb->fe, &ttusb->i2c_adap, 0, 0); |
1578 | } else { // ALPS BSRU6 | 1578 | } else { // ALPS BSRU6 |
1579 | ttusb->fe->ops->set_voltage = ttusb_set_voltage; | 1579 | ttusb->fe->ops.set_voltage = ttusb_set_voltage; |
1580 | } | 1580 | } |
1581 | break; | 1581 | break; |
1582 | } | 1582 | } |
@@ -1584,8 +1584,8 @@ static void frontend_init(struct ttusb* ttusb) | |||
1584 | // Grundig 29504-491 | 1584 | // Grundig 29504-491 |
1585 | ttusb->fe = tda8083_attach(&ttusb_novas_grundig_29504_491_config, &ttusb->i2c_adap); | 1585 | ttusb->fe = tda8083_attach(&ttusb_novas_grundig_29504_491_config, &ttusb->i2c_adap); |
1586 | if (ttusb->fe != NULL) { | 1586 | if (ttusb->fe != NULL) { |
1587 | ttusb->fe->ops->tuner_ops.set_params = ttusb_novas_grundig_29504_491_tuner_set_params; | 1587 | ttusb->fe->ops.tuner_ops.set_params = ttusb_novas_grundig_29504_491_tuner_set_params; |
1588 | ttusb->fe->ops->set_voltage = ttusb_set_voltage; | 1588 | ttusb->fe->ops.set_voltage = ttusb_set_voltage; |
1589 | break; | 1589 | break; |
1590 | } | 1590 | } |
1591 | break; | 1591 | break; |
@@ -1593,13 +1593,13 @@ static void frontend_init(struct ttusb* ttusb) | |||
1593 | case 0x1004: // Hauppauge/TT DVB-C budget (ves1820/ALPS TDBE2(sp5659)) | 1593 | case 0x1004: // Hauppauge/TT DVB-C budget (ves1820/ALPS TDBE2(sp5659)) |
1594 | ttusb->fe = ves1820_attach(&alps_tdbe2_config, &ttusb->i2c_adap, read_pwm(ttusb)); | 1594 | ttusb->fe = ves1820_attach(&alps_tdbe2_config, &ttusb->i2c_adap, read_pwm(ttusb)); |
1595 | if (ttusb->fe != NULL) { | 1595 | if (ttusb->fe != NULL) { |
1596 | ttusb->fe->ops->tuner_ops.set_params = alps_tdbe2_tuner_set_params; | 1596 | ttusb->fe->ops.tuner_ops.set_params = alps_tdbe2_tuner_set_params; |
1597 | break; | 1597 | break; |
1598 | } | 1598 | } |
1599 | 1599 | ||
1600 | ttusb->fe = stv0297_attach(&dvbc_philips_tdm1316l_config, &ttusb->i2c_adap); | 1600 | ttusb->fe = stv0297_attach(&dvbc_philips_tdm1316l_config, &ttusb->i2c_adap); |
1601 | if (ttusb->fe != NULL) { | 1601 | if (ttusb->fe != NULL) { |
1602 | ttusb->fe->ops->tuner_ops.set_params = dvbc_philips_tdm1316l_tuner_set_params; | 1602 | ttusb->fe->ops.tuner_ops.set_params = dvbc_philips_tdm1316l_tuner_set_params; |
1603 | break; | 1603 | break; |
1604 | } | 1604 | } |
1605 | break; | 1605 | break; |
@@ -1608,15 +1608,15 @@ static void frontend_init(struct ttusb* ttusb) | |||
1608 | // try the ALPS TDMB7 first | 1608 | // try the ALPS TDMB7 first |
1609 | ttusb->fe = cx22700_attach(&alps_tdmb7_config, &ttusb->i2c_adap); | 1609 | ttusb->fe = cx22700_attach(&alps_tdmb7_config, &ttusb->i2c_adap); |
1610 | if (ttusb->fe != NULL) { | 1610 | if (ttusb->fe != NULL) { |
1611 | ttusb->fe->ops->tuner_ops.set_params = alps_tdmb7_tuner_set_params; | 1611 | ttusb->fe->ops.tuner_ops.set_params = alps_tdmb7_tuner_set_params; |
1612 | break; | 1612 | break; |
1613 | } | 1613 | } |
1614 | 1614 | ||
1615 | // Philips td1316 | 1615 | // Philips td1316 |
1616 | ttusb->fe = tda10046_attach(&philips_tdm1316l_config, &ttusb->i2c_adap); | 1616 | ttusb->fe = tda10046_attach(&philips_tdm1316l_config, &ttusb->i2c_adap); |
1617 | if (ttusb->fe != NULL) { | 1617 | if (ttusb->fe != NULL) { |
1618 | ttusb->fe->ops->tuner_ops.init = philips_tdm1316l_tuner_init; | 1618 | ttusb->fe->ops.tuner_ops.init = philips_tdm1316l_tuner_init; |
1619 | ttusb->fe->ops->tuner_ops.set_params = philips_tdm1316l_tuner_set_params; | 1619 | ttusb->fe->ops.tuner_ops.set_params = philips_tdm1316l_tuner_set_params; |
1620 | break; | 1620 | break; |
1621 | } | 1621 | } |
1622 | break; | 1622 | break; |
@@ -1629,8 +1629,8 @@ static void frontend_init(struct ttusb* ttusb) | |||
1629 | } else { | 1629 | } else { |
1630 | if (dvb_register_frontend(&ttusb->adapter, ttusb->fe)) { | 1630 | if (dvb_register_frontend(&ttusb->adapter, ttusb->fe)) { |
1631 | printk("dvb-ttusb-budget: Frontend registration failed!\n"); | 1631 | printk("dvb-ttusb-budget: Frontend registration failed!\n"); |
1632 | if (ttusb->fe->ops->release) | 1632 | if (ttusb->fe->ops.release) |
1633 | ttusb->fe->ops->release(ttusb->fe); | 1633 | ttusb->fe->ops.release(ttusb->fe); |
1634 | ttusb->fe = NULL; | 1634 | ttusb->fe = NULL; |
1635 | } | 1635 | } |
1636 | } | 1636 | } |