Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Mark Brown and committed by
Takashi Iwai
53803aea 62aa2b53

+5 -2
+3
include/sound/jack.h
··· 53 53 SND_JACK_BTN_5 = 0x0200, 54 54 }; 55 55 56 + /* Keep in sync with definitions above */ 57 + #define SND_JACK_SWITCH_TYPES 6 58 + 56 59 struct snd_jack { 57 60 struct input_dev *input_dev; 58 61 int registered;
+2 -2
sound/core/jack.c
··· 25 25 #include <sound/jack.h> 26 26 #include <sound/core.h> 27 27 28 - static int jack_switch_types[] = { 28 + static int jack_switch_types[SND_JACK_SWITCH_TYPES] = { 29 29 SW_HEADPHONE_INSERT, 30 30 SW_MICROPHONE_INSERT, 31 31 SW_LINEOUT_INSERT, ··· 128 128 129 129 jack->type = type; 130 130 131 - for (i = 0; i < ARRAY_SIZE(jack_switch_types); i++) 131 + for (i = 0; i < SND_JACK_SWITCH_TYPES; i++) 132 132 if (type & (1 << i)) 133 133 input_set_capability(jack->input_dev, EV_SW, 134 134 jack_switch_types[i]);