Commit 216abe45 authored by Oswald Buddenhagen's avatar Oswald Buddenhagen Committed by Takashi Iwai

ALSA: emu10k1: make struct snd_emu1010 less wasteful

Shrink the {in,out}put_source arrays and their data type to what is
actually necessary.

To be still on the safe side, add some static asserts.
Signed-off-by: default avatarOswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230516093612.3536508-11-oswald.buddenhagen@gmx.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 6f3609f8
...@@ -1637,9 +1637,12 @@ struct snd_emu_chip_details { ...@@ -1637,9 +1637,12 @@ struct snd_emu_chip_details {
const char *id; /* for backward compatibility - can be NULL if not needed */ const char *id; /* for backward compatibility - can be NULL if not needed */
}; };
#define NUM_OUTPUT_DESTS 28
#define NUM_INPUT_DESTS 22
struct snd_emu1010 { struct snd_emu1010 {
unsigned int output_source[64]; unsigned char output_source[NUM_OUTPUT_DESTS];
unsigned int input_source[64]; unsigned char input_source[NUM_INPUT_DESTS];
unsigned int adc_pads; /* bit mask */ unsigned int adc_pads; /* bit mask */
unsigned int dac_pads; /* bit mask */ unsigned int dac_pads; /* bit mask */
unsigned int internal_clock; /* 44100 or 48000 */ unsigned int internal_clock; /* 44100 or 48000 */
......
...@@ -273,6 +273,7 @@ static const char * const emu1010_output_texts[] = { ...@@ -273,6 +273,7 @@ static const char * const emu1010_output_texts[] = {
LR_CTLS("1010 SPDIF"), LR_CTLS("1010 SPDIF"),
ADAT_CTLS("1010 "), ADAT_CTLS("1010 "),
}; };
static_assert(ARRAY_SIZE(emu1010_output_texts) <= NUM_OUTPUT_DESTS);
static const unsigned short emu1010_output_dst[] = { static const unsigned short emu1010_output_dst[] = {
LR_REGS(EMU_DST_DOCK_DAC1), LR_REGS(EMU_DST_DOCK_DAC1),
...@@ -313,6 +314,7 @@ static const char * const snd_emu1010b_output_texts[] = { ...@@ -313,6 +314,7 @@ static const char * const snd_emu1010b_output_texts[] = {
LR_CTLS("1010 SPDIF"), LR_CTLS("1010 SPDIF"),
ADAT_CTLS("1010 "), ADAT_CTLS("1010 "),
}; };
static_assert(ARRAY_SIZE(snd_emu1010b_output_texts) <= NUM_OUTPUT_DESTS);
static const unsigned short emu1010b_output_dst[] = { static const unsigned short emu1010b_output_dst[] = {
LR_REGS(EMU_DST_DOCK_DAC1), LR_REGS(EMU_DST_DOCK_DAC1),
...@@ -349,6 +351,7 @@ static const char * const snd_emu1616_output_texts[] = { ...@@ -349,6 +351,7 @@ static const char * const snd_emu1616_output_texts[] = {
ADAT_CTLS("Dock "), ADAT_CTLS("Dock "),
LR_CTLS("Mana DAC"), LR_CTLS("Mana DAC"),
}; };
static_assert(ARRAY_SIZE(snd_emu1616_output_texts) <= NUM_OUTPUT_DESTS);
static const unsigned short emu1616_output_dst[] = { static const unsigned short emu1616_output_dst[] = {
LR_REGS(EMU_DST_DOCK_DAC1), LR_REGS(EMU_DST_DOCK_DAC1),
...@@ -377,6 +380,7 @@ static const char * const snd_emu0404_output_texts[] = { ...@@ -377,6 +380,7 @@ static const char * const snd_emu0404_output_texts[] = {
LR_CTLS("DAC"), LR_CTLS("DAC"),
LR_CTLS("SPDIF"), LR_CTLS("SPDIF"),
}; };
static_assert(ARRAY_SIZE(snd_emu0404_output_texts) <= NUM_OUTPUT_DESTS);
static const unsigned short emu0404_output_dst[] = { static const unsigned short emu0404_output_dst[] = {
LR_REGS(EMU_DST_HAMOA_DAC), LR_REGS(EMU_DST_HAMOA_DAC),
...@@ -421,6 +425,7 @@ static const char * const emu1010_input_texts[] = { ...@@ -421,6 +425,7 @@ static const char * const emu1010_input_texts[] = {
"DSP 14 Capture Enum", "DSP 14 Capture Enum",
"DSP 15 Capture Enum", "DSP 15 Capture Enum",
}; };
static_assert(ARRAY_SIZE(emu1010_input_texts) <= NUM_INPUT_DESTS);
static const unsigned short emu1010_input_dst[] = { static const unsigned short emu1010_input_dst[] = {
EMU_DST_ALICE2_EMU32_0, EMU_DST_ALICE2_EMU32_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