ALSA: hda - Use a helper function for renaming kctl names
authorTakashi Iwai <tiwai@suse.de>
Tue, 11 Apr 2017 06:10:52 +0000 (08:10 +0200)
committerTakashi Iwai <tiwai@suse.de>
Fri, 21 Apr 2017 08:52:59 +0000 (10:52 +0200)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/patch_realtek.c

index e81cf83d2afd806dfe34d297362ad467450c732c..57eeefd36f19131d3fde8e0c6c6330d6cb7a307c 100644 (file)
@@ -4724,7 +4724,6 @@ static void alc282_fixup_asus_tx300(struct hda_codec *codec,
                { 0x1b, 0x21114000 }, /* dock speaker pin */
                {}
        };
-       struct snd_kcontrol *kctl;
 
        switch (action) {
        case HDA_FIXUP_ACT_PRE_PROBE:
@@ -4739,12 +4738,10 @@ static void alc282_fixup_asus_tx300(struct hda_codec *codec,
                /* this is a bit tricky; give more sane names for the main
                 * (tablet) speaker and the dock speaker, respectively
                 */
-               kctl = snd_hda_find_mixer_ctl(codec, "Speaker Playback Switch");
-               if (kctl)
-                       strcpy(kctl->id.name, "Dock Speaker Playback Switch");
-               kctl = snd_hda_find_mixer_ctl(codec, "Bass Speaker Playback Switch");
-               if (kctl)
-                       strcpy(kctl->id.name, "Speaker Playback Switch");
+               rename_ctl(codec, "Speaker Playback Switch",
+                          "Dock Speaker Playback Switch");
+               rename_ctl(codec, "Bass Speaker Playback Switch",
+                          "Speaker Playback Switch");
                break;
        }
 }