• Takashi Iwai's avatar
    ALSA: pcm: Allow exact buffer preallocation · ac9245a5
    Takashi Iwai authored
    
    
    A few drivers want to have rather the exact buffer preallocation at
    the driver probe time and keep using it for the whole operations
    without allowing dynamic buffer allocation.  For satisfying the
    demands, this patch extends the managed buffer allocation API
    slightly.
    
    Namely, when 0 is passed to max argument of the allocation helper
    functions snd_pcm_set_managed_buffer*(), it treats as if the fixed
    size allocation of the given size.  If the pre-allocation fails in
    this mode, the function returns now -ENOMEM.  Otherwise, i.e. max
    argument is non-zero, the function never returns -ENOMEM but tries to
    fall back to the smaller chunks and allows the dynamic allocation
    later -- which is still the default behavior until now.
    
    For more intuitive use, also two new helpers are added for handling
    the fixed size buffer allocation, too: snd_pcm_set_fixed_buffer() and
    snd_pcm_set_fixed_buffer_all().
    Acked-by: default avatarMark Brown <broonie@kernel.org>
    Link: https://lore.kernel.org/r/20210802072815.13551-4-tiwai@suse.de
    
    Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
    ac9245a5
pcm.h 51.3 KB