diff options
| author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-02-07 14:48:47 -0500 |
|---|---|---|
| committer | Takashi Iwai <tiwai@suse.de> | 2012-02-27 11:34:44 -0500 |
| commit | 53803aead010a314f76a8a6fa132fdcc5edf55ed (patch) | |
| tree | 50f1cb6702a27d150e034828ccd1e696b2da79ab | |
| parent | 62aa2b537c6f5957afd98e29f96897419ed5ebab (diff) | |
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>
| -rw-r--r-- | include/sound/jack.h | 3 | ||||
| -rw-r--r-- | sound/core/jack.c | 4 |
2 files changed, 5 insertions, 2 deletions
diff --git a/include/sound/jack.h b/include/sound/jack.h index 63c790742db4..58916573db58 100644 --- a/include/sound/jack.h +++ b/include/sound/jack.h | |||
| @@ -53,6 +53,9 @@ enum snd_jack_types { | |||
| 53 | SND_JACK_BTN_5 = 0x0200, | 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 | struct snd_jack { | 59 | struct snd_jack { |
| 57 | struct input_dev *input_dev; | 60 | struct input_dev *input_dev; |
| 58 | int registered; | 61 | int registered; |
diff --git a/sound/core/jack.c b/sound/core/jack.c index 26edf63b265f..471e1e3b0a99 100644 --- a/sound/core/jack.c +++ b/sound/core/jack.c | |||
| @@ -25,7 +25,7 @@ | |||
| 25 | #include <sound/jack.h> | 25 | #include <sound/jack.h> |
| 26 | #include <sound/core.h> | 26 | #include <sound/core.h> |
| 27 | 27 | ||
| 28 | static int jack_switch_types[] = { | 28 | static int jack_switch_types[SND_JACK_SWITCH_TYPES] = { |
| 29 | SW_HEADPHONE_INSERT, | 29 | SW_HEADPHONE_INSERT, |
| 30 | SW_MICROPHONE_INSERT, | 30 | SW_MICROPHONE_INSERT, |
| 31 | SW_LINEOUT_INSERT, | 31 | SW_LINEOUT_INSERT, |
| @@ -128,7 +128,7 @@ int snd_jack_new(struct snd_card *card, const char *id, int type, | |||
| 128 | 128 | ||
| 129 | jack->type = type; | 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 | if (type & (1 << i)) | 132 | if (type & (1 << i)) |
| 133 | input_set_capability(jack->input_dev, EV_SW, | 133 | input_set_capability(jack->input_dev, EV_SW, |
| 134 | jack_switch_types[i]); | 134 | jack_switch_types[i]); |
