Skip to content

Commit b5d5051

Browse files
ColinIanKingbroonie
authored andcommitted
ASoC: rt715: Make read-only arrays capture_reg_H and capture_reg_L static const
Don't populate the read-only arrays capture_reg_H and capture_reg_L on the stack but instead make them static const. Also makes the object code a little smaller. Signed-off-by: Colin Ian King <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent cb870fd commit b5d5051

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

sound/soc/codecs/rt715.c

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -204,12 +204,12 @@ static int rt715_set_main_switch_put(struct snd_kcontrol *kcontrol,
204204
struct snd_soc_dapm_context *dapm =
205205
snd_soc_component_get_dapm(component);
206206
struct rt715_priv *rt715 = snd_soc_component_get_drvdata(component);
207-
unsigned int capture_reg_H[] = {RT715_SET_GAIN_MIC_ADC_H,
208-
RT715_SET_GAIN_LINE_ADC_H, RT715_SET_GAIN_MIX_ADC_H,
209-
RT715_SET_GAIN_MIX_ADC2_H};
210-
unsigned int capture_reg_L[] = {RT715_SET_GAIN_MIC_ADC_L,
211-
RT715_SET_GAIN_LINE_ADC_L, RT715_SET_GAIN_MIX_ADC_L,
212-
RT715_SET_GAIN_MIX_ADC2_L};
207+
static const unsigned int capture_reg_H[] = {
208+
RT715_SET_GAIN_MIC_ADC_H, RT715_SET_GAIN_LINE_ADC_H,
209+
RT715_SET_GAIN_MIX_ADC_H, RT715_SET_GAIN_MIX_ADC2_H };
210+
static const unsigned int capture_reg_L[] = {
211+
RT715_SET_GAIN_MIC_ADC_L, RT715_SET_GAIN_LINE_ADC_L,
212+
RT715_SET_GAIN_MIX_ADC_L, RT715_SET_GAIN_MIX_ADC2_L };
213213
unsigned int addr_h, addr_l, val_h = 0x0, val_ll, val_lr;
214214
unsigned int k_shift = RT715_DIR_IN_SFT, k_changed = 0;
215215
unsigned int read_ll, read_rl, i, j, loop_cnt = 4;
@@ -284,12 +284,12 @@ static int rt715_set_main_switch_get(struct snd_kcontrol *kcontrol,
284284
{
285285
struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
286286
struct rt715_priv *rt715 = snd_soc_component_get_drvdata(component);
287-
unsigned int capture_reg_H[] = {RT715_SET_GAIN_MIC_ADC_H,
288-
RT715_SET_GAIN_LINE_ADC_H, RT715_SET_GAIN_MIX_ADC_H,
289-
RT715_SET_GAIN_MIX_ADC2_H};
290-
unsigned int capture_reg_L[] = {RT715_SET_GAIN_MIC_ADC_L,
291-
RT715_SET_GAIN_LINE_ADC_L, RT715_SET_GAIN_MIX_ADC_L,
292-
RT715_SET_GAIN_MIX_ADC2_L};
287+
static const unsigned int capture_reg_H[] = {
288+
RT715_SET_GAIN_MIC_ADC_H, RT715_SET_GAIN_LINE_ADC_H,
289+
RT715_SET_GAIN_MIX_ADC_H, RT715_SET_GAIN_MIX_ADC2_H };
290+
static const unsigned int capture_reg_L[] = {
291+
RT715_SET_GAIN_MIC_ADC_L, RT715_SET_GAIN_LINE_ADC_L,
292+
RT715_SET_GAIN_MIX_ADC_L, RT715_SET_GAIN_MIX_ADC2_L };
293293
unsigned int addr_h, addr_l, val_h = 0x0, i, loop_cnt = 4;
294294
unsigned int read_ll, read_rl;
295295

@@ -312,12 +312,12 @@ static int rt715_set_main_vol_put(struct snd_kcontrol *kcontrol,
312312
struct snd_soc_dapm_context *dapm =
313313
snd_soc_component_get_dapm(component);
314314
struct rt715_priv *rt715 = snd_soc_component_get_drvdata(component);
315-
unsigned int capture_reg_H[] = {RT715_SET_GAIN_MIC_ADC_H,
316-
RT715_SET_GAIN_LINE_ADC_H, RT715_SET_GAIN_MIX_ADC_H,
317-
RT715_SET_GAIN_MIX_ADC2_H};
318-
unsigned int capture_reg_L[] = {RT715_SET_GAIN_MIC_ADC_L,
319-
RT715_SET_GAIN_LINE_ADC_L, RT715_SET_GAIN_MIX_ADC_L,
320-
RT715_SET_GAIN_MIX_ADC2_L};
315+
static const unsigned int capture_reg_H[] = {
316+
RT715_SET_GAIN_MIC_ADC_H, RT715_SET_GAIN_LINE_ADC_H,
317+
RT715_SET_GAIN_MIX_ADC_H, RT715_SET_GAIN_MIX_ADC2_H };
318+
static const unsigned int capture_reg_L[] = {
319+
RT715_SET_GAIN_MIC_ADC_L, RT715_SET_GAIN_LINE_ADC_L,
320+
RT715_SET_GAIN_MIX_ADC_L, RT715_SET_GAIN_MIX_ADC2_L};
321321
unsigned int addr_h, addr_l, val_h = 0x0, val_ll, val_lr;
322322
unsigned int read_ll, read_rl, i, j, loop_cnt = 4, k_changed = 0;
323323
unsigned int k_shift = RT715_DIR_IN_SFT, k_max = 0x3f;
@@ -393,12 +393,12 @@ static int rt715_set_main_vol_get(struct snd_kcontrol *kcontrol,
393393
{
394394
struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
395395
struct rt715_priv *rt715 = snd_soc_component_get_drvdata(component);
396-
unsigned int capture_reg_H[] = {RT715_SET_GAIN_MIC_ADC_H,
397-
RT715_SET_GAIN_LINE_ADC_H, RT715_SET_GAIN_MIX_ADC_H,
398-
RT715_SET_GAIN_MIX_ADC2_H};
399-
unsigned int capture_reg_L[] = {RT715_SET_GAIN_MIC_ADC_L,
400-
RT715_SET_GAIN_LINE_ADC_L, RT715_SET_GAIN_MIX_ADC_L,
401-
RT715_SET_GAIN_MIX_ADC2_L};
396+
static const unsigned int capture_reg_H[] = {
397+
RT715_SET_GAIN_MIC_ADC_H, RT715_SET_GAIN_LINE_ADC_H,
398+
RT715_SET_GAIN_MIX_ADC_H, RT715_SET_GAIN_MIX_ADC2_H };
399+
static const unsigned int capture_reg_L[] = {
400+
RT715_SET_GAIN_MIC_ADC_L, RT715_SET_GAIN_LINE_ADC_L,
401+
RT715_SET_GAIN_MIX_ADC_L, RT715_SET_GAIN_MIX_ADC2_L };
402402
unsigned int addr_h, addr_l, val_h = 0x0, i, loop_cnt = 4;
403403
unsigned int read_ll, read_rl;
404404

0 commit comments

Comments
 (0)