Skip to content

Commit 53803ae

Browse files
broonietiwai
authored andcommitted
ALSA: Use a define for the number of jack switch types
This is intended to facilitate the merge of the two jack detection mechanisms. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 62aa2b5 commit 53803ae

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

‎include/sound/jack.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ enum snd_jack_types {
5353
SND_JACK_BTN_5 = 0x0200,
5454
};
5555

56+
/* Keep in sync with definitions above */
57+
#define SND_JACK_SWITCH_TYPES 6
58+
5659
struct snd_jack {
5760
struct input_dev *input_dev;
5861
int registered;

‎sound/core/jack.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#include <sound/jack.h>
2626
#include <sound/core.h>
2727

28-
static int jack_switch_types[] = {
28+
static int jack_switch_types[SND_JACK_SWITCH_TYPES] = {
2929
SW_HEADPHONE_INSERT,
3030
SW_MICROPHONE_INSERT,
3131
SW_LINEOUT_INSERT,
@@ -128,7 +128,7 @@ int snd_jack_new(struct snd_card *card, const char *id, int type,
128128

129129
jack->type = type;
130130

131-
for (i = 0; i < ARRAY_SIZE(jack_switch_types); i++)
131+
for (i = 0; i < SND_JACK_SWITCH_TYPES; i++)
132132
if (type & (1 << i))
133133
input_set_capability(jack->input_dev, EV_SW,
134134
jack_switch_types[i]);

0 commit comments

Comments
 (0)