diff options
author | Takashi Iwai <tiwai@suse.de> | 2008-11-21 03:11:50 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2008-11-21 03:17:30 -0500 |
commit | f208dba97f2f3ff2fbcbe771195061e2a0dac870 (patch) | |
tree | 0c9bf38427af8c3c44e6c8e47cbc0ecf7e11f009 | |
parent | b94d3539de59ec6481e38f83c455324fd3aeabc1 (diff) |
ALSA: hda - Release ELD proc file
Release ELD proc file when reconfigured so that no leak occurs.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | sound/pci/hda/hda_eld.c | 11 | ||||
-rw-r--r-- | sound/pci/hda/hda_local.h | 8 | ||||
-rw-r--r-- | sound/pci/hda/patch_intelhdmi.c | 5 |
3 files changed, 22 insertions, 2 deletions
diff --git a/sound/pci/hda/hda_eld.c b/sound/pci/hda/hda_eld.c index d2b7ccca3bb3..8740e7be8b24 100644 --- a/sound/pci/hda/hda_eld.c +++ b/sound/pci/hda/hda_eld.c | |||
@@ -567,8 +567,17 @@ int snd_hda_eld_proc_new(struct hda_codec *codec, struct hdmi_eld *eld) | |||
567 | snd_info_set_text_ops(entry, eld, hdmi_print_eld_info); | 567 | snd_info_set_text_ops(entry, eld, hdmi_print_eld_info); |
568 | entry->c.text.write = hdmi_write_eld_item; | 568 | entry->c.text.write = hdmi_write_eld_item; |
569 | entry->mode |= S_IWUSR; | 569 | entry->mode |= S_IWUSR; |
570 | eld->proc_entry = entry; | ||
570 | 571 | ||
571 | return 0; | 572 | return 0; |
572 | } | 573 | } |
573 | 574 | ||
574 | #endif | 575 | void snd_hda_eld_proc_free(struct hda_codec *codec, struct hdmi_eld *eld) |
576 | { | ||
577 | if (!codec->bus->shutdown && eld->proc_entry) { | ||
578 | snd_device_free(codec->bus->card, eld->proc_entry); | ||
579 | eld->proc_entry = NULL; | ||
580 | } | ||
581 | } | ||
582 | |||
583 | #endif /* CONFIG_PROC_FS */ | ||
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h index c71505a4f99d..bf7ba8b62973 100644 --- a/sound/pci/hda/hda_local.h +++ b/sound/pci/hda/hda_local.h | |||
@@ -481,6 +481,9 @@ struct hdmi_eld { | |||
481 | int spk_alloc; | 481 | int spk_alloc; |
482 | int sad_count; | 482 | int sad_count; |
483 | struct cea_sad sad[ELD_MAX_SAD]; | 483 | struct cea_sad sad[ELD_MAX_SAD]; |
484 | #ifdef CONFIG_PROC_FS | ||
485 | struct snd_info_entry *proc_entry; | ||
486 | #endif | ||
484 | }; | 487 | }; |
485 | 488 | ||
486 | int snd_hdmi_get_eld_size(struct hda_codec *codec, hda_nid_t nid); | 489 | 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 | 492 | ||
490 | #ifdef CONFIG_PROC_FS | 493 | #ifdef CONFIG_PROC_FS |
491 | int snd_hda_eld_proc_new(struct hda_codec *codec, struct hdmi_eld *eld); | 494 | int snd_hda_eld_proc_new(struct hda_codec *codec, struct hdmi_eld *eld); |
495 | void snd_hda_eld_proc_free(struct hda_codec *codec, struct hdmi_eld *eld); | ||
492 | #else | 496 | #else |
493 | static inline int snd_hda_eld_proc_new(struct hda_codec *codec, | 497 | static inline int snd_hda_eld_proc_new(struct hda_codec *codec, |
494 | struct hdmi_eld *eld) | 498 | struct hdmi_eld *eld) |
495 | { | 499 | { |
496 | return 0; | 500 | return 0; |
497 | } | 501 | } |
502 | static inline void snd_hda_eld_proc_free(struct hda_codec *codec, | ||
503 | struct hdmi_eld *eld) | ||
504 | { | ||
505 | } | ||
498 | #endif | 506 | #endif |
499 | 507 | ||
500 | #define SND_PRINT_CHANNEL_ALLOCATION_ADVISED_BUFSIZE 80 | 508 | #define SND_PRINT_CHANNEL_ALLOCATION_ADVISED_BUFSIZE 80 |
diff --git a/sound/pci/hda/patch_intelhdmi.c b/sound/pci/hda/patch_intelhdmi.c index 5393f84f6755..58aaf06589a8 100644 --- a/sound/pci/hda/patch_intelhdmi.c +++ b/sound/pci/hda/patch_intelhdmi.c | |||
@@ -637,7 +637,10 @@ static int intel_hdmi_init(struct hda_codec *codec) | |||
637 | 637 | ||
638 | static void intel_hdmi_free(struct hda_codec *codec) | 638 | static void intel_hdmi_free(struct hda_codec *codec) |
639 | { | 639 | { |
640 | kfree(codec->spec); | 640 | struct intel_hdmi_spec *spec = codec->spec; |
641 | |||
642 | snd_hda_eld_proc_free(codec, &spec->sink_eld); | ||
643 | kfree(spec); | ||
641 | } | 644 | } |
642 | 645 | ||
643 | static struct hda_codec_ops intel_hdmi_patch_ops = { | 646 | static struct hda_codec_ops intel_hdmi_patch_ops = { |