aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/ttpci/budget-av.c
diff options
context:
space:
mode:
authorPatrick Boettcher <pb@linuxtv.org>2006-05-14 04:01:31 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-06-25 01:00:42 -0400
commitdea74869f3c62b0b7addd67017b22b394e942aac (patch)
treed1a597caea6615c76f34896cc832fd1371f2e776 /drivers/media/dvb/ttpci/budget-av.c
parent332bed5fc25ab0eb84215ecd89a4acd48219eee0 (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/ttpci/budget-av.c')
-rw-r--r--drivers/media/dvb/ttpci/budget-av.c56
1 files changed, 28 insertions, 28 deletions
diff --git a/drivers/media/dvb/ttpci/budget-av.c b/drivers/media/dvb/ttpci/budget-av.c
index 3ff67523cce..99ab6077885 100644
--- a/drivers/media/dvb/ttpci/budget-av.c
+++ b/drivers/media/dvb/ttpci/budget-av.c
@@ -541,8 +541,8 @@ static int philips_su1278_ty_ci_tuner_set_params(struct dvb_frontend *fe,
541 else if (params->frequency < 2150000) 541 else if (params->frequency < 2150000)
542 buf[3] |= 0xC0; 542 buf[3] |= 0xC0;
543 543
544 if (fe->ops->i2c_gate_ctrl) 544 if (fe->ops.i2c_gate_ctrl)
545 fe->ops->i2c_gate_ctrl(fe, 1); 545 fe->ops.i2c_gate_ctrl(fe, 1);
546 if (i2c_transfer(&budget->i2c_adap, &msg, 1) != 1) 546 if (i2c_transfer(&budget->i2c_adap, &msg, 1) != 1)
547 return -EIO; 547 return -EIO;
548 return 0; 548 return 0;
@@ -662,22 +662,22 @@ static int philips_su1278sh2_tua6100_tuner_set_params(struct dvb_frontend *fe,
662 reg0[1] |= 0x03; 662 reg0[1] |= 0x03;
663 663
664 /* already enabled - do not reenable i2c repeater or TX fails */ 664 /* already enabled - do not reenable i2c repeater or TX fails */
665 if (fe->ops->i2c_gate_ctrl) 665 if (fe->ops.i2c_gate_ctrl)
666 fe->ops->i2c_gate_ctrl(fe, 1); 666 fe->ops.i2c_gate_ctrl(fe, 1);
667 msg.buf = reg0; 667 msg.buf = reg0;
668 msg.len = sizeof(reg0); 668 msg.len = sizeof(reg0);
669 if (i2c_transfer(&budget->i2c_adap, &msg, 1) != 1) 669 if (i2c_transfer(&budget->i2c_adap, &msg, 1) != 1)
670 return -EIO; 670 return -EIO;
671 671
672 if (fe->ops->i2c_gate_ctrl) 672 if (fe->ops.i2c_gate_ctrl)
673 fe->ops->i2c_gate_ctrl(fe, 1); 673 fe->ops.i2c_gate_ctrl(fe, 1);
674 msg.buf = reg1; 674 msg.buf = reg1;
675 msg.len = sizeof(reg1); 675 msg.len = sizeof(reg1);
676 if (i2c_transfer(&budget->i2c_adap, &msg, 1) != 1) 676 if (i2c_transfer(&budget->i2c_adap, &msg, 1) != 1)
677 return -EIO; 677 return -EIO;
678 678
679 if (fe->ops->i2c_gate_ctrl) 679 if (fe->ops.i2c_gate_ctrl)
680 fe->ops->i2c_gate_ctrl(fe, 1); 680 fe->ops.i2c_gate_ctrl(fe, 1);
681 msg.buf = reg2; 681 msg.buf = reg2;
682 msg.len = sizeof(reg2); 682 msg.len = sizeof(reg2);
683 if (i2c_transfer(&budget->i2c_adap, &msg, 1) != 1) 683 if (i2c_transfer(&budget->i2c_adap, &msg, 1) != 1)
@@ -781,8 +781,8 @@ static int philips_cu1216_tuner_set_params(struct dvb_frontend *fe, struct dvb_f
781 buf[3] = (params->frequency < 150000000 ? 0x01 : 781 buf[3] = (params->frequency < 150000000 ? 0x01 :
782 params->frequency < 445000000 ? 0x02 : 0x04); 782 params->frequency < 445000000 ? 0x02 : 0x04);
783 783
784 if (fe->ops->i2c_gate_ctrl) 784 if (fe->ops.i2c_gate_ctrl)
785 fe->ops->i2c_gate_ctrl(fe, 1); 785 fe->ops.i2c_gate_ctrl(fe, 1);
786 if (i2c_transfer(&budget->i2c_adap, &msg, 1) != 1) 786 if (i2c_transfer(&budget->i2c_adap, &msg, 1) != 1)
787 return -EIO; 787 return -EIO;
788 return 0; 788 return 0;
@@ -802,8 +802,8 @@ static int philips_tu1216_tuner_init(struct dvb_frontend *fe)
802 struct i2c_msg tuner_msg = {.addr = 0x60,.flags = 0,.buf = tu1216_init,.len = sizeof(tu1216_init) }; 802 struct i2c_msg tuner_msg = {.addr = 0x60,.flags = 0,.buf = tu1216_init,.len = sizeof(tu1216_init) };
803 803
804 // setup PLL configuration 804 // setup PLL configuration
805 if (fe->ops->i2c_gate_ctrl) 805 if (fe->ops.i2c_gate_ctrl)
806 fe->ops->i2c_gate_ctrl(fe, 1); 806 fe->ops.i2c_gate_ctrl(fe, 1);
807 if (i2c_transfer(&budget->i2c_adap, &tuner_msg, 1) != 1) 807 if (i2c_transfer(&budget->i2c_adap, &tuner_msg, 1) != 1)
808 return -EIO; 808 return -EIO;
809 msleep(1); 809 msleep(1);
@@ -885,8 +885,8 @@ static int philips_tu1216_tuner_set_params(struct dvb_frontend *fe, struct dvb_f
885 tuner_buf[2] = 0xca; 885 tuner_buf[2] = 0xca;
886 tuner_buf[3] = (cp << 5) | (filter << 3) | band; 886 tuner_buf[3] = (cp << 5) | (filter << 3) | band;
887 887
888 if (fe->ops->i2c_gate_ctrl) 888 if (fe->ops.i2c_gate_ctrl)
889 fe->ops->i2c_gate_ctrl(fe, 1); 889 fe->ops.i2c_gate_ctrl(fe, 1);
890 if (i2c_transfer(&budget->i2c_adap, &tuner_msg, 1) != 1) 890 if (i2c_transfer(&budget->i2c_adap, &tuner_msg, 1) != 1)
891 return -EIO; 891 return -EIO;
892 892
@@ -971,8 +971,8 @@ static int philips_sd1878_tda8261_tuner_set_params(struct dvb_frontend *fe,
971 params->frequency, 0); 971 params->frequency, 0);
972 if(rc < 0) return rc; 972 if(rc < 0) return rc;
973 973
974 if (fe->ops->i2c_gate_ctrl) 974 if (fe->ops.i2c_gate_ctrl)
975 fe->ops->i2c_gate_ctrl(fe, 1); 975 fe->ops.i2c_gate_ctrl(fe, 1);
976 if(i2c_transfer(&budget->i2c_adap, &tuner_msg, 1) != 1) 976 if(i2c_transfer(&budget->i2c_adap, &tuner_msg, 1) != 1)
977 return -EIO; 977 return -EIO;
978 978
@@ -1099,13 +1099,13 @@ static void frontend_init(struct budget_av *budget_av)
1099 fe = stv0299_attach(&cinergy_1200s_1894_0010_config, 1099 fe = stv0299_attach(&cinergy_1200s_1894_0010_config,
1100 &budget_av->budget.i2c_adap); 1100 &budget_av->budget.i2c_adap);
1101 if (fe) { 1101 if (fe) {
1102 fe->ops->tuner_ops.set_params = philips_su1278sh2_tua6100_tuner_set_params; 1102 fe->ops.tuner_ops.set_params = philips_su1278sh2_tua6100_tuner_set_params;
1103 } 1103 }
1104 } else { 1104 } else {
1105 fe = stv0299_attach(&typhoon_config, 1105 fe = stv0299_attach(&typhoon_config,
1106 &budget_av->budget.i2c_adap); 1106 &budget_av->budget.i2c_adap);
1107 if (fe) { 1107 if (fe) {
1108 fe->ops->tuner_ops.set_params = philips_su1278_ty_ci_tuner_set_params; 1108 fe->ops.tuner_ops.set_params = philips_su1278_ty_ci_tuner_set_params;
1109 } 1109 }
1110 } 1110 }
1111 break; 1111 break;
@@ -1117,7 +1117,7 @@ static void frontend_init(struct budget_av *budget_av)
1117 fe = stv0299_attach(&philips_sd1878_config, 1117 fe = stv0299_attach(&philips_sd1878_config,
1118 &budget_av->budget.i2c_adap); 1118 &budget_av->budget.i2c_adap);
1119 if (fe) { 1119 if (fe) {
1120 fe->ops->tuner_ops.set_params = philips_sd1878_tda8261_tuner_set_params; 1120 fe->ops.tuner_ops.set_params = philips_sd1878_tda8261_tuner_set_params;
1121 } 1121 }
1122 break; 1122 break;
1123 1123
@@ -1126,7 +1126,7 @@ static void frontend_init(struct budget_av *budget_av)
1126 fe = stv0299_attach(&typhoon_config, 1126 fe = stv0299_attach(&typhoon_config,
1127 &budget_av->budget.i2c_adap); 1127 &budget_av->budget.i2c_adap);
1128 if (fe) { 1128 if (fe) {
1129 fe->ops->tuner_ops.set_params = philips_su1278_ty_ci_tuner_set_params; 1129 fe->ops.tuner_ops.set_params = philips_su1278_ty_ci_tuner_set_params;
1130 } 1130 }
1131 break; 1131 break;
1132 1132
@@ -1134,7 +1134,7 @@ static void frontend_init(struct budget_av *budget_av)
1134 fe = stv0299_attach(&cinergy_1200s_config, 1134 fe = stv0299_attach(&cinergy_1200s_config,
1135 &budget_av->budget.i2c_adap); 1135 &budget_av->budget.i2c_adap);
1136 if (fe) { 1136 if (fe) {
1137 fe->ops->tuner_ops.set_params = philips_su1278_ty_ci_tuner_set_params; 1137 fe->ops.tuner_ops.set_params = philips_su1278_ty_ci_tuner_set_params;
1138 } 1138 }
1139 break; 1139 break;
1140 1140
@@ -1147,9 +1147,9 @@ static void frontend_init(struct budget_av *budget_av)
1147 read_pwm(budget_av)); 1147 read_pwm(budget_av));
1148 if (fe) { 1148 if (fe) {
1149 budget_av->tda10021_poclkp = 1; 1149 budget_av->tda10021_poclkp = 1;
1150 budget_av->tda10021_set_frontend = fe->ops->set_frontend; 1150 budget_av->tda10021_set_frontend = fe->ops.set_frontend;
1151 fe->ops->set_frontend = tda10021_set_frontend; 1151 fe->ops.set_frontend = tda10021_set_frontend;
1152 fe->ops->tuner_ops.set_params = philips_cu1216_tuner_set_params; 1152 fe->ops.tuner_ops.set_params = philips_cu1216_tuner_set_params;
1153 } 1153 }
1154 break; 1154 break;
1155 1155
@@ -1160,8 +1160,8 @@ static void frontend_init(struct budget_av *budget_av)
1160 fe = tda10046_attach(&philips_tu1216_config, 1160 fe = tda10046_attach(&philips_tu1216_config,
1161 &budget_av->budget.i2c_adap); 1161 &budget_av->budget.i2c_adap);
1162 if (fe) { 1162 if (fe) {
1163 fe->ops->tuner_ops.init = philips_tu1216_tuner_init; 1163 fe->ops.tuner_ops.init = philips_tu1216_tuner_init;
1164 fe->ops->tuner_ops.set_params = philips_tu1216_tuner_set_params; 1164 fe->ops.tuner_ops.set_params = philips_tu1216_tuner_set_params;
1165 } 1165 }
1166 break; 1166 break;
1167 } 1167 }
@@ -1181,8 +1181,8 @@ static void frontend_init(struct budget_av *budget_av)
1181 if (dvb_register_frontend(&budget_av->budget.dvb_adapter, 1181 if (dvb_register_frontend(&budget_av->budget.dvb_adapter,
1182 budget_av->budget.dvb_frontend)) { 1182 budget_av->budget.dvb_frontend)) {
1183 printk(KERN_ERR "budget-av: Frontend registration failed!\n"); 1183 printk(KERN_ERR "budget-av: Frontend registration failed!\n");
1184 if (budget_av->budget.dvb_frontend->ops->release) 1184 if (budget_av->budget.dvb_frontend->ops.release)
1185 budget_av->budget.dvb_frontend->ops->release(budget_av->budget.dvb_frontend); 1185 budget_av->budget.dvb_frontend->ops.release(budget_av->budget.dvb_frontend);
1186 budget_av->budget.dvb_frontend = NULL; 1186 budget_av->budget.dvb_frontend = NULL;
1187 } 1187 }
1188} 1188}