aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/common
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2013-03-19 11:06:08 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-03-21 06:53:26 -0400
commit2a7643159d0faf839529f5001737b996d53760d9 (patch)
treec861bedd166d6878be5db5476408bf0e1c572338 /drivers/media/common
parente584f9d61ea0aefa81ddd3faf53100536ba4057e (diff)
[media] siano: reorder smscore_get_fw_filename() function
Put this function earlier in the code, to avoid the need of defining a function stub. No functional changes. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/common')
-rw-r--r--drivers/media/common/siano/smscoreapi.c172
1 files changed, 84 insertions, 88 deletions
diff --git a/drivers/media/common/siano/smscoreapi.c b/drivers/media/common/siano/smscoreapi.c
index d57df9170ae1..c04d8267adba 100644
--- a/drivers/media/common/siano/smscoreapi.c
+++ b/drivers/media/common/siano/smscoreapi.c
@@ -1046,9 +1046,92 @@ exit_fw_download:
1046 return rc; 1046 return rc;
1047} 1047}
1048 1048
1049static char *smscore_fw_lkup[][DEVICE_MODE_MAX] = {
1050 [SMS_NOVA_A0] = {
1051 [DEVICE_MODE_DVBT] = "dvb_nova_12mhz.inp",
1052 [DEVICE_MODE_DVBH] = "dvb_nova_12mhz.inp",
1053 [DEVICE_MODE_DAB_TDMB] = "tdmb_nova_12mhz.inp",
1054 [DEVICE_MODE_DVBT_BDA] = "dvb_nova_12mhz.inp",
1055 [DEVICE_MODE_ISDBT] = "isdbt_nova_12mhz.inp",
1056 [DEVICE_MODE_ISDBT_BDA] = "isdbt_nova_12mhz.inp",
1057 },
1058 [SMS_NOVA_B0] = {
1059 [DEVICE_MODE_DVBT] = "dvb_nova_12mhz_b0.inp",
1060 [DEVICE_MODE_DVBH] = "dvb_nova_12mhz_b0.inp",
1061 [DEVICE_MODE_DAB_TDMB] = "tdmb_nova_12mhz_b0.inp",
1062 [DEVICE_MODE_DVBT_BDA] = "dvb_nova_12mhz_b0.inp",
1063 [DEVICE_MODE_ISDBT] = "isdbt_nova_12mhz_b0.inp",
1064 [DEVICE_MODE_ISDBT_BDA] = "isdbt_nova_12mhz_b0.inp",
1065 [DEVICE_MODE_FM_RADIO] = "fm_radio.inp",
1066 [DEVICE_MODE_FM_RADIO_BDA] = "fm_radio.inp",
1067 },
1068 [SMS_VEGA] = {
1069 [DEVICE_MODE_CMMB] = "cmmb_vega_12mhz.inp",
1070 },
1071 [SMS_VENICE] = {
1072 [DEVICE_MODE_CMMB] = "cmmb_venice_12mhz.inp",
1073 },
1074 [SMS_MING] = {
1075 [DEVICE_MODE_CMMB] = "cmmb_ming_app.inp",
1076 },
1077 [SMS_PELE] = {
1078 [DEVICE_MODE_ISDBT] = "isdbt_pele.inp",
1079 [DEVICE_MODE_ISDBT_BDA] = "isdbt_pele.inp",
1080 },
1081 [SMS_RIO] = {
1082 [DEVICE_MODE_DVBT] = "dvb_rio.inp",
1083 [DEVICE_MODE_DVBH] = "dvbh_rio.inp",
1084 [DEVICE_MODE_DVBT_BDA] = "dvb_rio.inp",
1085 [DEVICE_MODE_ISDBT] = "isdbt_rio.inp",
1086 [DEVICE_MODE_ISDBT_BDA] = "isdbt_rio.inp",
1087 [DEVICE_MODE_FM_RADIO] = "fm_radio_rio.inp",
1088 [DEVICE_MODE_FM_RADIO_BDA] = "fm_radio_rio.inp",
1089 },
1090 [SMS_DENVER_1530] = {
1091 [DEVICE_MODE_ATSC] = "atsc_denver.inp",
1092 },
1093 [SMS_DENVER_2160] = {
1094 [DEVICE_MODE_DAB_TDMB] = "tdmb_denver.inp",
1095 },
1096};
1049 1097
1098/**
1099 * get firmware file name from one of the two mechanisms : sms_boards or
1100 * smscore_fw_lkup.
1101 * @param coredev pointer to a coredev object returned by
1102 * smscore_register_device
1103 * @param mode requested mode of operation
1104 * @param lookup if 1, always get the fw filename from smscore_fw_lkup
1105 * table. if 0, try first to get from sms_boards
1106 *
1107 * @return 0 on success, <0 on error.
1108 */
1050static char *smscore_get_fw_filename(struct smscore_device_t *coredev, 1109static char *smscore_get_fw_filename(struct smscore_device_t *coredev,
1051 int mode); 1110 int mode)
1111{
1112 char **fw;
1113 int board_id = smscore_get_board_id(coredev);
1114 enum sms_device_type_st type;
1115
1116 type = smscore_registry_gettype(coredev->devpath);
1117
1118 /* Prevent looking outside the smscore_fw_lkup table */
1119 if (type <= SMS_UNKNOWN_TYPE || type >= SMS_NUM_OF_DEVICE_TYPES)
1120 return NULL;
1121 if (mode <= DEVICE_MODE_NONE || mode >= DEVICE_MODE_MAX)
1122 return NULL;
1123
1124 sms_debug("trying to get fw name from sms_boards board_id %d mode %d",
1125 board_id, mode);
1126 fw = sms_get_board(board_id)->fw;
1127 if (!fw || !fw[mode]) {
1128 sms_debug("cannot find fw name in sms_boards, getting from lookup table mode %d type %d",
1129 mode, type);
1130 return smscore_fw_lkup[type][mode];
1131 }
1132
1133 return fw[mode];
1134}
1052 1135
1053/** 1136/**
1054 * loads specified firmware into a buffer and calls device loadfirmware_handler 1137 * loads specified firmware into a buffer and calls device loadfirmware_handler
@@ -1207,93 +1290,6 @@ static int smscore_detect_mode(struct smscore_device_t *coredev)
1207 return rc; 1290 return rc;
1208} 1291}
1209 1292
1210static char *smscore_fw_lkup[][DEVICE_MODE_MAX] = {
1211 [SMS_NOVA_A0] = {
1212 [DEVICE_MODE_DVBT] = "dvb_nova_12mhz.inp",
1213 [DEVICE_MODE_DVBH] = "dvb_nova_12mhz.inp",
1214 [DEVICE_MODE_DAB_TDMB] = "tdmb_nova_12mhz.inp",
1215 [DEVICE_MODE_DVBT_BDA] = "dvb_nova_12mhz.inp",
1216 [DEVICE_MODE_ISDBT] = "isdbt_nova_12mhz.inp",
1217 [DEVICE_MODE_ISDBT_BDA] = "isdbt_nova_12mhz.inp",
1218 },
1219 [SMS_NOVA_B0] = {
1220 [DEVICE_MODE_DVBT] = "dvb_nova_12mhz_b0.inp",
1221 [DEVICE_MODE_DVBH] = "dvb_nova_12mhz_b0.inp",
1222 [DEVICE_MODE_DAB_TDMB] = "tdmb_nova_12mhz_b0.inp",
1223 [DEVICE_MODE_DVBT_BDA] = "dvb_nova_12mhz_b0.inp",
1224 [DEVICE_MODE_ISDBT] = "isdbt_nova_12mhz_b0.inp",
1225 [DEVICE_MODE_ISDBT_BDA] = "isdbt_nova_12mhz_b0.inp",
1226 [DEVICE_MODE_FM_RADIO] = "fm_radio.inp",
1227 [DEVICE_MODE_FM_RADIO_BDA] = "fm_radio.inp",
1228 },
1229 [SMS_VEGA] = {
1230 [DEVICE_MODE_CMMB] = "cmmb_vega_12mhz.inp",
1231 },
1232 [SMS_VENICE] = {
1233 [DEVICE_MODE_CMMB] = "cmmb_venice_12mhz.inp",
1234 },
1235 [SMS_MING] = {
1236 [DEVICE_MODE_CMMB] = "cmmb_ming_app.inp",
1237 },
1238 [SMS_PELE] = {
1239 [DEVICE_MODE_ISDBT] = "isdbt_pele.inp",
1240 [DEVICE_MODE_ISDBT_BDA] = "isdbt_pele.inp",
1241 },
1242 [SMS_RIO] = {
1243 [DEVICE_MODE_DVBT] = "dvb_rio.inp",
1244 [DEVICE_MODE_DVBH] = "dvbh_rio.inp",
1245 [DEVICE_MODE_DVBT_BDA] = "dvb_rio.inp",
1246 [DEVICE_MODE_ISDBT] = "isdbt_rio.inp",
1247 [DEVICE_MODE_ISDBT_BDA] = "isdbt_rio.inp",
1248 [DEVICE_MODE_FM_RADIO] = "fm_radio_rio.inp",
1249 [DEVICE_MODE_FM_RADIO_BDA] = "fm_radio_rio.inp",
1250 },
1251 [SMS_DENVER_1530] = {
1252 [DEVICE_MODE_ATSC] = "atsc_denver.inp",
1253 },
1254 [SMS_DENVER_2160] = {
1255 [DEVICE_MODE_DAB_TDMB] = "tdmb_denver.inp",
1256 },
1257};
1258
1259/**
1260 * get firmware file name from one of the two mechanisms : sms_boards or
1261 * smscore_fw_lkup.
1262 * @param coredev pointer to a coredev object returned by
1263 * smscore_register_device
1264 * @param mode requested mode of operation
1265 * @param lookup if 1, always get the fw filename from smscore_fw_lkup
1266 * table. if 0, try first to get from sms_boards
1267 *
1268 * @return 0 on success, <0 on error.
1269 */
1270static char *smscore_get_fw_filename(struct smscore_device_t *coredev,
1271 int mode)
1272{
1273 char **fw;
1274 int board_id = smscore_get_board_id(coredev);
1275 enum sms_device_type_st type;
1276
1277 type = smscore_registry_gettype(coredev->devpath);
1278
1279 /* Prevent looking outside the smscore_fw_lkup table */
1280 if (type <= SMS_UNKNOWN_TYPE || type >= SMS_NUM_OF_DEVICE_TYPES)
1281 return NULL;
1282 if (mode <= DEVICE_MODE_NONE || mode >= DEVICE_MODE_MAX)
1283 return NULL;
1284
1285 sms_debug("trying to get fw name from sms_boards board_id %d mode %d",
1286 board_id, mode);
1287 fw = sms_get_board(board_id)->fw;
1288 if (!fw || !fw[mode]) {
1289 sms_debug("cannot find fw name in sms_boards, getting from lookup table mode %d type %d",
1290 mode, type);
1291 return smscore_fw_lkup[type][mode];
1292 }
1293
1294 return fw[mode];
1295}
1296
1297/** 1293/**
1298 * send init device request and wait for response 1294 * send init device request and wait for response
1299 * 1295 *