ALSA: firewire: use managed-resource of fw unit device for private data
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Tue, 2 Oct 2018 23:21:50 +0000 (08:21 +0900)
committerTakashi Iwai <tiwai@suse.de>
Thu, 4 Oct 2018 05:54:01 +0000 (07:54 +0200)
commit366a20d7a75cff7f89dede6fdfd41bd491aaf8ac
tree76d2420ee45eff7139a3ede8cd020cf7df7ed98a
parent4a9a72e0db5e584267944f4d868f46419b2fab59
ALSA: firewire: use managed-resource of fw unit device for private data

At present, private data of each driver in ALSA firewire stack is
allocated/freed by kernel slab allocator for corresponding unit on
IEEE 1394 bus. In this case, resource-managed slab allocator is
available to release memory object automatically just before releasing
device structure for the unit. This idea can prevent runtime from
memory leak due to programming mistakes.

This commit uses the allocator for the private data. These drivers
already use reference counter to maintain lifetime of device structure
for the unit by a pair of fw_unit_get()/fw_unit_put(). The private data
is safely released in a callback of 'struct snd_card.private_free().

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/firewire/bebob/bebob.c
sound/firewire/dice/dice.c
sound/firewire/digi00x/digi00x.c
sound/firewire/fireface/ff.c
sound/firewire/fireworks/fireworks.c
sound/firewire/motu/motu.c
sound/firewire/oxfw/oxfw.c
sound/firewire/tascam/tascam.c