Commit 2d4ffef1 authored by Rikard Falkeborn's avatar Rikard Falkeborn Committed by Mauro Carvalho Chehab

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: default avatarRikard Falkeborn <rikard.falkeborn@gmail.com>
Signed-off-by: default avatarSean Young <sean@mess.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent cf580e11
...@@ -198,58 +198,55 @@ static void reset(struct tda_state *state) ...@@ -198,58 +198,55 @@ static void reset(struct tda_state *state)
state->m_bFMInput = (ulFMInput == 2); state->m_bFMInput = (ulFMInput == 2);
} }
static bool SearchMap1(struct SMap Map[], static bool SearchMap1(const struct SMap map[], u32 frequency, u8 *param)
u32 Frequency, u8 *pParam)
{ {
int i = 0; 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; i += 1;
if (Map[i].m_Frequency == 0) if (map[i].m_Frequency == 0)
return false; return false;
*pParam = Map[i].m_Param; *param = map[i].m_Param;
return true; return true;
} }
static bool SearchMap2(struct SMapI Map[], static bool SearchMap2(const struct SMapI map[], u32 frequency, s32 *param)
u32 Frequency, s32 *pParam)
{ {
int i = 0; int i = 0;
while ((Map[i].m_Frequency != 0) && while ((map[i].m_Frequency != 0) &&
(Frequency > Map[i].m_Frequency)) (frequency > map[i].m_Frequency))
i += 1; i += 1;
if (Map[i].m_Frequency == 0) if (map[i].m_Frequency == 0)
return false; return false;
*pParam = Map[i].m_Param; *param = map[i].m_Param;
return true; return true;
} }
static bool SearchMap3(struct SMap2 Map[], u32 Frequency, static bool SearchMap3(const struct SMap2 map[], u32 frequency, u8 *param1,
u8 *pParam1, u8 *pParam2) u8 *param2)
{ {
int i = 0; int i = 0;
while ((Map[i].m_Frequency != 0) && while ((map[i].m_Frequency != 0) &&
(Frequency > Map[i].m_Frequency)) (frequency > map[i].m_Frequency))
i += 1; i += 1;
if (Map[i].m_Frequency == 0) if (map[i].m_Frequency == 0)
return false; return false;
*pParam1 = Map[i].m_Param1; *param1 = map[i].m_Param1;
*pParam2 = Map[i].m_Param2; *param2 = map[i].m_Param2;
return true; return true;
} }
static bool SearchMap4(struct SRFBandMap Map[], static bool SearchMap4(const struct SRFBandMap map[], u32 frequency, u8 *rfband)
u32 Frequency, u8 *pRFBand)
{ {
int i = 0; int i = 0;
while (i < 7 && (Frequency > Map[i].m_RF_max)) while (i < 7 && (frequency > map[i].m_RF_max))
i += 1; i += 1;
if (i == 7) if (i == 7)
return false; return false;
*pRFBand = i; *rfband = i;
return true; return true;
} }
......
...@@ -6,7 +6,7 @@ enum HF_S { ...@@ -6,7 +6,7 @@ enum HF_S {
HF_DVBC_8MHZ, HF_DVBC HF_DVBC_8MHZ, HF_DVBC
}; };
static struct SStandardParam m_StandardTable[] = { static const struct SStandardParam m_StandardTable[] = {
{ 0, 0, 0x00, 0x00 }, /* HF_None */ { 0, 0, 0x00, 0x00 }, /* HF_None */
{ 6000000, 7000000, 0x1D, 0x2C }, /* HF_B, */ { 6000000, 7000000, 0x1D, 0x2C }, /* HF_B, */
{ 6900000, 8000000, 0x1E, 0x2C }, /* HF_DK, */ { 6900000, 8000000, 0x1E, 0x2C }, /* HF_DK, */
...@@ -28,7 +28,7 @@ static struct SStandardParam m_StandardTable[] = { ...@@ -28,7 +28,7 @@ static struct SStandardParam m_StandardTable[] = {
{ 0, 0, 0x00, 0x00 }, /* HF_DVBC (Unused) */ { 0, 0, 0x00, 0x00 }, /* HF_DVBC (Unused) */
}; };
static struct SMap m_BP_Filter_Map[] = { static const struct SMap m_BP_Filter_Map[] = {
{ 62000000, 0x00 }, { 62000000, 0x00 },
{ 84000000, 0x01 }, { 84000000, 0x01 },
{ 100000000, 0x02 }, { 100000000, 0x02 },
...@@ -39,7 +39,7 @@ static struct SMap m_BP_Filter_Map[] = { ...@@ -39,7 +39,7 @@ static struct SMap m_BP_Filter_Map[] = {
{ 0, 0x00 }, /* Table End */ { 0, 0x00 }, /* Table End */
}; };
static struct SMapI m_RF_Cal_Map[] = { static const struct SMapI m_RF_Cal_Map[] = {
{ 41000000, 0x0F }, { 41000000, 0x0F },
{ 43000000, 0x1C }, { 43000000, 0x1C },
{ 45000000, 0x2F }, { 45000000, 0x2F },
...@@ -481,7 +481,7 @@ static struct SMapI m_RF_Cal_Map[] = { ...@@ -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 }, { 47900000, 3, 2 },
{ 61100000, 3, 1 }, { 61100000, 3, 1 },
{ 350000000, 3, 0 }, { 350000000, 3, 0 },
...@@ -490,7 +490,7 @@ static struct SMap2 m_KM_Map[] = { ...@@ -490,7 +490,7 @@ static struct SMap2 m_KM_Map[] = {
{ 0, 0x00 }, /* Table End */ { 0, 0x00 }, /* Table End */
}; };
static struct SMap2 m_Main_PLL_Map[] = { static const struct SMap2 m_Main_PLL_Map[] = {
{ 33125000, 0x57, 0xF0 }, { 33125000, 0x57, 0xF0 },
{ 35500000, 0x56, 0xE0 }, { 35500000, 0x56, 0xE0 },
{ 38188000, 0x55, 0xD0 }, { 38188000, 0x55, 0xD0 },
...@@ -534,7 +534,7 @@ static struct SMap2 m_Main_PLL_Map[] = { ...@@ -534,7 +534,7 @@ static struct SMap2 m_Main_PLL_Map[] = {
{ 0, 0x00, 0x00 }, /* Table End */ { 0, 0x00, 0x00 }, /* Table End */
}; };
static struct SMap2 m_Cal_PLL_Map[] = { static const struct SMap2 m_Cal_PLL_Map[] = {
{ 33813000, 0xDD, 0xD0 }, { 33813000, 0xDD, 0xD0 },
{ 36625000, 0xDC, 0xC0 }, { 36625000, 0xDC, 0xC0 },
{ 39938000, 0xDB, 0xB0 }, { 39938000, 0xDB, 0xB0 },
...@@ -572,7 +572,7 @@ static struct SMap2 m_Cal_PLL_Map[] = { ...@@ -572,7 +572,7 @@ static struct SMap2 m_Cal_PLL_Map[] = {
{ 0, 0x00, 0x00 }, /* Table End */ { 0, 0x00, 0x00 }, /* Table End */
}; };
static struct SMap m_GainTaper_Map[] = { static const struct SMap m_GainTaper_Map[] = {
{ 45400000, 0x1F }, { 45400000, 0x1F },
{ 45800000, 0x1E }, { 45800000, 0x1E },
{ 46200000, 0x1D }, { 46200000, 0x1D },
...@@ -661,7 +661,7 @@ static struct SMap m_GainTaper_Map[] = { ...@@ -661,7 +661,7 @@ static struct SMap m_GainTaper_Map[] = {
{ 0, 0x00 }, /* Table End */ { 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 }, { 47900000, 0x00 },
{ 55000000, 0x00 }, { 55000000, 0x00 },
{ 61100000, 0x0A }, { 61100000, 0x0A },
...@@ -767,14 +767,14 @@ static struct SMap m_RF_Cal_DC_Over_DT_Map[] = { ...@@ -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 }, { 200000000, 0x05 },
{ 400000000, 0x06 }, { 400000000, 0x06 },
{ 865000000, 0x07 }, { 865000000, 0x07 },
{ 0, 0x00 }, /* Table End */ { 0, 0x00 }, /* Table End */
}; };
static struct SMap2 m_CID_Target_Map[] = { static const struct SMap2 m_CID_Target_Map[] = {
{ 46000000, 0x04, 18 }, { 46000000, 0x04, 18 },
{ 52200000, 0x0A, 15 }, { 52200000, 0x0A, 15 },
{ 70100000, 0x01, 40 }, { 70100000, 0x01, 40 },
...@@ -790,7 +790,7 @@ static struct SMap2 m_CID_Target_Map[] = { ...@@ -790,7 +790,7 @@ static struct SMap2 m_CID_Target_Map[] = {
{ 0, 0x00, 0 }, /* Table End */ { 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}, { 47900000, 46000000, 0, 0},
{ 61100000, 52200000, 0, 0}, { 61100000, 52200000, 0, 0},
{ 152600000, 70100000, 136800000, 0}, { 152600000, 70100000, 136800000, 0},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment