Commit fce52a3b authored by Takashi Iwai's avatar Takashi Iwai

ALSA: hda - Add snd_hda_gen_free() and snd_hda_gen_check_power_status()

Just to remove duplicated codes.
Also fixed EXPORT_SYMBOL() in hda_generic.c.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 76a19c69
...@@ -3939,36 +3939,39 @@ int snd_hda_gen_init(struct hda_codec *codec) ...@@ -3939,36 +3939,39 @@ int snd_hda_gen_init(struct hda_codec *codec)
hda_call_check_power_status(codec, 0x01); hda_call_check_power_status(codec, 0x01);
return 0; return 0;
} }
EXPORT_SYMBOL(snd_hda_gen_init); EXPORT_SYMBOL_HDA(snd_hda_gen_init);
/* void snd_hda_gen_free(struct hda_codec *codec)
* the generic codec support {
*/ snd_hda_gen_spec_free(codec->spec);
kfree(codec->spec);
codec->spec = NULL;
}
EXPORT_SYMBOL_HDA(snd_hda_gen_free);
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int generic_check_power_status(struct hda_codec *codec, hda_nid_t nid) int snd_hda_gen_check_power_status(struct hda_codec *codec, hda_nid_t nid)
{ {
struct hda_gen_spec *spec = codec->spec; struct hda_gen_spec *spec = codec->spec;
return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
} }
EXPORT_SYMBOL_HDA(snd_hda_gen_check_power_status);
#endif #endif
static void generic_free(struct hda_codec *codec)
{ /*
snd_hda_gen_spec_free(codec->spec); * the generic codec support
kfree(codec->spec); */
codec->spec = NULL;
}
static const struct hda_codec_ops generic_patch_ops = { static const struct hda_codec_ops generic_patch_ops = {
.build_controls = snd_hda_gen_build_controls, .build_controls = snd_hda_gen_build_controls,
.build_pcms = snd_hda_gen_build_pcms, .build_pcms = snd_hda_gen_build_pcms,
.init = snd_hda_gen_init, .init = snd_hda_gen_init,
.free = generic_free, .free = snd_hda_gen_free,
.unsol_event = snd_hda_jack_unsol_event, .unsol_event = snd_hda_jack_unsol_event,
#ifdef CONFIG_PM #ifdef CONFIG_PM
.check_power_status = generic_check_power_status, .check_power_status = snd_hda_gen_check_power_status,
#endif #endif
}; };
...@@ -3995,7 +3998,7 @@ int snd_hda_parse_generic_codec(struct hda_codec *codec) ...@@ -3995,7 +3998,7 @@ int snd_hda_parse_generic_codec(struct hda_codec *codec)
return 0; return 0;
error: error:
generic_free(codec); snd_hda_gen_free(codec);
return err; return err;
} }
EXPORT_SYMBOL(snd_hda_parse_generic_codec); EXPORT_SYMBOL_HDA(snd_hda_parse_generic_codec);
...@@ -218,6 +218,7 @@ int snd_hda_gen_spec_init(struct hda_gen_spec *spec); ...@@ -218,6 +218,7 @@ int snd_hda_gen_spec_init(struct hda_gen_spec *spec);
void snd_hda_gen_spec_free(struct hda_gen_spec *spec); void snd_hda_gen_spec_free(struct hda_gen_spec *spec);
int snd_hda_gen_init(struct hda_codec *codec); int snd_hda_gen_init(struct hda_codec *codec);
void snd_hda_gen_free(struct hda_codec *codec);
struct nid_path *snd_hda_get_nid_path(struct hda_codec *codec, struct nid_path *snd_hda_get_nid_path(struct hda_codec *codec,
hda_nid_t from_nid, hda_nid_t to_nid); hda_nid_t from_nid, hda_nid_t to_nid);
...@@ -257,4 +258,8 @@ void snd_hda_gen_mic_autoswitch(struct hda_codec *codec, ...@@ -257,4 +258,8 @@ void snd_hda_gen_mic_autoswitch(struct hda_codec *codec,
struct hda_jack_tbl *jack); struct hda_jack_tbl *jack);
void snd_hda_gen_update_outputs(struct hda_codec *codec); void snd_hda_gen_update_outputs(struct hda_codec *codec);
#ifdef CONFIG_PM
int snd_hda_gen_check_power_status(struct hda_codec *codec, hda_nid_t nid);
#endif
#endif /* __SOUND_HDA_GENERIC_H */ #endif /* __SOUND_HDA_GENERIC_H */
...@@ -808,14 +808,6 @@ static int alc_init(struct hda_codec *codec) ...@@ -808,14 +808,6 @@ static int alc_init(struct hda_codec *codec)
return 0; return 0;
} }
#ifdef CONFIG_PM
static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
{
struct alc_spec *spec = codec->spec;
return snd_hda_check_amp_list_power(codec, &spec->gen.loopback, nid);
}
#endif
static inline void alc_shutup(struct hda_codec *codec) static inline void alc_shutup(struct hda_codec *codec)
{ {
struct alc_spec *spec = codec->spec; struct alc_spec *spec = codec->spec;
...@@ -876,10 +868,8 @@ static const struct hda_codec_ops alc_patch_ops = { ...@@ -876,10 +868,8 @@ static const struct hda_codec_ops alc_patch_ops = {
.unsol_event = snd_hda_jack_unsol_event, .unsol_event = snd_hda_jack_unsol_event,
#ifdef CONFIG_PM #ifdef CONFIG_PM
.resume = alc_resume, .resume = alc_resume,
#endif
#ifdef CONFIG_PM
.suspend = alc_suspend, .suspend = alc_suspend,
.check_power_status = alc_check_power_status, .check_power_status = snd_hda_gen_check_power_status,
#endif #endif
.reboot_notify = alc_shutup, .reboot_notify = alc_shutup,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment