Skip to content

Commit

Permalink
ALSA: Use a define for the number of jack switch types
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Mark Brown authored and Takashi Iwai committed Feb 27, 2012
1 parent 62aa2b5 commit 53803ae
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions include/sound/jack.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions sound/core/jack.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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]);
Expand Down

0 comments on commit 53803ae

Please sign in to comment.