aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_realtek.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2012-12-18 09:35:11 -0500
committerTakashi Iwai <tiwai@suse.de>2013-01-12 02:30:40 -0500
commitbc54976721d30f5ec51e90dcd1aca56494e0b0cf (patch)
tree2e5e4f9d349fc69299216ac2be19d140e5a74b7a /sound/pci/hda/patch_realtek.c
parent2eab694a6c85499710d050f880c6f8ae705e7a19 (diff)
ALSA: hda/realtek - Allow passing name=NULL to alc_kcontrol_new()
This prevents stupid typos. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/patch_realtek.c')
-rw-r--r--sound/pci/hda/patch_realtek.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 25c0fc911666..13d4548a5381 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -862,7 +862,10 @@ alc_kcontrol_new(struct alc_spec *spec, const char *name,
862 if (!knew) 862 if (!knew)
863 return NULL; 863 return NULL;
864 *knew = *temp; 864 *knew = *temp;
865 knew->name = kstrdup(name, GFP_KERNEL); 865 if (name)
866 knew->name = kstrdup(name, GFP_KERNEL);
867 else if (knew->name)
868 knew->name = kstrdup(knew->name, GFP_KERNEL);
866 if (!knew->name) 869 if (!knew->name)
867 return NULL; 870 return NULL;
868 return knew; 871 return knew;
@@ -872,7 +875,7 @@ static int alc_add_automute_mode_enum(struct hda_codec *codec)
872{ 875{
873 struct alc_spec *spec = codec->spec; 876 struct alc_spec *spec = codec->spec;
874 877
875 if (!alc_kcontrol_new(spec, "Auto-Mute Mode", &alc_automute_mode_enum)) 878 if (!alc_kcontrol_new(spec, NULL, &alc_automute_mode_enum))
876 return -ENOMEM; 879 return -ENOMEM;
877 return 0; 880 return 0;
878} 881}
@@ -1556,6 +1559,7 @@ static int alc_inv_dmic_sw_put(struct snd_kcontrol *kcontrol,
1556 1559
1557static const struct snd_kcontrol_new alc_inv_dmic_sw = { 1560static const struct snd_kcontrol_new alc_inv_dmic_sw = {
1558 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1561 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1562 .name = "Inverted Internal Mic Capture Switch",
1559 .info = snd_ctl_boolean_mono_info, 1563 .info = snd_ctl_boolean_mono_info,
1560 .get = alc_inv_dmic_sw_get, 1564 .get = alc_inv_dmic_sw_get,
1561 .put = alc_inv_dmic_sw_put, 1565 .put = alc_inv_dmic_sw_put,
@@ -1565,8 +1569,7 @@ static int alc_add_inv_dmic_mixer(struct hda_codec *codec, hda_nid_t nid)
1565{ 1569{
1566 struct alc_spec *spec = codec->spec; 1570 struct alc_spec *spec = codec->spec;
1567 1571
1568 if (!alc_kcontrol_new(spec, "Inverted Internal Mic Capture Switch", 1572 if (!alc_kcontrol_new(spec, NULL, &alc_inv_dmic_sw))
1569 &alc_inv_dmic_sw))
1570 return -ENOMEM; 1573 return -ENOMEM;
1571 spec->inv_dmic_fixup = 1; 1574 spec->inv_dmic_fixup = 1;
1572 spec->inv_dmic_muted = 0; 1575 spec->inv_dmic_muted = 0;
@@ -2555,7 +2558,7 @@ static int create_capture_mixers(struct hda_codec *codec)
2555 nums = spec->num_adc_nids; 2558 nums = spec->num_adc_nids;
2556 2559
2557 if (!spec->auto_mic && imux->num_items > 1) { 2560 if (!spec->auto_mic && imux->num_items > 1) {
2558 knew = alc_kcontrol_new(spec, "Input Source", &cap_src_temp); 2561 knew = alc_kcontrol_new(spec, NULL, &cap_src_temp);
2559 if (!knew) 2562 if (!knew)
2560 return -ENOMEM; 2563 return -ENOMEM;
2561 knew->count = nums; 2564 knew->count = nums;
@@ -2579,8 +2582,7 @@ static int create_capture_mixers(struct hda_codec *codec)
2579 } 2582 }
2580 2583
2581 if (vol) { 2584 if (vol) {
2582 knew = alc_kcontrol_new(spec, "Capture Volume", 2585 knew = alc_kcontrol_new(spec, NULL, &cap_vol_temp);
2583 &cap_vol_temp);
2584 if (!knew) 2586 if (!knew)
2585 return -ENOMEM; 2587 return -ENOMEM;
2586 knew->index = n; 2588 knew->index = n;
@@ -2588,8 +2590,7 @@ static int create_capture_mixers(struct hda_codec *codec)
2588 knew->subdevice = HDA_SUBDEV_AMP_FLAG; 2590 knew->subdevice = HDA_SUBDEV_AMP_FLAG;
2589 } 2591 }
2590 if (sw) { 2592 if (sw) {
2591 knew = alc_kcontrol_new(spec, "Capture Switch", 2593 knew = alc_kcontrol_new(spec, NULL, &cap_sw_temp);
2592 &cap_sw_temp);
2593 if (!knew) 2594 if (!knew)
2594 return -ENOMEM; 2595 return -ENOMEM;
2595 knew->index = n; 2596 knew->index = n;
@@ -4106,8 +4107,7 @@ static int alc_auto_add_multi_channel_mode(struct hda_codec *codec)
4106 struct alc_spec *spec = codec->spec; 4107 struct alc_spec *spec = codec->spec;
4107 4108
4108 if (spec->multi_ios > 0) { 4109 if (spec->multi_ios > 0) {
4109 if (!alc_kcontrol_new(spec, "Channel Mode", 4110 if (!alc_kcontrol_new(spec, NULL, &alc_auto_channel_mode_enum))
4110 &alc_auto_channel_mode_enum))
4111 return -ENOMEM; 4111 return -ENOMEM;
4112 } 4112 }
4113 return 0; 4113 return 0;