提交 bc549767 编写于 作者: T Takashi Iwai

ALSA: hda/realtek - Allow passing name=NULL to alc_kcontrol_new()

This prevents stupid typos.
Signed-off-by: NTakashi Iwai <tiwai@suse.de>
上级 2eab694a
...@@ -862,7 +862,10 @@ alc_kcontrol_new(struct alc_spec *spec, const char *name, ...@@ -862,7 +862,10 @@ alc_kcontrol_new(struct alc_spec *spec, const char *name,
if (!knew) if (!knew)
return NULL; return NULL;
*knew = *temp; *knew = *temp;
knew->name = kstrdup(name, GFP_KERNEL); if (name)
knew->name = kstrdup(name, GFP_KERNEL);
else if (knew->name)
knew->name = kstrdup(knew->name, GFP_KERNEL);
if (!knew->name) if (!knew->name)
return NULL; return NULL;
return knew; return knew;
...@@ -872,7 +875,7 @@ static int alc_add_automute_mode_enum(struct hda_codec *codec) ...@@ -872,7 +875,7 @@ static int alc_add_automute_mode_enum(struct hda_codec *codec)
{ {
struct alc_spec *spec = codec->spec; struct alc_spec *spec = codec->spec;
if (!alc_kcontrol_new(spec, "Auto-Mute Mode", &alc_automute_mode_enum)) if (!alc_kcontrol_new(spec, NULL, &alc_automute_mode_enum))
return -ENOMEM; return -ENOMEM;
return 0; return 0;
} }
...@@ -1556,6 +1559,7 @@ static int alc_inv_dmic_sw_put(struct snd_kcontrol *kcontrol, ...@@ -1556,6 +1559,7 @@ static int alc_inv_dmic_sw_put(struct snd_kcontrol *kcontrol,
static const struct snd_kcontrol_new alc_inv_dmic_sw = { static const struct snd_kcontrol_new alc_inv_dmic_sw = {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Inverted Internal Mic Capture Switch",
.info = snd_ctl_boolean_mono_info, .info = snd_ctl_boolean_mono_info,
.get = alc_inv_dmic_sw_get, .get = alc_inv_dmic_sw_get,
.put = alc_inv_dmic_sw_put, .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,8 +1569,7 @@ static int alc_add_inv_dmic_mixer(struct hda_codec *codec, hda_nid_t nid)
{ {
struct alc_spec *spec = codec->spec; struct alc_spec *spec = codec->spec;
if (!alc_kcontrol_new(spec, "Inverted Internal Mic Capture Switch", if (!alc_kcontrol_new(spec, NULL, &alc_inv_dmic_sw))
&alc_inv_dmic_sw))
return -ENOMEM; return -ENOMEM;
spec->inv_dmic_fixup = 1; spec->inv_dmic_fixup = 1;
spec->inv_dmic_muted = 0; spec->inv_dmic_muted = 0;
...@@ -2555,7 +2558,7 @@ static int create_capture_mixers(struct hda_codec *codec) ...@@ -2555,7 +2558,7 @@ static int create_capture_mixers(struct hda_codec *codec)
nums = spec->num_adc_nids; nums = spec->num_adc_nids;
if (!spec->auto_mic && imux->num_items > 1) { if (!spec->auto_mic && imux->num_items > 1) {
knew = alc_kcontrol_new(spec, "Input Source", &cap_src_temp); knew = alc_kcontrol_new(spec, NULL, &cap_src_temp);
if (!knew) if (!knew)
return -ENOMEM; return -ENOMEM;
knew->count = nums; knew->count = nums;
...@@ -2579,8 +2582,7 @@ static int create_capture_mixers(struct hda_codec *codec) ...@@ -2579,8 +2582,7 @@ static int create_capture_mixers(struct hda_codec *codec)
} }
if (vol) { if (vol) {
knew = alc_kcontrol_new(spec, "Capture Volume", knew = alc_kcontrol_new(spec, NULL, &cap_vol_temp);
&cap_vol_temp);
if (!knew) if (!knew)
return -ENOMEM; return -ENOMEM;
knew->index = n; knew->index = n;
...@@ -2588,8 +2590,7 @@ static int create_capture_mixers(struct hda_codec *codec) ...@@ -2588,8 +2590,7 @@ static int create_capture_mixers(struct hda_codec *codec)
knew->subdevice = HDA_SUBDEV_AMP_FLAG; knew->subdevice = HDA_SUBDEV_AMP_FLAG;
} }
if (sw) { if (sw) {
knew = alc_kcontrol_new(spec, "Capture Switch", knew = alc_kcontrol_new(spec, NULL, &cap_sw_temp);
&cap_sw_temp);
if (!knew) if (!knew)
return -ENOMEM; return -ENOMEM;
knew->index = n; knew->index = n;
...@@ -4106,8 +4107,7 @@ static int alc_auto_add_multi_channel_mode(struct hda_codec *codec) ...@@ -4106,8 +4107,7 @@ static int alc_auto_add_multi_channel_mode(struct hda_codec *codec)
struct alc_spec *spec = codec->spec; struct alc_spec *spec = codec->spec;
if (spec->multi_ios > 0) { if (spec->multi_ios > 0) {
if (!alc_kcontrol_new(spec, "Channel Mode", if (!alc_kcontrol_new(spec, NULL, &alc_auto_channel_mode_enum))
&alc_auto_channel_mode_enum))
return -ENOMEM; return -ENOMEM;
} }
return 0; return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册