summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* conf: remove alloca() from snd_func_pcm_args_by_class()Takashi Sakamoto2016-07-141-6/+4
| | | | | | | | | | | | Both of alloca() and automatic variables keeps storages on stack, while the former generates more instructions than the latter. It's better to use the latter if the size of storage is computable at pre-compile or compile time; i.e. just for structures. This commit obsolete usages of alloca() with automatic variables. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* conf: remove alloca() from snd_func_pcm_id()Takashi Sakamoto2016-07-141-6/+6
| | | | | | | | | | | | Both of alloca() and automatic variables keeps storages on stack, while the former generates more instructions than the latter. It's better to use the latter if the size of storage is computable at pre-compile or compile time; i.e. just for structures. This commit obsolete usages of alloca() with automatic variables. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* conf: remove alloca() from snd_func_card_name()Takashi Sakamoto2016-07-141-4/+3
| | | | | | | | | | | | Both of alloca() and automatic variables keeps storages on stack, while the former generates more instructions than the latter. It's better to use the latter if the size of storage is computable at pre-compile or compile time; i.e. just for structures. This commit obsolete usages of alloca() with automatic variables. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* conf: remove alloca() from snd_func_card_id()Takashi Sakamoto2016-07-141-4/+3
| | | | | | | | | | | | Both of alloca() and automatic variables keeps storages on stack, while the former generates more instructions than the latter. It's better to use the latter if the size of storage is computable at pre-compile or compile time; i.e. just for structures. This commit obsolete usages of alloca() with automatic variables. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* conf: remove alloca() from snd_determine_driver()Takashi Sakamoto2016-07-141-4/+3
| | | | | | | | | | | | Both of alloca() and automatic variables keeps storages on stack, while the former generates more instructions than the latter. It's better to use the latter if the size of storage is computable at pre-compile or compile time; i.e. just for structures. This commit obsolete usages of alloca() with automatic variables. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* pcm: remove alloca() from _snd_pcm_softvol_open()Takashi Sakamoto2016-07-141-4/+3
| | | | | | | | | | | | Both of alloca() and automatic variables keeps storages on stack, while the former generates more instructions than the latter. It's better to use the latter if the size of storage is computable at pre-compile or compile time; i.e. just for structures. This commit obsolete usages of alloca() with automatic variables. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* pcm: change code formatting for _snd_pcm_softvol_open()Takashi Sakamoto2016-07-141-5/+7
| | | | | | | | This commit applies code format according to typical and moderate rule, for _snd_pcm_softvol_open(). Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* pcm: remove alloca() from softvol_load_control()Takashi Sakamoto2016-07-141-20/+18
| | | | | | | | | | | | Both of alloca() and automatic variables keeps storages on stack, while the former generates more instructions than the latter. It's better to use the latter if the size of storage is computable at pre-compile or compile time; i.e. just for structures. This commit obsolete usages of alloca() with automatic variables. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* pcm: change code formatting for softvol_load_control()Takashi Sakamoto2016-07-141-7/+15
| | | | | | | | This commit applies code format according to typical and moderate rule, for softvol_load_control(). Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* pcm: remove alloca() from snd_spcm_init_duplex()Takashi Sakamoto2016-07-141-7/+4
| | | | | | | | | | | | Both of alloca() and automatic variables keeps storages on stack, while the former generates more instructions than the latter. It's better to use the latter if the size of storage is computable at pre-compile or compile time; i.e. just for structures. This commit obsolete usages of alloca() with automatic variables. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* pcm: remove alloca() from snd_spcm_init()Takashi Sakamoto2016-07-141-7/+4
| | | | | | | | | | | | Both of alloca() and automatic variables keeps storages on stack, while the former generates more instructions than the latter. It's better to use the latter if the size of storage is computable at pre-compile or compile time; i.e. just for structures. This commit obsolete usages of alloca() with automatic variables. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* pcm: remove alloca() from snd_pcm_hw_set_chmap()Takashi Sakamoto2016-07-141-8/+7
| | | | | | | | | | | | Both of alloca() and automatic variables keeps storages on stack, while the former generates more instructions than the latter. It's better to use the latter if the size of storage is computable at pre-compile or compile time; i.e. just for structures. This commit obsolete usages of alloca() with automatic variables. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* pcm: remove alloca() from snd_pcm_hw_get_chmap()Takashi Sakamoto2016-07-141-8/+6
| | | | | | | | | | | | Both of alloca() and automatic variables keeps storages on stack, while the former generates more instructions than the latter. It's better to use the latter if the size of storage is computable at pre-compile or compile time; i.e. just for structures. This commit obsolete usages of alloca() with automatic variables. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* pcm: remove alloca() from snd_pcm_query_chmaps_from_hw()Takashi Sakamoto2016-07-141-4/+3
| | | | | | | | | | | | Both of alloca() and automatic variables keeps storages on stack, while the former generates more instructions than the latter. It's better to use the latter if the size of storage is computable at pre-compile or compile time; i.e. just for structures. This commit obsolete usages of alloca() with automatic variables. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* pcm: remove alloca() from snd_pcm_hw_change_timer()Takashi Sakamoto2016-07-141-6/+5
| | | | | | | | | | | | Both of alloca() and automatic variables keeps storages on stack, while the former generates more instructions than the latter. It's better to use the latter if the size of storage is computable at pre-compile or compile time; i.e. just for structures. This commit obsolete usages of alloca() with automatic variables. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* pcm: change code formatting for snd_pcm_hw_change_timer()Takashi Sakamoto2016-07-141-7/+20
| | | | | | | | This commit applies code format according to typical and moderate rule, for snd_pcm_hw_change_timer(). Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* pcm: remove alloca() from _snd_pcm_hook_ctl_elems_install()Takashi Sakamoto2016-07-141-4/+4
| | | | | | | | | | | | Both of alloca() and automatic variables keeps storages on stack, while the former generates more instructions than the latter. It's better to use the latter if the size of storage is computable at pre-compile or compile time; i.e. just for structures. This commit obsolete usages of alloca() with automatic variables. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* pcm: remove alloca() from snd_pcm_direct_set_timer_paramsTakashi Sakamoto2016-07-141-7/+6
| | | | | | | | | | | | Both of alloca() and automatic variables keeps storages on stack, while the former generates more instructions than the latter. It's better to use the latter if the size of storage is computable at pre-compile or compile time; i.e. just for structures. This commit obsolete usages of alloca() with automatic variables. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* pcm: change code formatting for snd_pcm_direct_set_timer_params()Takashi Sakamoto2016-07-141-1/+1
| | | | | | | | This commit applies code format according to typical and moderate rule, for snd_pcm_direct_set_timer_params(). Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* pcm: remove alloca() from snd_pcm_direct_initialize_poll_fd()Takashi Sakamoto2016-07-141-6/+5
| | | | | | | | | | | | Both of alloca() and automatic variables keeps storages on stack, while the former generates more instructions than the latter. It's better to use the latter if the size of storage is computable at pre-compile or compile time; i.e. just for structures. This commit obsolete usages of alloca() with automatic variables. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* pcm: change code formatting for snd_pcm_direct_initialize_poll_fd()Takashi Sakamoto2016-07-141-6/+8
| | | | | | | | This commit applies code format according to typical and moderate rule, for snd_pcm_direct_initialize_poll_fd(). Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* pcm: remove alloca() from snd_pcm_direct_initialize_slaveTakashi Sakamoto2016-07-141-33/+30
| | | | | | | | | | | | Both of alloca() and automatic variables keeps storages on stack, while the former generates more instructions than the latter. It's better to use the latter if the size of storage is computable at pre-compile or compile time; i.e. just for structures. This commit obsolete usages of alloca() with automatic variables. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* pcm: change code formatting for snd_pcm_direct_initialize_slave()Takashi Sakamoto2016-07-141-22/+45
| | | | | | | | This commit applies code format according to typical and moderate rule, for snd_pcm_direct_initialize_slave(). Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* pcm: remove alloca() from snd_pcm_get_paramsTakashi Sakamoto2016-07-141-5/+4
| | | | | | | | | | | | Both of alloca() and automatic variables keeps storages on stack, while the former generates more instructions than the latter. It's better to use the latter if the size of storage is computable at pre-compile or compile time; i.e. just for structures. This commit obsolete usages of alloca() with automatic variables. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* pcm: change code formatting for snd_pcm_get_params()Takashi Sakamoto2016-07-141-7/+5
| | | | | | | | This commit applies code format according to typical and moderate rule, for snd_pcm_get_params(). Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* pcm: remove alloca() from snd_pcm_set_params()Takashi Sakamoto2016-07-141-27/+25
| | | | | | | | | | | | Both of alloca() and automatic variables keeps storages on stack, while the former generates more instructions than the latter. It's better to use the latter if the size of storage is computable at pre-compile or compile time; i.e. just for structures. This commit obsolete usages of alloca() with automatic variables. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* pcm: change code formatting for snd_pcm_set_params()Takashi Sakamoto2016-07-141-79/+114
| | | | | | | | This commit applies code format according to typical and moderate rule, for snd_pcm_set_params(). Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* pcm: fix return value of snd_pcm_ioplug_sw_params()Takashi Sakamoto2016-07-131-7/+9
| | | | | | | | | | | In former commits for thread-safe PCM APIs, snd_pcm_ioplug_sw_params() got 0 as its return value, against the original implementation. This commit fixes it. Fixes: 54931e5a5455('pcm: Add thread-safety to PCM API') Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* pcm: fix missing return value of snd_pcm_status()Takashi Sakamoto2016-07-131-0/+2
| | | | | | | | | | | In former commits for thread-safe PCM APIs, snd_pcm_status() lost its return value. This commit regain it. Fixes: 54931e5a5455('pcm: Add thread-safety to PCM API') Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ctl: add compatibility information for snd_ctl_elem_info_set_dimension()Takashi Sakamoto2016-07-131-0/+3
| | | | | | | | I forgot it when committing to the API. Fixes: 16812b70daeb('ctl: add an API to set dimension levels to element information') Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* pcm: Add LIBASOUND_THREAD_SAFE env variable checkTakashi Iwai2016-07-112-2/+20
| | | | | | | | | For making the debugging with any deadlocks by the newly introduced thread-safety feature, add a check with LIBASOUND_THREAD_SAFE environment variable. When this variable is set to "0", alsa-lib PCM forcibly disables the whole thread-safe pthread mutex calls. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* pcm: Remove home brew atomic operationsTakashi Iwai2016-07-117-305/+20
| | | | | | | | | | | | We've had a few home brew atomic operations in a couple of places in the PCM code. This was for supporting the concurrent accesses, but in practice, it couldn't cover the race properly by itself alone. Since we have a wider concurrency protection via mutex now, we can get rid of these atomic codes, which worsens the portability significantly. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* pcm: Add thread-safety to PCM APITakashi Iwai2016-07-1116-144/+603
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Traditionally, many of ALSA library functions are supposed to be thread-unsafe, and applications are required to take care of thread safety by themselves. However, people never be careful enough, and almost all applications fail in this regard. This patch is an attempt to harden the thread safety in exported PCM functions in a simplistic way: just wrap some of exported functions with the pthread mutex of each PCM object. Not all API functions are wrapped by the mutex since it doesn't make sense. Instead, the patchset covers only the functions that may be likely called concurrently. The supposedly thread-safe API functions are marked in the document. For achieving the feature, two new fields are added snd_pcm_t when the option is enabled: thread_safe and lock. The former indicates that the plugin is thread-safe that doesn't need this workaround and the latter is the pthread mutex. Currently only hw plugin have thread_safe=1. So, the most of real-time sensitive apps won't be influenced by this patchset. Although the patch covers most of PCM ops, a few snd_pcm_fast_ops are left without the extra mutex locking: namely, the ones that may have blocking behavior, i.e. resume, drain, readi, writei, readn and writen. These are supposed to handle own locking in the callbacks. Also, if anyone wants to disable this new thread-safe API feature, it can be still turned off via --disable-thread-safety configure option. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* pcm: add 'default' case for switch statementTakashi Sakamoto2016-07-111-0/+2
| | | | | | | | | | | | This commit fixes below compiler warnings. pcm_direct.c: In function ‘snd1_pcm_direct_prepare’: pcm_direct.c:821:2: warning: enumeration value ‘SND_PCM_STATE_PREPARED’ not handled in switch [-Wswitch] switch (snd_pcm_state(dmix->spcm)) { ^ Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* mixer: remove assignment to unused variableTakashi Sakamoto2016-07-111-2/+0
| | | | | | | | | | | This commit fixes below compiler warnings. sbase.c:327:16: warning: variable ‘values’ set but not used [-Wunused-but-set-variable] unsigned long values; ^ Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* pcm: set error code at failure pathTakashi Sakamoto2016-07-111-0/+1
| | | | | | | | | | | | This commit fixes below compiler warnings. pcm_hw.c: In function ‘_snd_pcm_hw_open’: pcm_hw.c:1816:16: warning: ‘err’ may be used uninitialized in this function [-Wmaybe-uninitialized] return err; ^ Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* topology: initialize variable for error outputTakashi Sakamoto2016-07-111-0/+1
| | | | | | | | | | | | | | | | | | This commit fixes below compiler warnings. In file included from ../../include/local.h:165:0, from tplg_local.h:17, from data.c:20: data.c: In function ‘tplg_parse_tuples’: ../../include/error.h:64:21: warning: ‘id’ may be used uninitialized in this function [-Wmaybe-uninitialized] #define SNDERR(...) snd_lib_error(__FILE__, __LINE__, __FUNCTION__, 0, __VA_ARGS__) /**< Shows a sound error message. */ ^ data.c:576:14: note: ‘id’ was declared here const char *id; ^ Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* topology: apply the same type to compared two variablesTakashi Sakamoto2016-07-111-3/+4
| | | | | | | | | | | | | | | | | | | | | | | This commit fixes below compiler warnings. data.c: In function ‘get_token_value’: data.c:262:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (i = 0; i < tokens->num_tokens; i++) { ^ data.c: In function ‘copy_tuples’: data.c:351:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (i = 0; i < tuples->num_sets ; i++) { ^ data.c:378:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (j = 0; j < tuple_set->num_tuples; j++) { ^ data.c: In function ‘tplg_free_tuples’: data.c:723:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (i = 0; i < tuples->num_sets; i++) ^ Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* topology: remove unused variable in get_tokens()Takashi Sakamoto2016-07-111-2/+0
| | | | | | | | | | | | | | | | This commit fixes below compiler warnings. data.c: In function ‘get_tokens’: data.c:276:6: warning: unused variable ‘err’ [-Wunused-variable] int err = 0; ^ data.c: In function ‘has_tuples’: data.c:302:6: warning: unused variable ‘err’ [-Wunused-variable] int err = 0; ^ Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* topology: remove unused variable in tplg_parse_fe_dai()Takashi Sakamoto2016-07-111-1/+0
| | | | | | | | | | | | This commit fixes below compiler warnings. pcm.c: In function ‘tplg_parse_fe_dai’: pcm.c:333:6: warning: unused variable ‘err’ [-Wunused-variable] int err; ^ Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* hctl: remove assertion from element event handler because removal event ↵Takashi Sakamoto2016-07-111-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | overwrites all of queued events In ALSA control core, when several events occurs for an element, they're represented bit mask (struct snd_ctl_event.data.elem.mask). Thus userspace applications can handles these events separately in one I/O operation. There's an exception; removal event. This is represented by all of bits in the mask. Therefore, when a removal event occurs for an element, all of queued events for the element are overwritten. This works worse for a combination of applications which add/remove control elements and applications which keep a cache of elements. For example, let's assume a case that: 1.some elements are added by ioctl(SNDRV_CTL_IOCTL_ELEM_ADD). 2.ALSA control core handles the request and queues 'add' event. 3.applications don't read the event yet. 4.the elements are removed by ioctl(SNDRV_CTL_IOCTL_ELEM_REMOVE) 5.ALSA control core handles the request and queues 'removal' event by overwriting queued events. 6.applications read the event at last. 7.the applications cannot find removed elements in their cache data. Especially, when applications use hctl interface of ALSA userspace library, this situation occurs because the interface is designed to keep element cache implicitly inner the library. PulseAudio is such an application. When executing a test program of ALSA library (test/user-ctl-element-set.c), pulseaudio process aborts due to assertion at calls of snd_hctl_handle_events(). The rule to represent events is in ALSA kernel/userspace interfaces (UAPI header) and it's difficult to improve the rule. Therefore, developers should pay enough attention to the fact that userspace applications can receive removal events for elements which are not notified with 'add' event. For this reason, this commit removes assertion from event handler of ALSA hctl API. CC: pulseaudio-discuss@lists.freedesktop.org Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ctl: improve documentation of APIs to add an element setTakashi Sakamoto2016-07-091-7/+12
| | | | | | | | | | | | Currently, documentation of APIs to add an element set describes causes of errors partly. But it gives an opinion to describe them thoroughly. This is not good for users. This commit changes the documentation so that it partly describes the causes. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* conf/ucm: chtrt5645: Add UCM config for chtrt5645Stephen Just2016-07-085-1/+220
| | | | | | | | Add a UCM configuration for the rt5645 codec on Intel's Cherry-Trail platform. Tested on the Microsoft Surface 3. Signed-off-by: Stephen Just <stephenjust@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* test: add linker flag with pthread for pcm-multi-thread stress testTakashi Sakamoto2016-07-071-1/+1
| | | | | | | | | | | | | | | | | | | This test program is a pthread application, while Makefile has no flags for linker about pthread library. This can cause below error. $ make pcm-multi-thread CCLD pcm-multi-thread /usr/bin/ld: pcm-multi-thread.o: undefined reference to symbol 'pthread_cancel@@GLIBC_2.2.5' //lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status Makefile:523: recipe for target 'pcm-multi-thread' failed make: *** [pcm-multi-thread] Error 1 This commit fixes the bug by adding a corresponding flag. Fixes: 147093ac5b8d('test: Add pcm-multi-thread program') Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ctl: add dimension validatorTakashi Sakamoto2016-07-071-0/+42
| | | | | | | | | | | | | | | | Linux 4.7 or former have no validator of dimension information. This can causes an issue related to user-defined element set. For example, When calculated total members in multi-dimensional matrix is larger than actual capacity of snd_ctl_elem_value_t, processes to handle the element can cause buffer-over-run. For backward portability of this userspace library, this commit adds a validator of dimension information. When userspace applications give invalid dimension information to APIs to add element set, they receive -EINVAL. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* Add pcm-multi-thread to .gitignoreTakashi Iwai2016-07-071-0/+1
| | | | Signed-off-by: Takashi Iwai <tiwai@suse.de>
* test: Add pcm-multi-thread programTakashi Iwai2016-07-072-1/+265
| | | | | | | | | | | A simple multi-thread stress test for PCM is added to test subdirectory. It can perform various PCM update function in the worker threads while reading/writing the data in the main thread. It can help catching the unexpected error or blockage. For example, running the capture test with a softvol plugin will lead to the assert due to the races. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* pcm: Remove superfluous rmb() from PCM meter pluginTakashi Iwai2016-07-071-1/+0
| | | | | | | rmb() is still left in the code without any actual meaning there just before the atomic operation. Let's clean it up. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ctl: fix a test for user-defined element set in a point of dimensionTakashi Sakamoto2016-07-071-1/+1
| | | | | | | | | | | | | | | Currently, this test program has a bug related to dimension information. When testing an element set with byte type, the program adds 512 members to an element. This is a maximum number permitted for this type. On the other hand, dimension information of the elements consists of [8, 4, 8, 4]. Calculated members in the multi-dimensional matrix is 1024. This should be less than 512. This commit fixes the bug. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ctl: support dimension test for user-defined element setTakashi Sakamoto2016-06-301-1/+38
| | | | | | | | | | | In former commits, APIs to add an element set are extended to support extra fields to information structure. Currently, the fields are mainly used to describe dimension level. This commit adds tests to check the dimension level. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>