ALSA: core: Abstract memory alloc helpers
authorTakashi Iwai <tiwai@suse.de>
Wed, 9 Jun 2021 16:25:49 +0000 (18:25 +0200)
committerTakashi Iwai <tiwai@suse.de>
Thu, 10 Jun 2021 08:15:21 +0000 (10:15 +0200)
commit37af81c5998f4b0f23fb452cffa4b8a1c00ce95b
tree1def6906c07dfff4d6ddde09cbaaaa3000af693d
parent84a0374051c1582ed9ace6cd63cdbfb15ed4b797
ALSA: core: Abstract memory alloc helpers

This patch introduces the ops table to each memory allocation type
(SNDRV_DMA_TYPE_XXX) and abstract the handling for the better code
management.  Then we get separate the page allocation, release and
other tasks for each type, especially for the SG buffer.

Each buffer type has now callbacks in the struct snd_malloc_ops, and
the common helper functions call those ops accordingly.  The former
inline code that is specific to SG-buffer is moved into the local
sgbuf.c, and we can simplify the PCM code without details of memory
handling.

Link: https://lore.kernel.org/r/20210609162551.7842-4-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
include/sound/memalloc.h
include/sound/pcm.h
sound/core/memalloc.c
sound/core/memalloc_local.h [new file with mode: 0644]
sound/core/pcm_local.h
sound/core/pcm_memory.c
sound/core/pcm_native.c
sound/core/sgbuf.c