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

ALSA: hda - Release ELD proc file

Release ELD proc file when reconfigured so that no leak occurs.
Signed-off-by: NTakashi Iwai <tiwai@suse.de>
上级 b94d3539
...@@ -567,8 +567,17 @@ int snd_hda_eld_proc_new(struct hda_codec *codec, struct hdmi_eld *eld) ...@@ -567,8 +567,17 @@ int snd_hda_eld_proc_new(struct hda_codec *codec, struct hdmi_eld *eld)
snd_info_set_text_ops(entry, eld, hdmi_print_eld_info); snd_info_set_text_ops(entry, eld, hdmi_print_eld_info);
entry->c.text.write = hdmi_write_eld_item; entry->c.text.write = hdmi_write_eld_item;
entry->mode |= S_IWUSR; entry->mode |= S_IWUSR;
eld->proc_entry = entry;
return 0; return 0;
} }
#endif void snd_hda_eld_proc_free(struct hda_codec *codec, struct hdmi_eld *eld)
{
if (!codec->bus->shutdown && eld->proc_entry) {
snd_device_free(codec->bus->card, eld->proc_entry);
eld->proc_entry = NULL;
}
}
#endif /* CONFIG_PROC_FS */
...@@ -481,6 +481,9 @@ struct hdmi_eld { ...@@ -481,6 +481,9 @@ struct hdmi_eld {
int spk_alloc; int spk_alloc;
int sad_count; int sad_count;
struct cea_sad sad[ELD_MAX_SAD]; struct cea_sad sad[ELD_MAX_SAD];
#ifdef CONFIG_PROC_FS
struct snd_info_entry *proc_entry;
#endif
}; };
int snd_hdmi_get_eld_size(struct hda_codec *codec, hda_nid_t nid); int snd_hdmi_get_eld_size(struct hda_codec *codec, hda_nid_t nid);
...@@ -489,12 +492,17 @@ void snd_hdmi_show_eld(struct hdmi_eld *eld); ...@@ -489,12 +492,17 @@ void snd_hdmi_show_eld(struct hdmi_eld *eld);
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
int snd_hda_eld_proc_new(struct hda_codec *codec, struct hdmi_eld *eld); int snd_hda_eld_proc_new(struct hda_codec *codec, struct hdmi_eld *eld);
void snd_hda_eld_proc_free(struct hda_codec *codec, struct hdmi_eld *eld);
#else #else
static inline int snd_hda_eld_proc_new(struct hda_codec *codec, static inline int snd_hda_eld_proc_new(struct hda_codec *codec,
struct hdmi_eld *eld) struct hdmi_eld *eld)
{ {
return 0; return 0;
} }
static inline void snd_hda_eld_proc_free(struct hda_codec *codec,
struct hdmi_eld *eld)
{
}
#endif #endif
#define SND_PRINT_CHANNEL_ALLOCATION_ADVISED_BUFSIZE 80 #define SND_PRINT_CHANNEL_ALLOCATION_ADVISED_BUFSIZE 80
......
...@@ -637,7 +637,10 @@ static int intel_hdmi_init(struct hda_codec *codec) ...@@ -637,7 +637,10 @@ static int intel_hdmi_init(struct hda_codec *codec)
static void intel_hdmi_free(struct hda_codec *codec) static void intel_hdmi_free(struct hda_codec *codec)
{ {
kfree(codec->spec); struct intel_hdmi_spec *spec = codec->spec;
snd_hda_eld_proc_free(codec, &spec->sink_eld);
kfree(spec);
} }
static struct hda_codec_ops intel_hdmi_patch_ops = { static struct hda_codec_ops intel_hdmi_patch_ops = {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册