]> rtime.felk.cvut.cz Git - linux-imx.git/commitdiff
ALSA: Use a define for the number of jack switch types
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Tue, 7 Feb 2012 19:48:47 +0000 (19:48 +0000)
committerTakashi Iwai <tiwai@suse.de>
Mon, 27 Feb 2012 16:34:44 +0000 (17:34 +0100)
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>
include/sound/jack.h
sound/core/jack.c

index 63c790742db47be586cd995cda581bfae9c33b80..58916573db582eab1d19a6d751ebe516c194b834 100644 (file)
@@ -53,6 +53,9 @@ enum snd_jack_types {
        SND_JACK_BTN_5          = 0x0200,
 };
 
+/* Keep in sync with definitions above */
+#define SND_JACK_SWITCH_TYPES 6
+
 struct snd_jack {
        struct input_dev *input_dev;
        int registered;
index 26edf63b265f439ba7bf5636ffa0c0928cac8db7..471e1e3b0a996da3fec0d21c82a55b87f3460469 100644 (file)
@@ -25,7 +25,7 @@
 #include <sound/jack.h>
 #include <sound/core.h>
 
-static int jack_switch_types[] = {
+static int jack_switch_types[SND_JACK_SWITCH_TYPES] = {
        SW_HEADPHONE_INSERT,
        SW_MICROPHONE_INSERT,
        SW_LINEOUT_INSERT,
@@ -128,7 +128,7 @@ int snd_jack_new(struct snd_card *card, const char *id, int type,
 
        jack->type = type;
 
-       for (i = 0; i < ARRAY_SIZE(jack_switch_types); i++)
+       for (i = 0; i < SND_JACK_SWITCH_TYPES; i++)
                if (type & (1 << i))
                        input_set_capability(jack->input_dev, EV_SW,
                                             jack_switch_types[i]);