Fix access of freed memory in namehints

Sometimes a hook manipulates the config tree, which makes currently
running iterators point to freed memory. As a workaround, make two
copies, one for the iterators and another for the hooks.

BugLink: https://bugs.launchpad.net/bugs/1008600
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
HDA-Intel: present up to 8 HDMI/DP outputs via "hdmi" device

Some new AMD cards have HDA codecs presenting 6 connected HDMI/DP pin
nodes (plus 1 unconnected pin node) according to the ALSA card database.

Example:
http://www.alsa-project.org/db/?f=de3ced7af41de0ed54d218650e5e2f16c511787b

Bump the maximum number of presented HDMI outputs per card via the
"hdmi" PCM from 4 to 8 (so that the last possible device is DEV=7).

Note that HDMI PCM devices DEV=4..7 use shared PCM device numbers, so
HDA cards that have over 4 audio PCM devices or multiple S/PDIF or modem
devices will have their remaining PCM devices misrepresented as HDMI
devices.

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
snd_tlv_convert_from_dB: fix decreasing gain across entries

Currently, for a TLV consisting of TLV_DB_SCALE_ITEMs, if e.g. alsamixer
calls snd_mixer_selem_set_playback_dB() with a value that is in-between
two TLV_DB_SCALE_ITEMs, and xdir is negative, the selected raw hardware
value is the minimum in the first range above that value, rather than the
maximum in the last range below that value.

The user-visible symptom is that in alsamixer, pressing the down key to
reduce the value sticks at certain points, and cannot be incrementally
reduced any further, although directly selecting a much lower value (e.g.
by pressing 0..9) works as expected. This is triggered e.g. by
sound/soc/codec/max98090.c's max98090_hp_tlv[].

Fix this by checking whether xdir is positive or not, rather than
checking whether it has a non-zero value. The code to select the previous
range's max value is already present. This matches how xdir is used in
other parts of the code.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
remove unnecessary/obsolete compat/hsearch_r.c

The usage of hsearch functions where removed long time
ago in commit 273d115de05574251bdd661747ecb68449a5cf1d.
This patch highly increases portability for non-glibc systems.

Remove the complete compat directory as requested by
Takashi Iwai.

Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
local.h: include sys/types.h to fix issues with pcm.h

sys/types.h is required for the u_int_XX types used by pcm.h.
since a change in pcm.h is not desired, we add the inclusion
to the header that includes pcm.h during build.

Signed-off-by: John Spencer <maillist-alsa@barfooze.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>