media: dvb-frontends: tda18271c2dd: Constify static structs
Constify a number of static structs that were not modified. In order to be able to do that, const input arguments to a couple of functions that not modify their argument. This allows the compiler to put them in read-only memory, resulting in about 6k memory being read-only, and the resulting module is 400 bytes smaller. Before: text data bss dec hex filename 15492 6873 0 22365 575d drivers/media/dvb-frontends/tda18271c2dd.ko After: text data bss dec hex filename 21021 897 0 21918 559e drivers/media/dvb-frontends/tda18271c2dd.ko Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
parent
cf580e11fb
commit
2d4ffef1de
@ -198,58 +198,55 @@ static void reset(struct tda_state *state)
|
||||
state->m_bFMInput = (ulFMInput == 2);
|
||||
}
|
||||
|
||||
static bool SearchMap1(struct SMap Map[],
|
||||
u32 Frequency, u8 *pParam)
|
||||
static bool SearchMap1(const struct SMap map[], u32 frequency, u8 *param)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
while ((Map[i].m_Frequency != 0) && (Frequency > Map[i].m_Frequency))
|
||||
while ((map[i].m_Frequency != 0) && (frequency > map[i].m_Frequency))
|
||||
i += 1;
|
||||
if (Map[i].m_Frequency == 0)
|
||||
if (map[i].m_Frequency == 0)
|
||||
return false;
|
||||
*pParam = Map[i].m_Param;
|
||||
*param = map[i].m_Param;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool SearchMap2(struct SMapI Map[],
|
||||
u32 Frequency, s32 *pParam)
|
||||
static bool SearchMap2(const struct SMapI map[], u32 frequency, s32 *param)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
while ((Map[i].m_Frequency != 0) &&
|
||||
(Frequency > Map[i].m_Frequency))
|
||||
while ((map[i].m_Frequency != 0) &&
|
||||
(frequency > map[i].m_Frequency))
|
||||
i += 1;
|
||||
if (Map[i].m_Frequency == 0)
|
||||
if (map[i].m_Frequency == 0)
|
||||
return false;
|
||||
*pParam = Map[i].m_Param;
|
||||
*param = map[i].m_Param;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool SearchMap3(struct SMap2 Map[], u32 Frequency,
|
||||
u8 *pParam1, u8 *pParam2)
|
||||
static bool SearchMap3(const struct SMap2 map[], u32 frequency, u8 *param1,
|
||||
u8 *param2)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
while ((Map[i].m_Frequency != 0) &&
|
||||
(Frequency > Map[i].m_Frequency))
|
||||
while ((map[i].m_Frequency != 0) &&
|
||||
(frequency > map[i].m_Frequency))
|
||||
i += 1;
|
||||
if (Map[i].m_Frequency == 0)
|
||||
if (map[i].m_Frequency == 0)
|
||||
return false;
|
||||
*pParam1 = Map[i].m_Param1;
|
||||
*pParam2 = Map[i].m_Param2;
|
||||
*param1 = map[i].m_Param1;
|
||||
*param2 = map[i].m_Param2;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool SearchMap4(struct SRFBandMap Map[],
|
||||
u32 Frequency, u8 *pRFBand)
|
||||
static bool SearchMap4(const struct SRFBandMap map[], u32 frequency, u8 *rfband)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
while (i < 7 && (Frequency > Map[i].m_RF_max))
|
||||
while (i < 7 && (frequency > map[i].m_RF_max))
|
||||
i += 1;
|
||||
if (i == 7)
|
||||
return false;
|
||||
*pRFBand = i;
|
||||
*rfband = i;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ enum HF_S {
|
||||
HF_DVBC_8MHZ, HF_DVBC
|
||||
};
|
||||
|
||||
static struct SStandardParam m_StandardTable[] = {
|
||||
static const struct SStandardParam m_StandardTable[] = {
|
||||
{ 0, 0, 0x00, 0x00 }, /* HF_None */
|
||||
{ 6000000, 7000000, 0x1D, 0x2C }, /* HF_B, */
|
||||
{ 6900000, 8000000, 0x1E, 0x2C }, /* HF_DK, */
|
||||
@ -28,7 +28,7 @@ static struct SStandardParam m_StandardTable[] = {
|
||||
{ 0, 0, 0x00, 0x00 }, /* HF_DVBC (Unused) */
|
||||
};
|
||||
|
||||
static struct SMap m_BP_Filter_Map[] = {
|
||||
static const struct SMap m_BP_Filter_Map[] = {
|
||||
{ 62000000, 0x00 },
|
||||
{ 84000000, 0x01 },
|
||||
{ 100000000, 0x02 },
|
||||
@ -39,7 +39,7 @@ static struct SMap m_BP_Filter_Map[] = {
|
||||
{ 0, 0x00 }, /* Table End */
|
||||
};
|
||||
|
||||
static struct SMapI m_RF_Cal_Map[] = {
|
||||
static const struct SMapI m_RF_Cal_Map[] = {
|
||||
{ 41000000, 0x0F },
|
||||
{ 43000000, 0x1C },
|
||||
{ 45000000, 0x2F },
|
||||
@ -481,7 +481,7 @@ static struct SMapI m_RF_Cal_Map[] = {
|
||||
};
|
||||
|
||||
|
||||
static struct SMap2 m_KM_Map[] = {
|
||||
static const struct SMap2 m_KM_Map[] = {
|
||||
{ 47900000, 3, 2 },
|
||||
{ 61100000, 3, 1 },
|
||||
{ 350000000, 3, 0 },
|
||||
@ -490,7 +490,7 @@ static struct SMap2 m_KM_Map[] = {
|
||||
{ 0, 0x00 }, /* Table End */
|
||||
};
|
||||
|
||||
static struct SMap2 m_Main_PLL_Map[] = {
|
||||
static const struct SMap2 m_Main_PLL_Map[] = {
|
||||
{ 33125000, 0x57, 0xF0 },
|
||||
{ 35500000, 0x56, 0xE0 },
|
||||
{ 38188000, 0x55, 0xD0 },
|
||||
@ -534,7 +534,7 @@ static struct SMap2 m_Main_PLL_Map[] = {
|
||||
{ 0, 0x00, 0x00 }, /* Table End */
|
||||
};
|
||||
|
||||
static struct SMap2 m_Cal_PLL_Map[] = {
|
||||
static const struct SMap2 m_Cal_PLL_Map[] = {
|
||||
{ 33813000, 0xDD, 0xD0 },
|
||||
{ 36625000, 0xDC, 0xC0 },
|
||||
{ 39938000, 0xDB, 0xB0 },
|
||||
@ -572,7 +572,7 @@ static struct SMap2 m_Cal_PLL_Map[] = {
|
||||
{ 0, 0x00, 0x00 }, /* Table End */
|
||||
};
|
||||
|
||||
static struct SMap m_GainTaper_Map[] = {
|
||||
static const struct SMap m_GainTaper_Map[] = {
|
||||
{ 45400000, 0x1F },
|
||||
{ 45800000, 0x1E },
|
||||
{ 46200000, 0x1D },
|
||||
@ -661,7 +661,7 @@ static struct SMap m_GainTaper_Map[] = {
|
||||
{ 0, 0x00 }, /* Table End */
|
||||
};
|
||||
|
||||
static struct SMap m_RF_Cal_DC_Over_DT_Map[] = {
|
||||
static const struct SMap m_RF_Cal_DC_Over_DT_Map[] = {
|
||||
{ 47900000, 0x00 },
|
||||
{ 55000000, 0x00 },
|
||||
{ 61100000, 0x0A },
|
||||
@ -767,14 +767,14 @@ static struct SMap m_RF_Cal_DC_Over_DT_Map[] = {
|
||||
};
|
||||
|
||||
|
||||
static struct SMap m_IR_Meas_Map[] = {
|
||||
static const struct SMap m_IR_Meas_Map[] = {
|
||||
{ 200000000, 0x05 },
|
||||
{ 400000000, 0x06 },
|
||||
{ 865000000, 0x07 },
|
||||
{ 0, 0x00 }, /* Table End */
|
||||
};
|
||||
|
||||
static struct SMap2 m_CID_Target_Map[] = {
|
||||
static const struct SMap2 m_CID_Target_Map[] = {
|
||||
{ 46000000, 0x04, 18 },
|
||||
{ 52200000, 0x0A, 15 },
|
||||
{ 70100000, 0x01, 40 },
|
||||
@ -790,7 +790,7 @@ static struct SMap2 m_CID_Target_Map[] = {
|
||||
{ 0, 0x00, 0 }, /* Table End */
|
||||
};
|
||||
|
||||
static struct SRFBandMap m_RF_Band_Map[7] = {
|
||||
static const struct SRFBandMap m_RF_Band_Map[7] = {
|
||||
{ 47900000, 46000000, 0, 0},
|
||||
{ 61100000, 52200000, 0, 0},
|
||||
{ 152600000, 70100000, 136800000, 0},
|
||||
|
Loading…
Reference in New Issue
Block a user