aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/saa7134/saa7134-dvb.c
diff options
context:
space:
mode:
authorAndrew de Quincey <adq_dvb@lidskialf.net>2006-04-20 11:01:47 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-06-25 00:59:38 -0400
commit6b3ccab75ce082f7d63a43903ebd75da4266f77e (patch)
tree866d08667706310aaf7151a9802595fb44a7b63f /drivers/media/video/saa7134/saa7134-dvb.c
parent159f8a6eda8c2ee359bb87bf62be70da2da14918 (diff)
V4L/DVB (3895): Additional frontend_init safety checks
Don't try and set the tuner ops if the demod was not detected. Signed-off-by: Andrew de Quincey <adq_dvb@lidskialf.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/saa7134/saa7134-dvb.c')
-rw-r--r--drivers/media/video/saa7134/saa7134-dvb.c116
1 files changed, 74 insertions, 42 deletions
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c
index d62e9a4f2a1c..a83db2abb449 100644
--- a/drivers/media/video/saa7134/saa7134-dvb.c
+++ b/drivers/media/video/saa7134/saa7134-dvb.c
@@ -1020,112 +1020,144 @@ static int dvb_init(struct saa7134_dev *dev)
1020 printk("%s: pinnacle 300i dvb setup\n",dev->name); 1020 printk("%s: pinnacle 300i dvb setup\n",dev->name);
1021 dev->dvb.frontend = mt352_attach(&pinnacle_300i, 1021 dev->dvb.frontend = mt352_attach(&pinnacle_300i,
1022 &dev->i2c_adap); 1022 &dev->i2c_adap);
1023 dev->dvb.frontend->ops->tuner_ops.calc_regs = mt352_pinnacle_tuner_calc_regs; 1023 if (dev->dvb.frontend) {
1024 dev->dvb.frontend->ops->tuner_ops.calc_regs = mt352_pinnacle_tuner_calc_regs;
1025 }
1024 break; 1026 break;
1025 1027
1026 case SAA7134_BOARD_AVERMEDIA_777: 1028 case SAA7134_BOARD_AVERMEDIA_777:
1027 printk("%s: avertv 777 dvb setup\n",dev->name); 1029 printk("%s: avertv 777 dvb setup\n",dev->name);
1028 dev->dvb.frontend = mt352_attach(&avermedia_777, 1030 dev->dvb.frontend = mt352_attach(&avermedia_777,
1029 &dev->i2c_adap); 1031 &dev->i2c_adap);
1030 dev->dvb.frontend->ops->tuner_ops.calc_regs = mt352_aver777_tuner_calc_regs; 1032 if (dev->dvb.frontend) {
1033 dev->dvb.frontend->ops->tuner_ops.calc_regs = mt352_aver777_tuner_calc_regs;
1034 }
1031 break; 1035 break;
1032#endif 1036#endif
1033#ifdef HAVE_TDA1004X 1037#ifdef HAVE_TDA1004X
1034 case SAA7134_BOARD_MD7134: 1038 case SAA7134_BOARD_MD7134:
1035 dev->dvb.frontend = tda10046_attach(&medion_cardbus, 1039 dev->dvb.frontend = tda10046_attach(&medion_cardbus,
1036 &dev->i2c_adap); 1040 &dev->i2c_adap);
1037 dev->dvb.frontend->ops->tuner_ops.init = philips_fmd1216_tuner_init; 1041 if (dev->dvb.frontend) {
1038 dev->dvb.frontend->ops->tuner_ops.sleep = philips_fmd1216_tuner_sleep; 1042 dev->dvb.frontend->ops->tuner_ops.init = philips_fmd1216_tuner_init;
1039 dev->dvb.frontend->ops->tuner_ops.set_params = philips_fmd1216_tuner_set_params; 1043 dev->dvb.frontend->ops->tuner_ops.sleep = philips_fmd1216_tuner_sleep;
1044 dev->dvb.frontend->ops->tuner_ops.set_params = philips_fmd1216_tuner_set_params;
1045 }
1040 break; 1046 break;
1041 case SAA7134_BOARD_PHILIPS_TOUGH: 1047 case SAA7134_BOARD_PHILIPS_TOUGH:
1042 dev->dvb.frontend = tda10046_attach(&philips_tu1216_60_config, 1048 dev->dvb.frontend = tda10046_attach(&philips_tu1216_60_config,
1043 &dev->i2c_adap); 1049 &dev->i2c_adap);
1044 dev->dvb.frontend->ops->tuner_ops.init = philips_tu1216_tuner_60_init; 1050 if (dev->dvb.frontend) {
1045 dev->dvb.frontend->ops->tuner_ops.set_params = philips_tu1216_tuner_60_set_params; 1051 dev->dvb.frontend->ops->tuner_ops.init = philips_tu1216_tuner_60_init;
1052 dev->dvb.frontend->ops->tuner_ops.set_params = philips_tu1216_tuner_60_set_params;
1053 }
1046 break; 1054 break;
1047 case SAA7134_BOARD_FLYDVBTDUO: 1055 case SAA7134_BOARD_FLYDVBTDUO:
1048 dev->dvb.frontend = tda10046_attach(&tda827x_lifeview_config, 1056 dev->dvb.frontend = tda10046_attach(&tda827x_lifeview_config,
1049 &dev->i2c_adap); 1057 &dev->i2c_adap);
1050 dev->dvb.frontend->ops->tuner_ops.init = philips_tda827x_tuner_init; 1058 if (dev->dvb.frontend) {
1051 dev->dvb.frontend->ops->tuner_ops.sleep = philips_tda827x_tuner_sleep; 1059 dev->dvb.frontend->ops->tuner_ops.init = philips_tda827x_tuner_init;
1052 dev->dvb.frontend->ops->tuner_ops.set_params = philips_tda827x_tuner_set_params; 1060 dev->dvb.frontend->ops->tuner_ops.sleep = philips_tda827x_tuner_sleep;
1061 dev->dvb.frontend->ops->tuner_ops.set_params = philips_tda827x_tuner_set_params;
1062 }
1053 break; 1063 break;
1054 case SAA7134_BOARD_FLYDVBT_DUO_CARDBUS: 1064 case SAA7134_BOARD_FLYDVBT_DUO_CARDBUS:
1055 dev->dvb.frontend = tda10046_attach(&tda827x_lifeview_config, 1065 dev->dvb.frontend = tda10046_attach(&tda827x_lifeview_config,
1056 &dev->i2c_adap); 1066 &dev->i2c_adap);
1057 dev->dvb.frontend->ops->tuner_ops.init = philips_tda827x_tuner_init; 1067 if (dev->dvb.frontend) {
1058 dev->dvb.frontend->ops->tuner_ops.sleep = philips_tda827x_tuner_sleep; 1068 dev->dvb.frontend->ops->tuner_ops.init = philips_tda827x_tuner_init;
1059 dev->dvb.frontend->ops->tuner_ops.set_params = philips_tda827x_tuner_set_params; 1069 dev->dvb.frontend->ops->tuner_ops.sleep = philips_tda827x_tuner_sleep;
1070 dev->dvb.frontend->ops->tuner_ops.set_params = philips_tda827x_tuner_set_params;
1071 }
1060 break; 1072 break;
1061 case SAA7134_BOARD_PHILIPS_EUROPA: 1073 case SAA7134_BOARD_PHILIPS_EUROPA:
1062 dev->dvb.frontend = tda10046_attach(&philips_europa_config, 1074 dev->dvb.frontend = tda10046_attach(&philips_europa_config,
1063 &dev->i2c_adap); 1075 &dev->i2c_adap);
1064 dev->original_demod_sleep = dev->dvb.frontend->ops->sleep; 1076 if (dev->dvb.frontend) {
1065 dev->dvb.frontend->ops->sleep = philips_europa_demod_sleep; 1077 dev->original_demod_sleep = dev->dvb.frontend->ops->sleep;
1066 dev->dvb.frontend->ops->tuner_ops.init = philips_europa_tuner_init; 1078 dev->dvb.frontend->ops->sleep = philips_europa_demod_sleep;
1067 dev->dvb.frontend->ops->tuner_ops.sleep = philips_europa_tuner_sleep; 1079 dev->dvb.frontend->ops->tuner_ops.init = philips_europa_tuner_init;
1068 dev->dvb.frontend->ops->tuner_ops.set_params = philips_td1316_tuner_set_params; 1080 dev->dvb.frontend->ops->tuner_ops.sleep = philips_europa_tuner_sleep;
1081 dev->dvb.frontend->ops->tuner_ops.set_params = philips_td1316_tuner_set_params;
1082 }
1069 break; 1083 break;
1070 case SAA7134_BOARD_VIDEOMATE_DVBT_300: 1084 case SAA7134_BOARD_VIDEOMATE_DVBT_300:
1071 dev->dvb.frontend = tda10046_attach(&philips_europa_config, 1085 dev->dvb.frontend = tda10046_attach(&philips_europa_config,
1072 &dev->i2c_adap); 1086 &dev->i2c_adap);
1073 dev->dvb.frontend->ops->tuner_ops.init = philips_europa_tuner_init; 1087 if (dev->dvb.frontend) {
1074 dev->dvb.frontend->ops->tuner_ops.sleep = philips_europa_tuner_sleep; 1088 dev->dvb.frontend->ops->tuner_ops.init = philips_europa_tuner_init;
1075 dev->dvb.frontend->ops->tuner_ops.set_params = philips_td1316_tuner_set_params; 1089 dev->dvb.frontend->ops->tuner_ops.sleep = philips_europa_tuner_sleep;
1090 dev->dvb.frontend->ops->tuner_ops.set_params = philips_td1316_tuner_set_params;
1091 }
1076 break; 1092 break;
1077 case SAA7134_BOARD_VIDEOMATE_DVBT_200: 1093 case SAA7134_BOARD_VIDEOMATE_DVBT_200:
1078 dev->dvb.frontend = tda10046_attach(&philips_tu1216_61_config, 1094 dev->dvb.frontend = tda10046_attach(&philips_tu1216_61_config,
1079 &dev->i2c_adap); 1095 &dev->i2c_adap);
1080 dev->dvb.frontend->ops->tuner_ops.init = philips_tu1216_tuner_61_init; 1096 if (dev->dvb.frontend) {
1081 dev->dvb.frontend->ops->tuner_ops.set_params = philips_tu1216_tuner_61_set_params; 1097 dev->dvb.frontend->ops->tuner_ops.init = philips_tu1216_tuner_61_init;
1098 dev->dvb.frontend->ops->tuner_ops.set_params = philips_tu1216_tuner_61_set_params;
1099 }
1082 break; 1100 break;
1083 case SAA7134_BOARD_PHILIPS_TIGER: 1101 case SAA7134_BOARD_PHILIPS_TIGER:
1084 dev->dvb.frontend = tda10046_attach(&philips_tiger_config, 1102 dev->dvb.frontend = tda10046_attach(&philips_tiger_config,
1085 &dev->i2c_adap); 1103 &dev->i2c_adap);
1086 dev->dvb.frontend->ops->tuner_ops.init = philips_tiger_tuner_init; 1104 if (dev->dvb.frontend) {
1087 dev->dvb.frontend->ops->tuner_ops.sleep = philips_tiger_tuner_sleep; 1105 dev->dvb.frontend->ops->tuner_ops.init = philips_tiger_tuner_init;
1088 dev->dvb.frontend->ops->tuner_ops.set_params = philips_tiger_tuner_set_params; 1106 dev->dvb.frontend->ops->tuner_ops.sleep = philips_tiger_tuner_sleep;
1107 dev->dvb.frontend->ops->tuner_ops.set_params = philips_tiger_tuner_set_params;
1108 }
1089 break; 1109 break;
1090 case SAA7134_BOARD_ASUSTeK_P7131_DUAL: 1110 case SAA7134_BOARD_ASUSTeK_P7131_DUAL:
1091 dev->dvb.frontend = tda10046_attach(&philips_tiger_config, 1111 dev->dvb.frontend = tda10046_attach(&philips_tiger_config,
1092 &dev->i2c_adap); 1112 &dev->i2c_adap);
1093 dev->dvb.frontend->ops->tuner_ops.init = philips_tiger_tuner_init; 1113 if (dev->dvb.frontend) {
1094 dev->dvb.frontend->ops->tuner_ops.sleep = philips_tiger_tuner_sleep; 1114 dev->dvb.frontend->ops->tuner_ops.init = philips_tiger_tuner_init;
1095 dev->dvb.frontend->ops->tuner_ops.set_params = philips_tiger_tuner_set_params; 1115 dev->dvb.frontend->ops->tuner_ops.sleep = philips_tiger_tuner_sleep;
1116 dev->dvb.frontend->ops->tuner_ops.set_params = philips_tiger_tuner_set_params;
1117 }
1096 break; 1118 break;
1097 case SAA7134_BOARD_FLYDVBT_LR301: 1119 case SAA7134_BOARD_FLYDVBT_LR301:
1098 dev->dvb.frontend = tda10046_attach(&tda827x_lifeview_config, 1120 dev->dvb.frontend = tda10046_attach(&tda827x_lifeview_config,
1099 &dev->i2c_adap); 1121 &dev->i2c_adap);
1100 dev->dvb.frontend->ops->tuner_ops.init = philips_tda827x_tuner_init; 1122 if (dev->dvb.frontend) {
1101 dev->dvb.frontend->ops->tuner_ops.sleep = philips_tda827x_tuner_sleep; 1123 dev->dvb.frontend->ops->tuner_ops.init = philips_tda827x_tuner_init;
1102 dev->dvb.frontend->ops->tuner_ops.set_params = philips_tda827x_tuner_set_params; 1124 dev->dvb.frontend->ops->tuner_ops.sleep = philips_tda827x_tuner_sleep;
1125 dev->dvb.frontend->ops->tuner_ops.set_params = philips_tda827x_tuner_set_params;
1126 }
1103 break; 1127 break;
1104 case SAA7134_BOARD_FLYDVB_TRIO: 1128 case SAA7134_BOARD_FLYDVB_TRIO:
1105 dev->dvb.frontend = tda10046_attach(&lifeview_trio_config, 1129 dev->dvb.frontend = tda10046_attach(&lifeview_trio_config,
1106 &dev->i2c_adap); 1130 &dev->i2c_adap);
1107 dev->dvb.frontend->ops->tuner_ops.sleep = lifeview_trio_tuner_sleep; 1131 if (dev->dvb.frontend) {
1108 dev->dvb.frontend->ops->tuner_ops.set_params = lifeview_trio_tuner_set_params; 1132 dev->dvb.frontend->ops->tuner_ops.sleep = lifeview_trio_tuner_sleep;
1133 dev->dvb.frontend->ops->tuner_ops.set_params = lifeview_trio_tuner_set_params;
1134 }
1109 break; 1135 break;
1110 case SAA7134_BOARD_ADS_DUO_CARDBUS_PTV331: 1136 case SAA7134_BOARD_ADS_DUO_CARDBUS_PTV331:
1111 dev->dvb.frontend = tda10046_attach(&ads_tech_duo_config, 1137 dev->dvb.frontend = tda10046_attach(&ads_tech_duo_config,
1112 &dev->i2c_adap); 1138 &dev->i2c_adap);
1113 dev->dvb.frontend->ops->tuner_ops.init = ads_duo_tuner_init; 1139 if (dev->dvb.frontend) {
1114 dev->dvb.frontend->ops->tuner_ops.sleep = ads_duo_tuner_sleep; 1140 dev->dvb.frontend->ops->tuner_ops.init = ads_duo_tuner_init;
1115 dev->dvb.frontend->ops->tuner_ops.set_params = ads_duo_tuner_set_params; 1141 dev->dvb.frontend->ops->tuner_ops.sleep = ads_duo_tuner_sleep;
1142 dev->dvb.frontend->ops->tuner_ops.set_params = ads_duo_tuner_set_params;
1143 }
1116 break; 1144 break;
1117 case SAA7134_BOARD_TEVION_DVBT_220RF: 1145 case SAA7134_BOARD_TEVION_DVBT_220RF:
1118 dev->dvb.frontend = tda10046_attach(&tevion_dvbt220rf_config, 1146 dev->dvb.frontend = tda10046_attach(&tevion_dvbt220rf_config,
1119 &dev->i2c_adap); 1147 &dev->i2c_adap);
1120 dev->dvb.frontend->ops->tuner_ops.sleep = tevion_dvb220rf_tuner_sleep; 1148 if (dev->dvb.frontend) {
1121 dev->dvb.frontend->ops->tuner_ops.set_params = tevion_dvb220rf_tuner_set_params; 1149 dev->dvb.frontend->ops->tuner_ops.sleep = tevion_dvb220rf_tuner_sleep;
1150 dev->dvb.frontend->ops->tuner_ops.set_params = tevion_dvb220rf_tuner_set_params;
1151 }
1122 break; 1152 break;
1123 case SAA7134_BOARD_FLYDVBT_HYBRID_CARDBUS: 1153 case SAA7134_BOARD_FLYDVBT_HYBRID_CARDBUS:
1124 dev->dvb.frontend = tda10046_attach(&ads_tech_duo_config, 1154 dev->dvb.frontend = tda10046_attach(&ads_tech_duo_config,
1125 &dev->i2c_adap); 1155 &dev->i2c_adap);
1126 dev->dvb.frontend->ops->tuner_ops.init = ads_duo_tuner_init; 1156 if (dev->dvb.frontend) {
1127 dev->dvb.frontend->ops->tuner_ops.sleep = ads_duo_tuner_sleep; 1157 dev->dvb.frontend->ops->tuner_ops.init = ads_duo_tuner_init;
1128 dev->dvb.frontend->ops->tuner_ops.set_params = ads_duo_tuner_set_params; 1158 dev->dvb.frontend->ops->tuner_ops.sleep = ads_duo_tuner_sleep;
1159 dev->dvb.frontend->ops->tuner_ops.set_params = ads_duo_tuner_set_params;
1160 }
1129 break; 1161 break;
1130#endif 1162#endif
1131#ifdef HAVE_NXT200X 1163#ifdef HAVE_NXT200X