ALSA: hda - Allocate hda_pcm objects dynamically
authorTakashi Iwai <tiwai@suse.de>
Fri, 27 Feb 2015 16:43:19 +0000 (17:43 +0100)
committerTakashi Iwai <tiwai@suse.de>
Tue, 3 Mar 2015 10:26:24 +0000 (11:26 +0100)
commitbbbc7e8502c95237dbd86cc4d0a12ca9a6b18c8f
tree71d5973b321c194ca5b9fd76592844eb37c4c9ed
parentf4de8fe6cffb449a779dff61f071bd1af9e18e0f
ALSA: hda - Allocate hda_pcm objects dynamically

So far, the hda_codec object kept the hda_pcm list in an array, and
the codec driver was expected to assign the array.  However, this
makes the object life cycle management harder, because the assigned
array is freed at the codec driver detach while it might be still
accessed by the opened streams.

In this patch, we allocate each hda_pcm object dynamically and manage
it as a linked list.  Each object has a kref refcount, and both the
codec driver binder and the PCM open/close touches it, so that the
object won't be freed while in use.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/hda_codec.c
sound/pci/hda/hda_codec.h
sound/pci/hda/hda_generic.c
sound/pci/hda/hda_generic.h
sound/pci/hda/hda_proc.c
sound/pci/hda/patch_ca0132.c
sound/pci/hda/patch_hdmi.c
sound/pci/hda/patch_realtek.c
sound/pci/hda/patch_si3054.c
sound/pci/hda/patch_via.c