Skip to content

Commit 592d1c2

Browse files
wangdichengtiwai
authored andcommitted
ALSA: hda/senary: Replace magic numbers with defined constants
Replace hardcoded GPIO node value with a defined constant for better code readability and maintainability. Signed-off-by: wangdicheng <wangdicheng@kylinos.cn> Link: https://patch.msgid.link/20251107024030.36712-1-wangdich9700@163.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 79d062b commit 592d1c2

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

sound/hda/codecs/senarytech.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
#include "hda_jack.h"
2020
#include "generic.h"
2121

22+
/* GPIO node ID */
23+
#define SENARY_GPIO_NODE 0x01
24+
2225
struct senary_spec {
2326
struct hda_gen_spec gen;
2427

@@ -120,11 +123,11 @@ static void senary_init_gpio_led(struct hda_codec *codec)
120123
unsigned int mask = spec->gpio_mute_led_mask | spec->gpio_mic_led_mask;
121124

122125
if (mask) {
123-
snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_MASK,
126+
snd_hda_codec_write(codec, SENARY_GPIO_NODE, 0, AC_VERB_SET_GPIO_MASK,
124127
mask);
125-
snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DIRECTION,
128+
snd_hda_codec_write(codec, SENARY_GPIO_NODE, 0, AC_VERB_SET_GPIO_DIRECTION,
126129
mask);
127-
snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
130+
snd_hda_codec_write(codec, SENARY_GPIO_NODE, 0, AC_VERB_SET_GPIO_DATA,
128131
spec->gpio_led);
129132
}
130133
}

0 commit comments

Comments
 (0)