]> git.alsa-project.org Git - alsa-lib.git/log
alsa-lib.git
9 years agotopology: Parse vendor private data for manifest
Mengdong Lin [Fri, 15 Jul 2016 12:19:41 +0000 (20:19 +0800)]
topology: Parse vendor private data for manifest

In text conf file, user can define a manifest section and let it refer
to private data sections, in the same syntax as other element types.

The text conf file can have at most 1 manifest section.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agotopology: Change uuid value to 16 separate characters in text conf file
Mengdong Lin [Fri, 15 Jul 2016 12:18:59 +0000 (20:18 +0800)]
topology: Change uuid value to 16 separate characters in text conf file

Previously in text conf file, the uuid value of vendor tuples is a
16-characer string. Now change it to 16 characters separated by commas,
easier for users to edit it manually.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agotopology: Merge lookup for data reference into tplg_copy_data()
Mengdong Lin [Fri, 15 Jul 2016 12:18:11 +0000 (20:18 +0800)]
topology: Merge lookup for data reference into tplg_copy_data()

Code refactor to reduce function calls. Now tplg_copy_data() can look up
a referenced data element and merge its data.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agotopology: An element can refer to multipe data sections in text conf file
Mengdong Lin [Fri, 15 Jul 2016 12:17:43 +0000 (20:17 +0800)]
topology: An element can refer to multipe data sections in text conf file

Previously in text conf file, an element can only refer to one data
section (SectionData). Now it can also refer to a list of data sections.
Thus users can split groups of firmware parameters to multiple data
sections, and put them all in the reference list.

Finally, data of these data sections will be merged, in the same order as
they are in the reference list, as the element's private data for kernel.

We still support the original syntax of reference to a single data
section. The doc is updated for the syntax extension.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agomixer: remove alloca() from simple_event_add()
Takashi Sakamoto [Fri, 15 Jul 2016 00:23:33 +0000 (09:23 +0900)]
mixer: remove alloca() from simple_event_add()

Both of alloca() and automatic variables keep 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>
9 years agomixer: change code formatting for simple_event_add()
Takashi Sakamoto [Fri, 15 Jul 2016 00:23:32 +0000 (09:23 +0900)]
mixer: change code formatting for simple_event_add()

This commit applies code format according to typical and moderate rule.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agomixer: remove alloca() from simple_add1()
Takashi Sakamoto [Fri, 15 Jul 2016 00:23:31 +0000 (09:23 +0900)]
mixer: remove alloca() from simple_add1()

Both of alloca() and automatic variables keep 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>
9 years agomixer: change code formatting for simple_add1()
Takashi Sakamoto [Fri, 15 Jul 2016 00:23:30 +0000 (09:23 +0900)]
mixer: change code formatting for simple_add1()

This commit applies code format according to typical and moderate rule.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agomixer: remove alloca() from set_enum_item_ops()
Takashi Sakamoto [Fri, 15 Jul 2016 00:23:29 +0000 (09:23 +0900)]
mixer: remove alloca() from set_enum_item_ops()

Both of alloca() and automatic variables keep 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>
9 years agomixer: remove alloca() from get_enum_item_ops()
Takashi Sakamoto [Fri, 15 Jul 2016 00:23:28 +0000 (09:23 +0900)]
mixer: remove alloca() from get_enum_item_ops()

Both of alloca() and automatic variables keep 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>
9 years agomixer: remove alloca() from enum_item_name_ops()
Takashi Sakamoto [Fri, 15 Jul 2016 00:23:27 +0000 (09:23 +0900)]
mixer: remove alloca() from enum_item_name_ops()

Both of alloca() and automatic variables keep 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>
9 years agomixer: remove alloca() from init_db_range()
Takashi Sakamoto [Fri, 15 Jul 2016 00:23:26 +0000 (09:23 +0900)]
mixer: remove alloca() from init_db_range()

Both of alloca() and automatic variables keep 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>
9 years agomixer: change code formatting for init_db_range()
Takashi Sakamoto [Fri, 15 Jul 2016 00:23:25 +0000 (09:23 +0900)]
mixer: change code formatting for init_db_range()

This commit applies code format according to typical and moderate rule.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agomixer: remove alloca() from selem_write_main()
Takashi Sakamoto [Fri, 15 Jul 2016 00:23:24 +0000 (09:23 +0900)]
mixer: remove alloca() from selem_write_main()

Both of alloca() and automatic variables keep 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>
9 years agomixer: change code formatting for selem_write_main()
Takashi Sakamoto [Fri, 15 Jul 2016 00:23:23 +0000 (09:23 +0900)]
mixer: change code formatting for selem_write_main()

This commit applies code format according to typical and moderate rule.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agomixer: remove alloca() from elem_write_route()
Takashi Sakamoto [Fri, 15 Jul 2016 00:23:22 +0000 (09:23 +0900)]
mixer: remove alloca() from elem_write_route()

Both of alloca() and automatic variables keep 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>
9 years agomixer: change code formatting for elem_write_route()
Takashi Sakamoto [Fri, 15 Jul 2016 00:23:21 +0000 (09:23 +0900)]
mixer: change code formatting for elem_write_route()

This commit applies code format according to typical and moderate rule.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agomixer: remove alloca() from elem_write_enum()
Takashi Sakamoto [Fri, 15 Jul 2016 00:23:20 +0000 (09:23 +0900)]
mixer: remove alloca() from elem_write_enum()

Both of alloca() and automatic variables keep 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>
9 years agomixer: change code formatting for elem_write_enum()
Takashi Sakamoto [Fri, 15 Jul 2016 00:23:19 +0000 (09:23 +0900)]
mixer: change code formatting for elem_write_enum()

This commit applies code format according to typical and moderate rule.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agomixer: remove alloca() from elem_write_switch_constant()
Takashi Sakamoto [Fri, 15 Jul 2016 00:23:18 +0000 (09:23 +0900)]
mixer: remove alloca() from elem_write_switch_constant()

Both of alloca() and automatic variables keep 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>
9 years agomixer: remove alloca() from elem_write_switch()
Takashi Sakamoto [Fri, 15 Jul 2016 00:23:17 +0000 (09:23 +0900)]
mixer: remove alloca() from elem_write_switch()

Both of alloca() and automatic variables keep 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>
9 years agomixer: change code formatting for elem_write_switch()
Takashi Sakamoto [Fri, 15 Jul 2016 00:23:16 +0000 (09:23 +0900)]
mixer: change code formatting for elem_write_switch()

This commit applies code format according to typical and moderate rule.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agomixer: remove alloca() from elem_write_volume()
Takashi Sakamoto [Fri, 15 Jul 2016 00:23:15 +0000 (09:23 +0900)]
mixer: remove alloca() from elem_write_volume()

Both of alloca() and automatic variables keep 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>
9 years agomixer: change code formatting for elem_write_volume()
Takashi Sakamoto [Fri, 15 Jul 2016 00:23:14 +0000 (09:23 +0900)]
mixer: change code formatting for elem_write_volume()

This commit applies code format according to typical and moderate rule.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agomixer: remove alloca() from selem_read()
Takashi Sakamoto [Fri, 15 Jul 2016 00:23:13 +0000 (09:23 +0900)]
mixer: remove alloca() from selem_read()

Both of alloca() and automatic variables keep 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>
9 years agomixer: change code formatting for selem_read()
Takashi Sakamoto [Fri, 15 Jul 2016 00:23:12 +0000 (09:23 +0900)]
mixer: change code formatting for selem_read()

This commit applies code format according to typical and moderate rule.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agomixer: remove alloca() from elem_read_enum()
Takashi Sakamoto [Fri, 15 Jul 2016 00:23:11 +0000 (09:23 +0900)]
mixer: remove alloca() from elem_read_enum()

Both of alloca() and automatic variables keep 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>
9 years agomixer: change code formatting for elem_read_enum()
Takashi Sakamoto [Fri, 15 Jul 2016 00:23:10 +0000 (09:23 +0900)]
mixer: change code formatting for elem_read_enum()

This commit applies code format according to typical and moderate rule.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agomixer: remove alloca() from elem_read_route()
Takashi Sakamoto [Fri, 15 Jul 2016 00:23:09 +0000 (09:23 +0900)]
mixer: remove alloca() from elem_read_route()

Both of alloca() and automatic variables keep 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>
9 years agomixer: change code formatting for elem_read_route()
Takashi Sakamoto [Fri, 15 Jul 2016 00:23:08 +0000 (09:23 +0900)]
mixer: change code formatting for elem_read_route()

This commit applies code format according to typical and moderate rule.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agomixer: remove alloca() from elem_read_volume()
Takashi Sakamoto [Fri, 15 Jul 2016 00:23:07 +0000 (09:23 +0900)]
mixer: remove alloca() from elem_read_volume()

Both of alloca() and automatic variables keep 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>
9 years agomixer: change code formatting for elem_read_volume()
Takashi Sakamoto [Fri, 15 Jul 2016 00:23:06 +0000 (09:23 +0900)]
mixer: change code formatting for elem_read_volume()

This commit applies code format according to typical and moderate rule.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agomixer: include library local header to find layout of structures
Takashi Sakamoto [Fri, 15 Jul 2016 00:23:05 +0000 (09:23 +0900)]
mixer: include library local header to find layout of structures

Inner this library, implementation of each features can find actual layout
of structures by including local header. Although, mixer feature is written
without the header and as the same way for applications. This brings some
inefficiencies such as usage of alloca() to keep memory objects for the
structures.

This commit includes the header for further improvements in mixer
feature.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoalisp: remove alloca() from FA_pcm_info()
Takashi Sakamoto [Thu, 14 Jul 2016 14:07:51 +0000 (23:07 +0900)]
alisp: remove alloca() from FA_pcm_info()

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>
9 years agoalisp: remove alloca() from FA_hctl_elem_write()
Takashi Sakamoto [Thu, 14 Jul 2016 14:07:50 +0000 (23:07 +0900)]
alisp: remove alloca() from FA_hctl_elem_write()

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>
9 years agoalisp: remove alloca() from FA_hctl_elem_read()
Takashi Sakamoto [Thu, 14 Jul 2016 14:07:49 +0000 (23:07 +0900)]
alisp: remove alloca() from FA_hctl_elem_read()

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>
9 years agoalisp: remove alloca() from FA_hctl_elem_info()
Takashi Sakamoto [Thu, 14 Jul 2016 14:07:48 +0000 (23:07 +0900)]
alisp: remove alloca() from FA_hctl_elem_info()

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>
9 years agoalisp: remove alloca() from FA_hctl_find_elem()
Takashi Sakamoto [Thu, 14 Jul 2016 14:07:47 +0000 (23:07 +0900)]
alisp: remove alloca() from FA_hctl_find_elem()

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>
9 years agoalisp: remove alloca() from FA_card_info()
Takashi Sakamoto [Thu, 14 Jul 2016 14:07:46 +0000 (23:07 +0900)]
alisp: remove alloca() from FA_card_info()

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>
9 years agoconf: remove alloca() from snd_func_private_pcm_subdevice()
Takashi Sakamoto [Thu, 14 Jul 2016 14:07:45 +0000 (23:07 +0900)]
conf: remove alloca() from snd_func_private_pcm_subdevice()

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>
9 years agoconf: remove alloca() from snd_func_pcm_args_by_class()
Takashi Sakamoto [Thu, 14 Jul 2016 14:07:44 +0000 (23:07 +0900)]
conf: remove alloca() from snd_func_pcm_args_by_class()

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>
9 years agoconf: remove alloca() from snd_func_pcm_id()
Takashi Sakamoto [Thu, 14 Jul 2016 14:07:43 +0000 (23:07 +0900)]
conf: remove alloca() from snd_func_pcm_id()

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>
9 years agoconf: remove alloca() from snd_func_card_name()
Takashi Sakamoto [Thu, 14 Jul 2016 14:07:42 +0000 (23:07 +0900)]
conf: remove alloca() from snd_func_card_name()

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>
9 years agoconf: remove alloca() from snd_func_card_id()
Takashi Sakamoto [Thu, 14 Jul 2016 14:07:41 +0000 (23:07 +0900)]
conf: remove alloca() from snd_func_card_id()

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>
9 years agoconf: remove alloca() from snd_determine_driver()
Takashi Sakamoto [Thu, 14 Jul 2016 14:07:40 +0000 (23:07 +0900)]
conf: remove alloca() from snd_determine_driver()

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>
9 years agopcm: remove alloca() from _snd_pcm_softvol_open()
Takashi Sakamoto [Thu, 14 Jul 2016 14:07:39 +0000 (23:07 +0900)]
pcm: remove alloca() from _snd_pcm_softvol_open()

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>
9 years agopcm: change code formatting for _snd_pcm_softvol_open()
Takashi Sakamoto [Thu, 14 Jul 2016 14:07:38 +0000 (23:07 +0900)]
pcm: change code formatting for _snd_pcm_softvol_open()

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>
9 years agopcm: remove alloca() from softvol_load_control()
Takashi Sakamoto [Thu, 14 Jul 2016 14:07:37 +0000 (23:07 +0900)]
pcm: remove alloca() from softvol_load_control()

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>
9 years agopcm: change code formatting for softvol_load_control()
Takashi Sakamoto [Thu, 14 Jul 2016 14:07:36 +0000 (23:07 +0900)]
pcm: change code formatting for softvol_load_control()

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>
9 years agopcm: remove alloca() from snd_spcm_init_duplex()
Takashi Sakamoto [Thu, 14 Jul 2016 14:07:35 +0000 (23:07 +0900)]
pcm: remove alloca() from snd_spcm_init_duplex()

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>
9 years agopcm: remove alloca() from snd_spcm_init()
Takashi Sakamoto [Thu, 14 Jul 2016 14:07:34 +0000 (23:07 +0900)]
pcm: remove alloca() from snd_spcm_init()

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>
9 years agopcm: remove alloca() from snd_pcm_hw_set_chmap()
Takashi Sakamoto [Thu, 14 Jul 2016 14:07:33 +0000 (23:07 +0900)]
pcm: remove alloca() from snd_pcm_hw_set_chmap()

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>
9 years agopcm: remove alloca() from snd_pcm_hw_get_chmap()
Takashi Sakamoto [Thu, 14 Jul 2016 14:07:32 +0000 (23:07 +0900)]
pcm: remove alloca() from snd_pcm_hw_get_chmap()

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>
9 years agopcm: remove alloca() from snd_pcm_query_chmaps_from_hw()
Takashi Sakamoto [Thu, 14 Jul 2016 14:07:31 +0000 (23:07 +0900)]
pcm: remove alloca() from snd_pcm_query_chmaps_from_hw()

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>
9 years agopcm: remove alloca() from snd_pcm_hw_change_timer()
Takashi Sakamoto [Thu, 14 Jul 2016 14:07:30 +0000 (23:07 +0900)]
pcm: remove alloca() from snd_pcm_hw_change_timer()

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>
9 years agopcm: change code formatting for snd_pcm_hw_change_timer()
Takashi Sakamoto [Thu, 14 Jul 2016 14:07:29 +0000 (23:07 +0900)]
pcm: change code formatting for snd_pcm_hw_change_timer()

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>
9 years agopcm: remove alloca() from _snd_pcm_hook_ctl_elems_install()
Takashi Sakamoto [Thu, 14 Jul 2016 14:07:28 +0000 (23:07 +0900)]
pcm: remove alloca() from _snd_pcm_hook_ctl_elems_install()

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>
9 years agopcm: remove alloca() from snd_pcm_direct_set_timer_params
Takashi Sakamoto [Thu, 14 Jul 2016 14:07:27 +0000 (23:07 +0900)]
pcm: remove alloca() from snd_pcm_direct_set_timer_params

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>
9 years agopcm: change code formatting for snd_pcm_direct_set_timer_params()
Takashi Sakamoto [Thu, 14 Jul 2016 14:07:26 +0000 (23:07 +0900)]
pcm: change code formatting for snd_pcm_direct_set_timer_params()

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>
9 years agopcm: remove alloca() from snd_pcm_direct_initialize_poll_fd()
Takashi Sakamoto [Thu, 14 Jul 2016 14:07:25 +0000 (23:07 +0900)]
pcm: remove alloca() from snd_pcm_direct_initialize_poll_fd()

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>
9 years agopcm: change code formatting for snd_pcm_direct_initialize_poll_fd()
Takashi Sakamoto [Thu, 14 Jul 2016 14:07:24 +0000 (23:07 +0900)]
pcm: change code formatting for snd_pcm_direct_initialize_poll_fd()

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>
9 years agopcm: remove alloca() from snd_pcm_direct_initialize_slave
Takashi Sakamoto [Thu, 14 Jul 2016 14:07:23 +0000 (23:07 +0900)]
pcm: remove alloca() from snd_pcm_direct_initialize_slave

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>
9 years agopcm: change code formatting for snd_pcm_direct_initialize_slave()
Takashi Sakamoto [Thu, 14 Jul 2016 14:07:22 +0000 (23:07 +0900)]
pcm: change code formatting for snd_pcm_direct_initialize_slave()

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>
9 years agopcm: remove alloca() from snd_pcm_get_params
Takashi Sakamoto [Thu, 14 Jul 2016 14:07:21 +0000 (23:07 +0900)]
pcm: remove alloca() from snd_pcm_get_params

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>
9 years agopcm: change code formatting for snd_pcm_get_params()
Takashi Sakamoto [Thu, 14 Jul 2016 14:07:20 +0000 (23:07 +0900)]
pcm: change code formatting for snd_pcm_get_params()

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>
9 years agopcm: remove alloca() from snd_pcm_set_params()
Takashi Sakamoto [Thu, 14 Jul 2016 14:07:19 +0000 (23:07 +0900)]
pcm: remove alloca() from snd_pcm_set_params()

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>
9 years agopcm: change code formatting for snd_pcm_set_params()
Takashi Sakamoto [Thu, 14 Jul 2016 14:07:18 +0000 (23:07 +0900)]
pcm: change code formatting for snd_pcm_set_params()

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>
9 years agopcm: fix return value of snd_pcm_ioplug_sw_params()
Takashi Sakamoto [Wed, 13 Jul 2016 14:15:23 +0000 (23:15 +0900)]
pcm: fix return value of snd_pcm_ioplug_sw_params()

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>
9 years agopcm: fix missing return value of snd_pcm_status()
Takashi Sakamoto [Wed, 13 Jul 2016 14:15:12 +0000 (23:15 +0900)]
pcm: fix missing return value of snd_pcm_status()

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>
9 years agoctl: add compatibility information for snd_ctl_elem_info_set_dimension()
Takashi Sakamoto [Wed, 13 Jul 2016 00:29:19 +0000 (09:29 +0900)]
ctl: add compatibility information for snd_ctl_elem_info_set_dimension()

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>
9 years agopcm: Add LIBASOUND_THREAD_SAFE env variable check
Takashi Iwai [Thu, 7 Jul 2016 13:21:14 +0000 (15:21 +0200)]
pcm: Add LIBASOUND_THREAD_SAFE env variable check

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>
9 years agopcm: Remove home brew atomic operations
Takashi Iwai [Thu, 30 Jun 2016 15:24:42 +0000 (17:24 +0200)]
pcm: Remove home brew atomic operations

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>
9 years agopcm: Add thread-safety to PCM API
Takashi Iwai [Thu, 30 Jun 2016 13:32:40 +0000 (15:32 +0200)]
pcm: Add thread-safety to PCM API

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>
9 years agopcm: add 'default' case for switch statement
Takashi Sakamoto [Mon, 11 Jul 2016 12:06:03 +0000 (21:06 +0900)]
pcm: add 'default' case for switch statement

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>
9 years agomixer: remove assignment to unused variable
Takashi Sakamoto [Mon, 11 Jul 2016 12:06:02 +0000 (21:06 +0900)]
mixer: remove assignment to unused variable

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>
9 years agopcm: set error code at failure path
Takashi Sakamoto [Mon, 11 Jul 2016 12:06:01 +0000 (21:06 +0900)]
pcm: set error code at failure path

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>
9 years agotopology: initialize variable for error output
Takashi Sakamoto [Mon, 11 Jul 2016 12:06:00 +0000 (21:06 +0900)]
topology: initialize variable for error output

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>
9 years agotopology: apply the same type to compared two variables
Takashi Sakamoto [Mon, 11 Jul 2016 12:05:59 +0000 (21:05 +0900)]
topology: apply the same type to compared two variables

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>
9 years agotopology: remove unused variable in get_tokens()
Takashi Sakamoto [Mon, 11 Jul 2016 12:05:58 +0000 (21:05 +0900)]
topology: remove unused variable in get_tokens()

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>
9 years agotopology: remove unused variable in tplg_parse_fe_dai()
Takashi Sakamoto [Mon, 11 Jul 2016 12:05:57 +0000 (21:05 +0900)]
topology: remove unused variable in tplg_parse_fe_dai()

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>
9 years agohctl: remove assertion from element event handler because removal event overwrites...
Takashi Sakamoto [Sun, 10 Jul 2016 15:12:34 +0000 (00:12 +0900)]
hctl: remove assertion from element event handler because removal event 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>
9 years agoctl: improve documentation of APIs to add an element set
Takashi Sakamoto [Sat, 9 Jul 2016 01:44:19 +0000 (10:44 +0900)]
ctl: improve documentation of APIs to add an element set

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>
9 years agoconf/ucm: chtrt5645: Add UCM config for chtrt5645
Stephen Just [Mon, 4 Jul 2016 16:51:55 +0000 (10:51 -0600)]
conf/ucm: chtrt5645: Add UCM config for chtrt5645

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>
9 years agotest: add linker flag with pthread for pcm-multi-thread stress test
Takashi Sakamoto [Thu, 7 Jul 2016 21:43:51 +0000 (06:43 +0900)]
test: add linker flag with pthread for pcm-multi-thread stress test

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>
9 years agoctl: add dimension validator
Takashi Sakamoto [Thu, 7 Jul 2016 21:33:17 +0000 (06:33 +0900)]
ctl: add dimension validator

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>
9 years agoAdd pcm-multi-thread to .gitignore
Takashi Iwai [Sat, 2 Jul 2016 08:03:55 +0000 (10:03 +0200)]
Add pcm-multi-thread to .gitignore

Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agotest: Add pcm-multi-thread program
Takashi Iwai [Sat, 2 Jul 2016 08:03:15 +0000 (10:03 +0200)]
test: Add pcm-multi-thread program

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>
9 years agopcm: Remove superfluous rmb() from PCM meter plugin
Takashi Iwai [Thu, 30 Jun 2016 19:56:41 +0000 (21:56 +0200)]
pcm: Remove superfluous rmb() from PCM meter plugin

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>
9 years agoctl: fix a test for user-defined element set in a point of dimension
Takashi Sakamoto [Thu, 7 Jul 2016 14:22:21 +0000 (23:22 +0900)]
ctl: fix a test for user-defined element set in a point of dimension

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>
9 years agoctl: support dimension test for user-defined element set
Takashi Sakamoto [Wed, 29 Jun 2016 13:43:03 +0000 (22:43 +0900)]
ctl: support dimension test for user-defined element set

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>
9 years agoctl: optimize a test for user-defined element set to changes of APIs
Takashi Sakamoto [Wed, 29 Jun 2016 13:43:02 +0000 (22:43 +0900)]
ctl: optimize a test for user-defined element set to changes of APIs

In former commits, APIs to add an element set are changed, while a test
program for user-defined element set doesn't follow them.

This commit add support the change.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoctl: optimize a test for user-defined element set to older kernels
Takashi Sakamoto [Wed, 29 Jun 2016 13:43:01 +0000 (22:43 +0900)]
ctl: optimize a test for user-defined element set to older kernels

In Linux 4.0 or former, call of ioctl(2) with SNDRV_CTL_IOCTL_ELEM_ADD
doesn't fill all of identical information in an argument; i.e. numid.
With the kernel, a test of user-defined element set fails.

This commit fixes the bug. The 'numid' field in identical information
is always zero when adding an element set, therefore zero check has an
effect.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoctl: add an API to set dimension levels to element information
Takashi Sakamoto [Wed, 29 Jun 2016 13:43:00 +0000 (22:43 +0900)]
ctl: add an API to set dimension levels to element information

In a former commit, 'struct snd_ctl_elem_info' is used as a 'container' to
transfer extra fields of element information for APIs to add an element
set. The extra fields should be filled in advance of call of the APIs.
Currently, dimension level is in the extra fields and no APIs to set it.

This commit adds an API to set dimension level to the information
structure. This API is expected to be used in advance of usage of APIs
to add an element set, for nothing others. When the information structure
is extended in future, then the similar APIs shall be added for the new
feature.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoctl: support extra information to user-defined element set
Takashi Sakamoto [Wed, 29 Jun 2016 13:42:59 +0000 (22:42 +0900)]
ctl: support extra information to user-defined element set

In ALSA control feature, information of an element includes extra fields
to type-specific parameters; i.e. dimension. The fields can be extended in
future.

Meanwhile, current APIs to add user-defined element set can not support
such an extended fields. This may cause inconveniences in future.

This commit supports the fields, by changing APIs for element set.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoctl: use consistent name for second argument of snd_ctl_elem_read/write
Takashi Sakamoto [Tue, 28 Jun 2016 13:39:50 +0000 (22:39 +0900)]
ctl: use consistent name for second argument of snd_ctl_elem_read/write

Second argument of these functions has three different names in
documentation/header/code (obj/control/value). This easily causes users'
confusion.

This commit applies consistent names for the arguments.

Fixes: 90020c05f886 ('ctl: improve comments for handling element data')
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoctl: use automatic variable instead of call of alloca(3)
Takashi Sakamoto [Mon, 27 Jun 2016 14:37:36 +0000 (23:37 +0900)]
ctl: use automatic variable instead of call of alloca(3)

Inner this library, layouts of all structures are public. At a compilation
time, each size of the structures can be calculated. It means that we can
use automatic variable instead of calling alloca(3) to program this
library because in both ways storages are kept on stack frame of process
VMA. Besides, the usage of automatic variables requires less instructions
than calls of alloca(3). Furthermore, alloca(3) is not described in any
C language standards.

This commit replaces calls of alloca(3) just for structures with automatic
variables, for control features.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoctl: fix returning zero for dimension level 4
Takashi Sakamoto [Mon, 27 Jun 2016 13:02:57 +0000 (22:02 +0900)]
ctl: fix returning zero for dimension level 4

In ALSA kernel/userspace interfaces, 'struct snd_ctl_elem_info' has a
'dimension' parameter. This parameter consists of an array with four
elements. Each element represents the number of members in corresponding
dimension level to construct matrix.

In current implementation, a get function, 'snd_ctl_elem_info_get_dimension()'
is hardcoded to return zero to level 4, against actual value. This commit fixes
the bug.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agodoxygen: Suppress timestamp
Takashi Iwai [Thu, 23 Jun 2016 14:29:07 +0000 (16:29 +0200)]
doxygen: Suppress timestamp

The build timestamp in the doc is bad for packaging in general, so
let's disable it as default.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoINSTALL: update text and drop reference to Hg
Henrik Austad [Tue, 21 Jun 2016 12:19:26 +0000 (14:19 +0200)]
INSTALL: update text and drop reference to Hg

This is really just nitpick, but it annoyed me for a few seconds, so I thought
I'd just fix it.

In d7534b2ceec7 (hgcompile -> gitcompile) the filename was updated but
INSTALL was not, leaving outdated docs.

Signed-off-by: Henrik Austad <henrik@austad.us>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoctl: add test program for control element set
Takashi Sakamoto [Fri, 17 Jun 2016 12:26:42 +0000 (21:26 +0900)]
ctl: add test program for control element set

The feature of control element set has been abandoned for a long time since
firstly introduced in 2003. Furthermore, there's few applications to utilize
this feature. These situations bring a hard work to persons who need the
feature. Especially, a lack of test program make it harder to fix much bugs
in this feature.

This commit adds a test program as a sample of the feature. This program
adds element sets of each element type to 'hw:0' in this order; boolean,
integer, enumerated, bytes, IEC958 and integer64. Each iteration includes
below scheme:

1. add an element set with 900 elements. Each of them has maximum number
   of members allowed by ALSA ctl core.
2. check all of events generated by above operation.
3. retrieve information of each element, then validate it.
4. unlock each member of all elements because they're initially locked.
5. write to all of members in all elements and read.
6. check all of events generated by above operation.
7. write information for threshold level to the element set and read it.
8. check all of events generated by above operation.
9. remove the element set.
10.check all of events generated by above operation.

When any of these operations fail, it means regression occurs. Then, added
elements still remain in a certain sound card. In this case, unloading
drivers corresponding to the card is an easy way to recover.

Besides, this program doesn't perform below element operations of ALSA ctl
feature:
 - list
 - lock
 - replace

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>