History log of /linux-master/include/sound/core.h
Revision Date Author Comments
# 01ed7f35 16-Aug-2023 Takashi Iwai <tiwai@suse.de>

ALSA: core: Drop snd_device_initialize()

Now all users of snd_device_intialize() are gone, let's drop it.

Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Tested-by: Curtis Malainey <cujomalainey@chromium.org>
Link: https://lore.kernel.org/r/20230816160252.23396-10-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 6a66b01d 16-Aug-2023 Takashi Iwai <tiwai@suse.de>

ALSA: control: Don't embed ctl_dev

Embedding the ctl_dev in the snd_card object may result in UAF when
the delayed kobj release is used; at the delayed kobj release, it
still accesses the struct device itself while the card memory (that
embeds the struct device) may be already gone.

As a workaround, detach the struct device from the card object by
allocating via the new snd_device_alloc() helper. The rest are just
replacing ctl_dev access to the pointer.

This is based on the fix Curtis posted initially. In this patch, the
changes are split and use the new helper function instead.

Link: https://lore.kernel.org/r/20230801171928.1460120-1-cujomalainey@chromium.org
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Tested-by: Curtis Malainey <cujomalainey@chromium.org>
Link: https://lore.kernel.org/r/20230816160252.23396-3-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 7f018db1 16-Aug-2023 Takashi Iwai <tiwai@suse.de>

ALSA: core: Introduce snd_device_alloc()

Introduce a new helper, snd_device_alloc(), for allocating a struct
device that is bound with the sound class. It's a replacement of
snd_device_initialize().

Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Tested-by: Curtis Malainey <cujomalainey@chromium.org>
Link: https://lore.kernel.org/r/20230816160252.23396-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 8d0cf150 20-Jun-2023 Ivan Orlov <ivan.orlov0322@gmail.com>

sound: make all 'class' structures const

Now that the driver core allows for struct class to be in read-only
memory, making all 'class' structures to be declared at build time
placing them into read-only memory, instead of having to be dynamically
allocated at load time.

Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: Ivan Orlov <ivan.orlov0322@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Geoff Levand <geoff@infradead.org>
Cc: Thierry Reding <treding@nvidia.com>
Cc: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: alsa-devel@alsa-project.org
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ivan Orlov <ivan.orlov0322@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20230620175633.641141-2-gregkh@linuxfoundation.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 37bb927d 28-Apr-2023 Oswald Buddenhagen <oswald.buddenhagen@gmx.de>

ALSA: core: update comment on snd_card.controls_rwsem

Since commit 5bbb1ab5bd ("control: use counting semaphore as write lock
for ELEM_WRITE operation"), this has been locking the controls including
their values, not just the list of controls.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230428095941.1706278-6-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 25a5a77a 07-Feb-2023 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

ALSA: core: Make snd_card_free() return void

The function returns 0 unconditionally. Make it return void instead and
simplify all callers accordingly.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Acked-by: Geoff Levand <geoff@infradead.org>
Acked-by: Thierry Reding <treding@nvidia.com>
Link: https://lore.kernel.org/r/20230207191907.467756-4-u.kleine-koenig@pengutronix.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 73c5685c 07-Feb-2023 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

ALSA: core: Make snd_card_free_when_closed() return void

All callers from other files ignore the return value of this function.
And it can only ever return a non-zero value if the parameter card is NULL.

This cannot happen in snd_card_free() as card was dereferenced just before
snd_card_free_when_closed() is called. So the error handling can be dropped
there.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Acked-by: Geoff Levand <geoff@infradead.org>
Acked-by: Thierry Reding <treding@nvidia.com>
Link: https://lore.kernel.org/r/20230207191907.467756-3-u.kleine-koenig@pengutronix.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 663f922f 07-Feb-2023 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

ALSA: core: Make snd_card_disconnect() return void

All callers from other files ignore the return value of this function.
And it can only ever return a non-zero value if the parameter card is NULL.

Move the check for card being NULL into snd_card_free_when_closed() to keep
the previous behaviour. Note this isn't necessary for
snd_card_disconnect_sync() because if card was NULL in there the dereference
of card for dev_err() would oops the kernel. Replace this by an oops
triggered by the dereference of card for spin_lock_irq().

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Acked-by: Geoff Levand <geoff@infradead.org>
Acked-by: Thierry Reding <treding@nvidia.com>
Link: https://lore.kernel.org/r/20230207191907.467756-2-u.kleine-koenig@pengutronix.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# ef34a0ae 28-Jul-2022 Takashi Iwai <tiwai@suse.de>

ALSA: core: Add async signal helpers

Currently the call of kill_fasync() from an interrupt handler might
lead to potential spin deadlocks, as spotted by syzkaller.
Unfortunately, it's not so trivial to fix this lock chain as it's
involved with the tasklist_lock that is touched in allover places.

As a temporary workaround, this patch provides the way to defer the
async signal notification in a work. The new helper functions,
snd_fasync_helper() and snd_kill_faync() are replacements for
fasync_helper() and kill_fasync(), respectively. In addition,
snd_fasync_free() needs to be called at the destructor of the relevant
file object.

Link: https://lore.kernel.org/r/20220728125945.29533-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# c27e1efb 10-Jun-2022 Takashi Iwai <tiwai@suse.de>

ALSA: control: Use xarray for faster lookups

The control elements are managed in a single linked list and we
traverse the whole list for matching each numid or ctl id per every
inquiry of a control element. This is OK-ish for a small number of
elements but obviously it doesn't scale. Especially the matching with
the ctl id takes time because it checks each field of the snd_ctl_id
element, e.g. the name string is matched with strcmp().

This patch adds the hash tables with Xarray for improving the lookup
speed of a control element. There are two xarray tables added to the
card; one for numid and another for ctl id. For the numid, we use the
numid as the index, while for the ctl id, we calculate a hash key.

The lookup is done via a single xa_load() execution. As long as the
given control element is found on the Xarray table, that's fine, we
can give back a quick lookup result. The problem is when no entry
hits on the table, and for this case, we have a slight optimization.
Namely, the driver checks whether we had a collision on Xarray table,
and do a fallback search (linear lookup of the full entries) only if a
hash key collision happened beforehand.
So, in theory, the inquiry for a non-existing element might take still
time even with this patch in a worst case, but this must be pretty
rare.

The feature is enabled via CONFIG_SND_CTL_FAST_LOOKUP, which is turned
on as default. For simplicity, the option can be turned off only when
CONFIG_EXPERT is set ("You are expert? Then you manage 1000 knobs").

Link: https://lore.kernel.org/r/20211028130027.18764-1-tiwai@suse.de
Link: https://lore.kernel.org/r/20220609180504.775-1-tiwai@suse.de
Link: https://lore.kernel.org/all/cover.1653813866.git.quic_rbankapu@quicinc.com/
Link: https://lore.kernel.org/r/20220610064537.18660-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# fee2b871 12-Apr-2022 Takashi Iwai <tiwai@suse.de>

ALSA: core: Add snd_card_free_on_error() helper

This is a small helper function to handle the error path more easily
when an error happens during the probe for the device with the
device-managed card. Since devres releases in the reverser order of
the creations, usually snd_card_free() gets called at the last in the
probe error path unless it already reached snd_card_register() calls.
Due to this nature, when a driver expects the resource releases in
card->private_free, this might be called too lately.

As a workaround, one should call the probe like:

static int __some_probe(...) { // do real probe.... }

static int some_probe(...)
{
return snd_card_free_on_error(dev, __some_probe(dev, ...));
}

so that the snd_card_free() is called explicitly at the beginning of
the error path from the probe.

This function will be used in the upcoming fixes to address the
regressions by devres usages.

Fixes: e8ad415b7a55 ("ALSA: core: Add managed card creation")
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20220412093141.8008-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# c2b94954 15-Jul-2021 Takashi Iwai <tiwai@suse.de>

ALSA: core: Add device-managed request_dma()

This patch adds a devres-supported helper for requesting an ISA DMA
channel that will be automatically freed at the device unbinding.
It'll be used by quite a few ISA sound drivers.

Link: https://lore.kernel.org/r/20210715075941.23332-4-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# e8ad415b 15-Jul-2021 Takashi Iwai <tiwai@suse.de>

ALSA: core: Add managed card creation

As a second step for preliminary to widen the devres usages among
sound drivers, this patch adds a new ALSA core API function,
snd_devm_card_new(), to create a snd_card object via devres.
When a card object is created by this new function, snd_card_free() is
called automatically and the card object resource gets released at the
device unbinding time.

However, the story isn't that simple. A caveat is that we have to
call snd_card_free() at the very first of the whole resource release
procedure, in order to assure that the all exposed devices on
user-space are deleted and sync with processes accessing those devices
before releasing resources.

For achieving it, snd_card_register() adds a new devres action to
trigger snd_card_free() automatically when the given card object is a
"managed" one. Since usually snd_card_register() is the last step of
the initialization, this should work in most cases.

With all these tricks, some drivers can get rid of the whole driver
remove callback code.

About a bit of implementation details: the patch adds two new flags to
snd_card object: managed and releasing. The former indicates that the
object was created via snd_devm_card_new(), and the latter is used for
avoiding the double-free of snd_card_free() calls. Both flags are
fairly internal and likely uninteresting to normal users.

Link: https://lore.kernel.org/r/20210715075941.23332-3-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# b6cc78da 23-May-2021 Takashi Iwai <tiwai@suse.de>

ALSA: Drop superfluous argument from snd_power_wait()

The power_state argument of snd_power_wait() is superfluous, receiving
only SNDRV_POWER_STATE_D0. Let's drop it in all callers for
simplicity.

Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20210523090920.15345-6-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# e94fdbd7 23-May-2021 Takashi Iwai <tiwai@suse.de>

ALSA: control: Track in-flight control read/write/tlv accesses

Although the power state check is performed in various places (e.g. at
the entrance of quite a few ioctls), there can be still some pending
tasks that already went into the ioctl handler or other ops, and those
may access the hardware even after the power state check. For
example, kcontrol access ioctl paths that call info/get/put callbacks
may update the hardware registers. If a system wants to assure the
free from such hw access (like the case of PCI rescan feature we're
going to implement in future), this situation must be avoided, and we
have to sync such in-flight tasks finishing beforehand.

For that purpose, this patch introduces a few new things in core code:
- A refcount, power_ref, and a wait queue, power_ref_sleep, to the
card object
- A few new helpers, snd_power_ref(), snd_power_unref(),
snd_power_ref_and_wait(), and snd_power_sync_ref()

In the code paths that call kctl info/read/write/tlv ops, we check the
power state with the newly introduced snd_power_ref_and_wait(). This
function also takes the card.power_ref refcount for tracking this
in-flight task. Once after the access finishes, snd_power_unref() is
called to released the refcount in return. So the driver can sync via
snd_power_sync_ref() assuring that all in-flight tasks have been
finished.

As of this patch, snd_power_sync_ref() is called only at
snd_card_disconnect(), but it'll be used in other places in future.

Note that atomic_t is used for power_ref intentionally instead of
refcount_t. It's because of the design of refcount_t type; refcount_t
cannot be zero-based, and it cannot do dec_and_test() call for
multiple times, hence it's not suitable for our purpose.

Also, this patch changes snd_power_wait() to accept only
SNDRV_CTL_POWER_D0, which is the only value that makes sense.
In later patch, the snd_power_wait() calls will be cleaned up.

Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20210523090920.15345-3-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 533a7ed9 23-May-2021 Takashi Iwai <tiwai@suse.de>

ALSA: core: Use READ_ONCE() / WRITE_ONCE() for power state change

We need proper barriers to handle the power state change of the card
from different CPUs.

Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20210523090920.15345-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 66c6d1ef 08-Apr-2021 Takashi Sakamoto <o-takashi@sakamocchi.jp>

ALSA: control: Add memory consumption limit to user controls

ALSA control interface allows users to add arbitrary control elements
(called "user controls" or "user elements"), and its resource usage is
limited just by the max number of control sets (currently 32). This
limit, however, is quite loose: each allocation of control set may
have 1028 elements, and each element may have up to 512 bytes (ILP32) or
1024 bytes (LP64) of value data. Moreover, each control set may contain
the enum strings and TLV data, which can be up to 64kB and 128kB,
respectively. Totally, the whole memory consumption may go over 38MB --
it's quite large, and we'd rather like to reduce the size.

OTOH, there have been other requests even to increase the max number
of user elements; e.g. ALSA firewire stack require the more user
controls, hence we want to raise the bar, too.

For satisfying both requirements, this patch changes the management of
user controls: instead of setting the upper limit of the number of
user controls, we check the actual memory allocation size and set the
upper limit of the total allocation in bytes. As long as the memory
consumption stays below the limit, more user controls are allowed than
the current limit 32. At the same time, we set the lower limit (8MB)
as default than the current theoretical limit, in order to lower the
risk of DoS.

As a compromise for lowering the default limit, now the actual memory
limit is defined as a module option, 'max_user_ctl_alloc_size', so that
user can increase/decrease the limit if really needed, too.

Link: https://lore.kernel.org/r/s5htur3zl5e.wl-tiwai@suse.de
Co-developed-by: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Tested-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210408103149.40357-1-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 2d670ea2 27-Jan-2021 Hui Wang <hui.wang@canonical.com>

ALSA: jack: implement software jack injection via debugfs

This change adds audio jack injection feature through debugfs, with
this feature, we could validate alsa userspace changes by injecting
plugin or plugout events to the non-phantom audio jacks.

With this change, the sound core will build the folders
$debugfs_mount_dir/sound/cardN if SND_DEBUG and DEBUG_FS are enabled.
And if users also enable the SND_JACK_INJECTION_DEBUG, the jack
injection nodes will be built in the folder cardN like below:

$tree $debugfs_mount_dir/sound
$debugfs_mount_dir/sound
├── card0
│   ├── HDMI_DP_pcm_10_Jack
│   │   ├── jackin_inject
│   │   ├── kctl_id
│   │   ├── mask_bits
│   │   ├── status
│   │   ├── sw_inject_enable
│   │   └── type
...
│   └── HDMI_DP_pcm_9_Jack
│   ├── jackin_inject
│   ├── kctl_id
│   ├── mask_bits
│   ├── status
│   ├── sw_inject_enable
│   └── type
└── card1
├── HDMI_DP_pcm_5_Jack
│   ├── jackin_inject
│   ├── kctl_id
│   ├── mask_bits
│   ├── status
│   ├── sw_inject_enable
│   └── type
...
├── Headphone_Jack
│   ├── jackin_inject
│   ├── kctl_id
│   ├── mask_bits
│   ├── status
│   ├── sw_inject_enable
│   └── type
└── Headset_Mic_Jack
├── jackin_inject
├── kctl_id
├── mask_bits
├── status
├── sw_inject_enable
└── type

The nodes kctl_id, mask_bits, status and type are read-only, users
could check jack or jack_kctl's information through them.

The nodes sw_inject_enable and jackin_inject are directly used for
injection. The sw_inject_enable is read-write, users could check if
software injection is enabled or not on this jack, and users could
echo 1 or 0 to enable or disable software injection on this jack. Once
the injection is enabled, the jack will not change by hardware events
anymore, once the injection is disabled, the jack will restore the
last reported hardware events to the jack. The jackin_inject is
write-only, if the injection is enabled, users could echo 1 or 0 to
this node to inject plugin or plugout events to this jack.

For the detailed usage information on these nodes, please refer to
Documentation/sound/designs/jack-injection.rst.

Reviewed-by: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Link: https://lore.kernel.org/r/20210127085639.74954-2-hui.wang@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# f7b6603c 23-Oct-2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

ALSA: fix kernel-doc markups

Kernel-doc markups should use this format:
identifier - description

There is a common comment marked, instead, with kernel-doc
notation.

Some identifiers have different names between their prototypes
and the kernel-doc markup.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/535182d6f55d7a7de293dda9676df68f5f60afc6.1603469755.git.mchehab+huawei@kernel.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# c208a533 23-Mar-2020 Takashi Iwai <tiwai@suse.de>

ALSA: core: Add snd_device_get_state() helper

A new small helper to get the current state of the device registration
for the given object. It'll be used for USB-audio driver to check the
delayed device registrations.

Link: https://lore.kernel.org/r/20200323170643.19181-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# d4cfb30f 20-Jan-2020 Takashi Iwai <tiwai@suse.de>

ALSA: pcm: Set per-card upper limit of PCM buffer allocations

Currently, the available buffer allocation size for a PCM stream
depends on the preallocated size; when a buffer has been preallocated,
the max buffer size is set to that size, so that application won't
re-allocate too much memory. OTOH, when no preallocation is done,
each substream may allocate arbitrary size of buffers as long as
snd_pcm_hardware.buffer_bytes_max allows -- which can be quite high,
HD-audio sets 1GB there.

It means that the system may consume a high amount of pages for PCM
buffers, and they are pinned and never swapped out. This can lead to
OOM easily.

For avoiding such a situation, this patch adds the upper limit per
card. Each snd_pcm_lib_malloc_pages() and _free_pages() calls are
tracked and it will return an error if the total amount of buffers
goes over the defined upper limit. The default value is set to 32MB,
which should be really large enough for usual operations.

If larger buffers are needed for any specific usage, it can be
adjusted (also dynamically) via snd_pcm.max_alloc_per_card option.
Setting zero there means no chceck is performed, and again, unlimited
amount of buffers are allowed.

Link: https://lore.kernel.org/r/20200120124423.11862-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 8b575824 03-Jan-2020 Takashi Iwai <tiwai@suse.de>

ALSA: core: Treat snd_device_ops as const

This is a preliminary patch to allow const for snd_device_ops
definitions in each driver's code. The ops reference is read-only,
hence it can be declared as const for further optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-4-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# fabb26dc 17-Nov-2019 Takashi Iwai <tiwai@suse.de>

ALSA: pcm: Add card sync_irq field

Many PCI and other drivers performs snd_pcm_period_elapsed() simply in
its interrupt handler, so the sync_stop operation is just to call
synchronize_irq(). Instead of putting this call multiple times,
introduce the common card->sync_irq field. When this field is set,
PCM core performs synchronize_irq() for sync-stop operation. Each
driver just needs to copy its local IRQ number to card->sync_irq, and
that's all we need.

Link: https://lore.kernel.org/r/20191117085308.23915-8-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 1a59d1b8 27-May-2019 Thomas Gleixner <tglx@linutronix.de>

treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156

Based on 1 normalized pattern(s):

this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license as published by
the free software foundation either version 2 of the license or at
your option any later version this program is distributed in the
hope that it will be useful but without any warranty without even
the implied warranty of merchantability or fitness for a particular
purpose see the gnu general public license for more details you
should have received a copy of the gnu general public license along
with this program if not write to the free software foundation inc
59 temple place suite 330 boston ma 02111 1307 usa

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-or-later

has been chosen to replace the boilerplate/reference in 1334 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Allison Randal <allison@lohutok.net>
Reviewed-by: Richard Fontana <rfontana@redhat.com>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190527070033.113240726@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# f4fa9689 16-Apr-2019 Takashi Iwai <tiwai@suse.de>

ALSA: core: Don't refer to snd_cards array directly

The snd_cards[] array holds the card pointers that have been currently
registered, and it's exported for the external modules that may need
to refer a card object. But accessing to this array can be racy
against the driver probe or removal, as the card registration or free
may happen concurrently.

This patch gets rid of the direct access to snd_cards[] array and
provides a helper function to give the card object from the index
number with a refcount management. Then the caller can access to the
given card object safely, and releases it via snd_card_unref().

While we're at it, add a proper comment to snd_card_unref() and make
it an inlined function for type-safety, too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 29b2625f 05-Feb-2019 Takashi Iwai <tiwai@suse.de>

ALSA: info: Move card id proc creation into info.c

The creation of card's id proc file can be moved gracefully into
info.c. Also, the assignment of card->proc_id is superfluous and can
be dropped. So let's do it.

Basically this is no functional change but code refactoring, but one
potential behavior change is that now it returns properly the error
code from snd_info_card_register(), which is a good thing (tm).

Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# dc82e524 15-May-2018 Takashi Iwai <tiwai@suse.de>

ALSA: core: Assure control device to be registered at last

The commit 289ca025ee1d ("ALSA: Use priority list for managing device
list") changed the way to register/disconnect/free devices via a
single priority list. This helped to make behavior consistent, but it
also changed a slight behavior change: namely, the control device is
registered earlier than others, while it was supposed to be the very
last one.

I've put SNDRV_DEV_CONTROL in the current position as the release of
ctl elements often conflict with the private ctl elements some PCM or
other components may create, which often leads to a double-free.
But, the order of register and disconnect should be indeed fixed as
expected in the early days: the control device gets registered at
last, and disconnected at first.

This patch changes the priority list order to move SNDRV_DEV_CONTROL
as the last guy to assure the register / disconnect order. Meanwhile,
for keeping the messy resource release order, manually treat the
control and lowlevel devices as last freed one.

Additional note:
The lowlevel device is the device where a card driver creates at
probe. And, we still keep the release order control -> lowlevel, as
there might be link from a control element back to a lowlevel object.

Fixes: 289ca025ee1d ("ALSA: Use priority list for managing device list")
Reported-by: Tzung-Bi Shih <tzungbi@google.com>
Tested-by: Tzung-Bi Shih <tzungbi@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# c44027c8 11-Oct-2017 Takashi Iwai <tiwai@suse.de>

ALSA: add snd_card_disconnect_sync()

In case of user unbind ALSA driver during playing back / capturing,
each driver needs to stop and remove it correctly. One note here is
that we can't cancel from remove function in such case, because
unbind operation doesn't check return value from remove function.
So, we *must* stop and remove in this case.

For this purpose, we need to sync (= wait) until the all top-level
operations are canceled at remove function.
For example, snd_card_free() processes the disconnection procedure at
first, then waits for the completion. That's how the hot-unplug works
safely. It's implemented, at least, in the top-level driver removal.

Now for the lower level driver, we need a similar strategy. Notify to
the toplevel for hot-unplug (disconnect in ALSA), and sync with the
stop operation, then continue the rest of its own remove procedure.

This patch adds snd_card_disconnect_sync(), and driver can use it from
remove function.

Note: the "lower level" driver here refers to a middle layer driver
(e.g. ASoC components) that can be unbound freely during operation.
Most of legacy ALSA helper drivers don't have such a problem because
they can't be unbound.

Note#2: snd_card_disconnect_sync() merely calls snd_card_disconnect()
and syncs with closing all pending files. It takes only the files
opened by user-space into account, and doesn't care about object
refcounts. (The latter is handled by snd_card_free() completion call,
BTW.) Also, the function doesn't free resources by itself.

Tested-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 7d8e8292 30-Aug-2017 Takashi Iwai <tiwai@suse.de>

ALSA: Get rid of card power_lock

Currently we're taking power_lock at each card component for assuring
the power-up sequence, but it doesn't help anything in the
implementation at the moment: it just serializes unnecessarily the
callers, but it doesn't protect about the power state change itself.
It used to have some usefulness in the early days where we managed the
PM manually. But now the suspend/resume core procedure is beyond our
hands, and power_lock lost its meaning.

This patch drops the power_lock from allover the places.
There shouldn't be any issues by this change, as it's no helper
regarding the power state change. Rather we'll get better performance
by removing the serialization; which is the only slight concern of any
behavior change, but it can't be a showstopper, after all.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 30d8340b 03-Aug-2017 Takashi Sakamoto <o-takashi@sakamocchi.jp>

ALSA: control: obsolete user_ctl_lock

At a previous commit, concurrent requests for TLV data are maintained
exclusively between read requests and write/command requests. TLV
callback handlers in each driver has no risk from concurrent access for
reference/change.

In current implementation, 'struct snd_card' has a mutex to control
concurrent accesses to user-defined element sets. This commit obsoletes it.

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


# 6d2412b8 12-May-2017 Takashi Iwai <tiwai@suse.de>

ALSA: Use IS_ENABLED() in common headers

Simplify the ifdef conditions with IS_ENABLED() macro in the common
sound headers. No functional changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 43e575fa 14-Nov-2016 Takashi Iwai <tiwai@suse.de>

ALSA: core: Fix kernel-doc warnings

Several lines in sound/core.h get the kernel-doc warnings like

./include/sound/core.h:323: warning: No description found for parameter '...'

where we use define like foo(x, args...) and "args" isn't mentioned in
the comments. As an easy workaround, use simple __VA_ARGS__ for VLA
in macros.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# de65360b 22-Dec-2015 Heiner Kallweit <hkallweit1@gmail.com>

ALSA: hda_intel: add card number to irq description

Currently the info in /proc/interrupts doesn't allow to figure out which
interrupt belongs to which card (HDMI, PCH, ..).
Therefore add card details to the interrupt description.
With the patch the info in /proc/interrupts looks like this:

PCI-MSI 442368-edge snd_hda_intel:card1
PCI-MSI 49152-edge snd_hda_intel:card0

NOTE: this patch adds the new irq_descr field snd_card struct that is
filled automatically at a card object creation. This can be used
generically for other drivers as well. The changes for others will
follow later -- tiwai

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# b046d244 22-Apr-2015 Takashi Iwai <tiwai@suse.de>

ALSA: core: Remove superfluous exit calls for proc entries

Since each proc entry is freed automatically by the parent, we don't
have to take care of its life cycle any longer. This allows us to
reduce a few more lines of codes.

Acked-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# e086e303 27-Feb-2015 Takashi Iwai <tiwai@suse.de>

ALSA: core: Re-add snd_device_disconnect()

Revive snd_device_disconnect() again so that it can be called from the
individual driver. This time, HD-audio will need it.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 6bbc7fed 29-Jan-2015 Takashi Iwai <tiwai@suse.de>

ALSA: Add a helper to add a new attribute group to card

For assigning sysfs entries for a card device from the driver,
introduce a new helper function, snd_card_add_dev_attr(). In this
way, we can avoid the possible race between the device registration
and the sysfs addition / removal.

The driver can pass a new attribute group to add freely. This has to
be called before snd_card_register().

Currently, up to two extra groups can be added. More than that, it'll
return an error.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 830953c0 30-Jan-2015 Takashi Iwai <tiwai@suse.de>

ALSA: Drop snd_get_device() helper

Since the device is no longer hidden but embedded into each component,
we no longer need snd_get_device(). Let's drop it and relevant codes.

Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 40a4b263 30-Jan-2015 Takashi Iwai <tiwai@suse.de>

ALSA: Simplify snd_device_register() variants

Now that all callers have been replaced with
snd_device_register_for_dev(), let's drop the obsolete device
registration code and concentrate only on the code handling struct
device directly. That said,

- remove the old snd_device_register(),
- rename snd_device_register_for_dev() with snd_device_register(),
- drop superfluous arguments from snd_device_register(),
- change snd_unregister_device() to pass the device pointer directly

Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 0fcd9f4b 29-Jan-2015 Takashi Iwai <tiwai@suse.de>

ALSA: control: Embed struct device

This patch embeds a struct device for the control device into the card
object and avoid the device creation at registration time.

Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 4b440be6 29-Jan-2015 Takashi Iwai <tiwai@suse.de>

ALSA: Add a helper to initialize device

Introduce a new helper function snd_device_initialize() to initialize
the device object for sound devices.

Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 92b7952d 29-Jan-2015 Takashi Iwai <tiwai@suse.de>

ALSA: Allow to pass the device object to snd_register_device*()

This is a preliminary patch for the further work on embedding struct
device into each sound device instance. It changes
snd_register_device*() helpers to receive the device object directly
for skipping creating a device there.

Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 07f4d9d7 18-Jun-2014 Lars-Peter Clausen <lars@metafoo.de>

ALSA: control: Protect user controls against concurrent access

The user-control put and get handlers as well as the tlv do not protect against
concurrent access from multiple threads. Since the state of the control is not
updated atomically it is possible that either two write operations or a write
and a read operation race against each other. Both can lead to arbitrary memory
disclosure. This patch introduces a new lock that protects user-controls from
concurrent access. Since applications typically access controls sequentially
than in parallel a single lock per card should be fine.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Jaroslav Kysela <perex@perex.cz>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 038b8455 23-May-2014 Takashi Iwai <tiwai@suse.de>

ALSA: Remove deprecated snd_card_create()

Now all calls have been fixed, let's get rid of the old definition.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# f0a220de 28-Feb-2014 Dylan Reid <dgreid@chromium.org>

ALSA: core - Define snd_pci_quirk without CONFIG_PCI

The hda codecs all use this struct and, with an HDA platform driver,
will be able to be built without PCI.

Signed-off-by: Dylan Reid <dgreid@chromium.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 72620d60 04-Feb-2014 Takashi Iwai <tiwai@suse.de>

ALSA: Clean up snd_device_*() codes

A few code cleanups and optimizations. In addition, drop
snd_device_disconnect() that isn't used at all, and drop the return
values from snd_device_free*().

Another slight difference by this change is that now the device state
will become always SNDRV_DEV_REGISTERED no matter whether dev_register
ops is present or not. It's for better consistency. There should be
no impact for the current tree, as the state isn't checked.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 289ca025 29-Jan-2014 Takashi Iwai <tiwai@suse.de>

ALSA: Use priority list for managing device list

Basically, the device type specifies the priority of the device to be
registered / freed, too. However, the priority value isn't well
utilized but only it's checked as a group. This results in
inconsistent register and free order (where each of them should be in
reversed direction).

This patch simplifies the device list management code by simply
inserting a list entry at creation time in an incremental order for
the priority value. Since we can just follow the link for register,
disconnect and free calls, we don't have to specify the group; so the
whole enum definitions are also simplified as well.

The visible change to outside is that the priorities of some object
types are revisited. For example, now the SNDRV_DEV_LOWLEVEL object
is registered before others (control, PCM, etc) and, in return,
released after others. Similarly, SNDRV_DEV_CODEC is in a lower
priority than SNDRV_DEV_BUS for ensuring the dependency.

Also, the unused SNDRV_DEV_TOPLEVEL, SNDRV_DEV_LOWLEVEL_PRE and
SNDRV_DEV_LOWLEVEL_NORMAL are removed as a cleanup.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# caa751ba 25-Feb-2014 Takashi Iwai <tiwai@suse.de>

ALSA: Create sysfs attribute files via groups

Instead of calling each time device_create_file(), create the groups
of sysfs attribute files at once in a normal way. Add a new helper
function, snd_get_device(), to return the associated device object,
so that we can handle the sysfs addition locally.

Since the sysfs file addition is done differently now,
snd_add_device_sysfs_file() helper function is removed.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 9ce50543 29-Jan-2014 Takashi Iwai <tiwai@suse.de>

ALSA: Drop __bitwise and typedefs for snd_device attributes

Using __bitwise and typedefs for the attributes of snd_device struct
isn't so useful, and rather it worsens the readability. Let's drop
them and use the straightforward enum.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# f2464064 28-Jan-2014 Takashi Iwai <tiwai@suse.de>

ALSA: Use standard device refcount for card accounting

Drop the own refcount but use the standard device refcounting via
get_device() and put_device(). Introduce a new completion to snd_card
instead of the wait queue for syncing the last release, which is used
in snd_card_free().

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 8bfb181c 29-Jan-2014 Takashi Iwai <tiwai@suse.de>

ALSA: Embed card device into struct snd_card

As prepared in the previous patch, we are ready to create a device
struct for the card object in snd_card_create() now. This patch
changes the scheme from the old style to:

- embed a device struct for the card object into snd_card struct,
- initialize the card device in snd_card_create() (but not register),
- registration is done in snd_card_register() via device_add()

The actual card device is stored in card->card_dev. The card->dev
pointer is kept unchanged and pointing to the parent device as before
for compatibility reason.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 393aa9c1 28-Jan-2014 Takashi Iwai <tiwai@suse.de>

ALSA: Mandate to pass a device pointer at card creation time

This is a part of preliminary works for modernizing the ALSA device
structure. So far, we set card->dev at later point after the object
creation. Because of this, the core layer doesn't always know which
device is being handled before it's actually registered, and it makes
impossible to show the device in error messages, for example. The
first goal is to achieve a proper struct device initialization at the
very beginning of probing.

As a first step, this patch introduces snd_card_new() function (yes
there was the same named function in the very past), in order to
receive the parent device pointer from the very beginning.
snd_card_create() is marked as deprecated.

At this point, there is no functional change other than that. The
actual change of the device creation scheme will follow later.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 80d7d771 04-Feb-2014 Takashi Iwai <tiwai@suse.de>

ALSA: Drop unused name argument in snd_register_oss_device()

The last argument, name, of snd_oss_register_device() is nowhere
referred in the function in the current code. Let's drop it.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# bcbb1553 16-Aug-2013 Tim Gardner <tim.gardner@canonical.com>

ALSA: pcm: Add snd_printd_ratelimit()

Direct calls to printk_limit() will emit log noise even when CONFIG_SND_DEBUG is not
defined. Add a wrapper macro around printk_limit() that is conditionally defined by
CONFIG_SND_DEBUG.

Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.de>
Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Yacine Belkadi <yacine.belkadi.1@gmail.com>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 7bb2491b 15-May-2013 Takashi Iwai <tiwai@suse.de>

ALSA: Add kconfig to specify the max card numbers

Currently ALSA supports up to 32 card instances when the dynamic minor
is used. While 32 cards are usually big enough for normal use cases,
there are sometimes weird requirements with more card support.

Actually, this limitation, 32, comes from the index option, where you
can pass the bit mask to assign the card. Other than that, we can
actually give more cards up to the minor number limits (currently 256,
which can be extended more, too).

This patch adds a new Kconfig to specify the max card numbers, and
changes a few places to accept more than 32 cards.

The only incompatibility with high card numbers would be the handling
of index option. The index option can be still used to pass the
bitmask for card assignments, but this works only up to 32 slots.
More than 32, no bitmask style option is available but only a single
slot can be specified via index option.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# eb7c06e8 11-Mar-2013 Yacine Belkadi <yacine.belkadi.1@gmail.com>

ALSA: add/change some comments describing function return values

script/kernel-doc reports the following type of warnings (when run in verbose
mode):

Warning(sound/core/init.c:152): No description found for return value of
'snd_card_create'

To fix that:
- add missing descriptions of function return values
- use "Return:" sections to describe those return values

Along the way:
- complete some descriptions
- fix some typos

Signed-off-by: Yacine Belkadi <yacine.belkadi.1@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# d5702162 04-Mar-2013 Christine Spang <christine.spang@oracle.com>

ALSA: Make snd_BUG_ON() always evaluate and return the conditional expression

Having snd_BUG_ON() only evaluate its conditional when CONFIG_SND_DEBUG
is set leads to frequent bugs, since other similar macros in the kernel
have different behavior. Let's make snd_BUG_ON() act like those macros
so it will stop being accidentally misused.

Signed-off-by: Christine Spang <christine.spang@oracle.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 86b27237 25-Jan-2013 Takashi Iwai <tiwai@suse.de>

ALSA: Make snd_printd() and snd_printdd() inline

Because currently snd_printd() and snd_printdd() macros are expanded
to empty when CONFIG_SND_DEBUG=n, a compile warning like below
appears sometimes, and we had to covert it by ugly ifdefs:
sound/pci/hda/patch_sigmatel.c: In function ‘stac92hd71bxx_fixup_hp’:
sound/pci/hda/patch_sigmatel.c:2434:24: warning: unused variable ‘spec’ [-Wunused-variable]

For "fixing" these issues better, this patch replaces snd_printd() and
snd_printdd() definitions with empty inline functions instead of
macros. This should have the same effect but shut up warnings like
above.

But since we had already put ifdefs, changing to inline functions
would trigger compile errors. So, such ifdefs is removed in this
patch.

In addition, snd_pci_quirk name field is defined only when
CONFIG_SND_DEBUG_VERBOSE is set, and the reference to it in
snd_printdd() argument triggers the build errors, too. For avoiding
these errors, introduce a new macro snd_pci_quirk_name() that is
defined no matter how the debug option is set.

Reported-by: Stratos Karafotis <stratosk@semaphore.gr>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# a0830dbd 16-Oct-2012 Takashi Iwai <tiwai@suse.de>

ALSA: Add a reference counter to card instance

For more strict protection for wild disconnections, a refcount is
introduced to the card instance, and let it up/down when an object is
referred via snd_lookup_*() in the open ops.

The free-after-last-close check is also changed to check this refcount
instead of the empty list, too.

Reported-by: Matthieu CASTET <matthieu.castet@parrot.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# fae3d88a 10-Apr-2012 Fengguang Wu <fengguang.wu@intel.com>

ALSA: hda - hide HDMI/ELD printks unless snd.debug=2

Also remove two warnings when CONFIG_SND_DEBUG is not set:

sound/pci/hda/patch_hdmi.c: In function ‘hdmi_intrinsic_event’:
sound/pci/hda/patch_hdmi.c:761:6: warning: unused variable ‘eldv’ [-Wunused-variable]
sound/pci/hda/patch_hdmi.c:760:6: warning: unused variable ‘pd’ [-Wunused-variable]

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 313162d0 30-Jan-2012 Paul Gortmaker <paul.gortmaker@windriver.com>

device.h: audit and cleanup users in main include dir

The <linux/device.h> header includes a lot of stuff, and
it in turn gets a lot of use just for the basic "struct device"
which appears so often.

Clean up the users as follows:

1) For those headers only needing "struct device" as a pointer
in fcn args, replace the include with exactly that.

2) For headers not really using anything from device.h, simply
delete the include altogether.

3) For headers relying on getting device.h implicitly before
being included themselves, now explicitly include device.h

4) For files in which doing #1 or #2 uncovers an implicit
dependency on some other header, fix by explicitly adding
the required header(s).

Any C files that were implicitly relying on device.h to be
present have already been dealt with in advance.

Total removals from #1 and #2: 51. Total additions coming
from #3: 9. Total other implicit dependencies from #4: 7.

As of 3.3-rc1, there were 110, so a net removal of 42 gives
about a 38% reduction in device.h presence in include/*

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>


# 8422fa11 30-Jan-2012 Axel Lin <axel.lin@gmail.com>

ALSA: Add #ifdef CONFIG_PCI guard for snd_pci_quirk_* functions

This fixes below build warning when CONFIG_PCI is not set.

CC sound/sound_core.o
In file included from sound/sound_core.c:15:
include/sound/core.h:454: warning: 'struct pci_dev' declared inside parameter list
include/sound/core.h:454: warning: its scope is only this definition or declaration, which is probably not what you want

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 3eafc959 22-Dec-2011 Omair Mohammed Abdullah <omair.m.abdullah@intel.com>

ALSA: core: add support for compressed devices

Use the minor numbers 2 and 3 for audio compressed offload devices.
Also add support for these devices in core

Signed-off-by: Omair Mohammed Abdullah <omair.m.abdullah@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
Reviewed-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# b9075fa9 31-Oct-2011 Joe Perches <joe@perches.com>

treewide: use __printf not __attribute__((format(printf,...)))

Standardize the style for compiler based printf format verification.
Standardized the location of __printf too.

Done via script and a little typing.

$ grep -rPl --include=*.[ch] -w "__attribute__" * | \
grep -vP "^(tools|scripts|include/linux/compiler-gcc.h)" | \
xargs perl -n -i -e 'local $/; while (<>) { s/\b__attribute__\s*\(\s*\(\s*format\s*\(\s*printf\s*,\s*(.+)\s*,\s*(.+)\s*\)\s*\)\s*\)/__printf($1, $2)/g ; print; }'

[akpm@linux-foundation.org: revert arch bits]
Signed-off-by: Joe Perches <joe@perches.com>
Cc: "Kirill A. Shutemov" <kirill@shutemov.name>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# de477254 26-May-2011 Paul Gortmaker <paul.gortmaker@windriver.com>

include: replace linux/module.h with "struct module" wherever possible

The <linux/module.h> pretty much brings in the kitchen sink along
with it, so it should be avoided wherever reasonably possible in
terms of being included from other commonly used <linux/something.h>
files, as it results in a measureable increase on compile times.

The worst culprit was probably device.h since it is used everywhere.
This file also had an implicit dependency/usage of mutex.h which was
masked by module.h, and is also fixed here at the same time.

There are over a dozen other headers that simply declare the
struct instead of pulling in the whole file, so follow their lead
and simply make it a few more.

Most of the implicit dependencies on module.h being present by
these headers pulling it in have been now weeded out, so we can
finally make this change with hopefully minimal breakage.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>


# 39aba963 04-Sep-2010 Kay Sievers <kay.sievers@vrfy.org>

driver core: remove CONFIG_SYSFS_DEPRECATED_V2 but keep it for block devices

This patch removes the old CONFIG_SYSFS_DEPRECATED_V2 config option,
but it keeps the logic around to handle block devices in the old manner
as some people like to run new kernel versions on old (pre 2007/2008)
distros.

Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Stephen Hemminger <shemminger@vyatta.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: "James E.J. Bottomley" <James.Bottomley@suse.de>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
Cc: Randy Dunlap <randy.dunlap@oracle.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.de>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: David Howells <dhowells@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 363129ea 16-Oct-2010 Mike Frysinger <vapier@gentoo.org>

ALSA: fix unused warnings with snd_power_get_state

If we compile the ASoC code with PM disabled, we hit stuff like:
sound/soc/soc-dapm.c: In function 'snd_soc_dapm_suspend_check':
sound/soc/soc-dapm.c:440: warning: unused variable 'codec'

So tweak the stub macro to avoid these issues.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# d1458279 14-Jan-2010 Takashi Iwai <tiwai@suse.de>

ALSA: Add snd_pci_quirk_lookup_id()

Added a new function to look up a quirk entry with the given PCI SSID
instead of a pci device pointer. This can be used when the searched ID
is overridden for debugging or such a purpose.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# b8c60ede 07-Sep-2009 Takashi Iwai <tiwai@suse.de>

ALSA: Remove unneeded ifdef from sound/core.h

Remove the old hack that was needed for building alsa-driver modules
externally for old kernels.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 82a783f4 07-Sep-2009 Takashi Iwai <tiwai@suse.de>

ALSA: Remove struct snd_monitor_file from public sound/core.h

The struct snd_monitor_file is used locally only in sound/core/init.c,
thus it should be moved there from the public sound/core.h.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# cf0baf16 27-Aug-2009 Takashi Iwai <tiwai@suse.de>

ALSA: Fixed a typo of printk()

Fixed a silly typo of printk() included in the previous patch...

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 36ce99c1 27-Aug-2009 Takashi Iwai <tiwai@suse.de>

ALSA: Add debug module option

Add debug module option to snd core.
This controls the debug print level. When CONFIG_SND_DEBUG_VERBOSE
is set, you can suppress the debug messages by giving or changing this
parameter to a lower value. debug=0 means no debug messsages.
As default, it's set to the verbose level 2.

Since this option can be changed dynamically via sysfs file, you can
suppress the verbose debug messages on the fly, which wasn't possible
before.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 10a8ebbb 01-Jun-2009 Jaroslav Kysela <perex@perex.cz>

ALSA: Core - add snd_card_set_id() function

Introduce snd_card_set_id() function to allow lowlevel drivers to set
default identification name for card slot. The function checks also
for identification name collisions and tries to create unique name.

Also, the snd_card_create() function is simplified, because this new
function is used. As bonus, proper name collision checks are evaluated
at the card create time.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# cd474f2d 21-Apr-2009 Takashi Iwai <tiwai@suse.de>

ALSA: Remove deprecated snd_card_new()

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 118dd6bf 23-Feb-2009 Takashi Iwai <tiwai@suse.de>

ALSA: Clean up snd_monitor_file management

Use the standard linked list for snd_monitor_file management.
Also, move the list deletion of shutdown_list element into
snd_disconnect_release() (for simplification).

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 8bd4bb7a 30-Jan-2009 Takashi Iwai <tiwai@suse.de>

ALSA: Add subdevice_mask field to quirk entries

Introduced a new field, subdevice_mask, which specifies the bitmask
to match with the given subdevice ID.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 53fb1e63 28-Dec-2008 Takashi Iwai <tiwai@alsa3.local>

ALSA: Introduce snd_card_create()

Introduced snd_card_create() function as a replacement of snd_card_new().
The new function returns a negative error code so that the probe callback
can return the proper error code, while snd_card_new() can give only NULL
check.

The old snd_card_new() is still provided as an inline function but with
__deprecated attribute. It'll be removed soon later.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# f66fcedc 07-Nov-2008 Takashi Iwai <tiwai@suse.de>

ALSA: Document debug macros

Add descriptions of snd_BUG() and snd_BUG_ON().
Also fixed a typo in the comment of snd_printk(), too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 945eed02 07-Nov-2008 Takashi Iwai <tiwai@suse.de>

ALSA: Evaluate condition in snd_BUG_ON() in non-debugging case

Change snd_BUG_ON() to evaluate the given condition, at least, in syntax
for avoiding compile warnings such as unused variables. The compiler
should optimize out the condition evaluation in the real code, though.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# fcef7836 06-Nov-2008 Andrew Morton <akpm@linux-foundation.org>

alsa: fix snd_BUG_on() and friends

sound/pci/pcxhr/pcxhr_core.c: In function 'pcxhr_set_pipe_cmd_params':
sound/pci/pcxhr/pcxhr_core.c:700: warning: statement with no effect
sound/pci/pcxhr/pcxhr_core.c:706: warning: statement with no effect
sound/pci/pcxhr/pcxhr_core.c:710: warning: statement with no effect

Due to

try to fix this, and be more conventional about the empty stubs.

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# ff33f230 07-Oct-2008 Takashi Iwai <tiwai@suse.de>

ALSA: Increase components array size

Increase the card components[] (and thus snd_card_info.components[],
too) array size from 80 to 128 chars so that more strings can be
stored. The 80 chars aren't enough for more than 2 HD-audio codecs,
and this hits an ugly snd_BUG() as reported by Wu Fegguang for HP
2230s.

The control protocol number is increased to 2.0.6 as well, in case
it matters.

Reported-by: Wu Fengguang <wfg@linux.intel.com>
Acked-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>


# 759ee81b 27-Aug-2008 David S. Miller <davem@davemloft.net>

alsa: Remove special SBUS dma support code.

No longer used.

Signed-off-by: David S. Miller <davem@davemloft.net>


# bdbecf50 08-Aug-2008 Takashi Iwai <tiwai@suse.de>

ALSA: Clean up snd_BUG()

Use the standard WARN() macro for snd_BUG().

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>


# 7cc6dffd 08-Aug-2008 Takashi Iwai <tiwai@suse.de>

ALSA: Kill snd_assert() definition

Remove snd_assert() completely now.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>


# 5ef03460 08-Aug-2008 Takashi Iwai <tiwai@suse.de>

ALSA: Introduce snd_BUG_ON() macro

Introduced snd_BUG_ON() macro as a replacement of snd_assert() macro.
snd_assert() is pretty ugly as it has the control flow in its argument.
OTOH, snd_BUG_ON() behaves like a normal conditional, thus it's much
easier to read the flow.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>


# e76d8cea 28-Jul-2008 Mark Brown <broonie@opensource.wolfsonmicro.com>

ALSA: Add jack reporting API

Currently very few systems provide information about jack status to user
space, even though many have hardware facilities to do detection. Those
systems that do use an input device with the existing SW_HEADPHONE_INSERT
switch type to do so, often independently of ALSA.

This patch introduces a standard method for representing jacks to user
space into ALSA. It allows drivers to register jacks for a sound card with
the input subsystem, binding the input device to the card to help user
space associate the input devices with their sound cards. The created
input devices are named in the form "card longname jack" where jack is
provided by the driver when allocating a jack. By default the parent for
the input device is the sound card but this can be overridden by the
card driver.

The existing user space API with SW_HEADPHONE_INSERT is preserved.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>


# 62cf872a 19-May-2008 Takashi Iwai <tiwai@suse.de>

[ALSA] Replace CONFIG_SND_DEBUG_DETECT with CONFIG_SND_DEBUG_VERBOSE

Replace CONFIG_SND_DEBUG_DETECT with CONFIG_SND_DEBUG_VERBOSE to
represent its meaning more better. This config isn't provided only
for the detection but for more verbose debug prints in general.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# ad5fada5 14-Apr-2008 Pavel Machek <pavel@suse.cz>

[ALSA] sound/core.h: evil #ifdefs

snd_minor_info_oss_* is an function returning int _or_ comment,
depending on config parameters. That is truly evil, fix it.

Signed-off-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# edab938e 01-Apr-2008 Pavel Machek <pavel@suse.cz>

[ALSA] fix comments in sound/core.h

Two sentences seem to be spliced into one in comment, fix that and fix
english. Also fix codingstyle.

Signed-off-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 9004acc7 08-Jan-2008 Takashi Iwai <tiwai@suse.de>

[ALSA] Remove sound/driver.h

This header file exists only for some hacks to adapt alsa-driver
tree. It's useless for building in the kernel. Let's move a few
lines in it to sound/core.h and remove it.
With this patch, sound/driver.h isn't removed but has just a single
compile warning to include it. This should be really killed in
future.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>


# c1017a4c 15-Oct-2007 Jaroslav Kysela <perex@perex.cz>

[ALSA] Changed Jaroslav Kysela's e-mail from perex@suse.cz to perex@perex.cz


Signed-off-by: Jaroslav Kysela <perex@perex.cz>


# c2902c8a 09-Feb-2007 Takashi Iwai <tiwai@suse.de>

[PATCH] Fix breakage with CONFIG_SYSFS_DEPRECATED

The fix for sysfs breakage with CONFIG_SYSFS_DEPRECATED was flown
away by the conflicted merge of the ALSA git tree. The patch below
fixes it again.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>


# d9ea472c 24-Nov-2006 Takashi Iwai <tiwai@suse.de>

[ALSA] Add PCI quirk list helper function

Added a helper function snd_pci_quirk_lookup()
to look up PCI SSID quirk list.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>


# 59d6e149 23-Nov-2006 Takashi Iwai <tiwai@suse.de>

[ALSA] Remove obsolete typedefs.h

Removed obsolete typedefs.h. It existes only for backward compatibility,
and now all codes should be free from such typedefs.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>


# 12b131c4 05-Oct-2006 Johannes Berg <johannes@sipsolutions.net>

[ALSA] allow registering an alsa device with struct device pointer

This patch adds snd_register_device_for_dev taking a struct device
pointer to link the new device to and makes snd_register_device a simple
static inline wrapper around it.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>


# 7d2aae1e 25-Jan-2007 Takashi Iwai <tiwai@suse.de>

[PATCH] ALSA: Fix sysfs breakage

The recent change for a new sysfs tree with card* object breaks the
/sys/class/sound tree if CONFIG_SYSFS_DEPRECATED is enabled.
The device in each entry doesn't point the correct device object:

/sys/class/sound
...
|-- pcmC0D0c
| |-- dev
| |-- device -> ../../../class/sound/card0
| |-- pcm_class
| |-- power
| | `-- wakeup
| |-- subsystem -> ../../../class/sound
| `-- uevent

Also, this change breaks some drivers (like sound/arm/*) referring
card->dev directly to obtain the device object for memory handling.

This patch reverts the semantics of card->dev to the former version,
which points to a real device object. The card* object is stored in a
new card->card_dev field, instead. The device parent is chosen either
card->dev or card->card_dev according to CONFIG_SYSFS_DEPRECATED to
keep the tree compatibility.
Also, card* isn't created if CONFIG_SYSFS_DEPRECATED is enabled. The
reason of card* object is a root of all beloing devices, and it makes
little sense if each sound device points to the real device object
directly.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Monty Montgomery <xiphmont@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# d80f19fa 07-Aug-2006 Greg Kroah-Hartman <gregkh@suse.de>

Driver core: convert sound core to use struct device

Converts from using struct "class_device" to "struct device" making
everything show up properly in /sys/devices/ with symlinks from the
/sys/class directory.

It also makes the struct sound_card to show up as a "real" device
where all the different sound class devices are placed as childs
and different card attribute files can hang off of. /sys/class/sound is
still a flat directory, but the symlink targets of all devices belonging
to the same card, point the the /sys/devices tree below the new card
device object.

Thanks to Kay for the updates to this patch.

Signed-off-by: Kay Sievers <kay.sievers@novell.com>
Acked-by: Jaroslav Kysela <perex@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# a9edfc60 06-Oct-2006 Karsten Wiese <fzu@wemgehoertderstaat.de>

[ALSA] Handle file operations during snd_card disconnects using static file->f_op

Alsa used to kmalloc one file->f_op per file per disconnecting snd_card.
This led to oopses sometimes when file->f_op was freed before __fput()
finished.
Patch adds a virtual device for disconnect: VDD.
VDD consists of:
LIST_HEAD(shutdown_files)
protected by DEFINE_SPINLOCK(shutdown_mutex)
static struct file_operations snd_shutdown_f_ops
and functions assigned to it
Additions to struct snd_monitor_file
to specify if instance is hidden by VDD or not.
A VDD's instance is
created in snd_card_disconnect() under the card->files_lock.
cleaned up in snd_card_file_remove() under the card->files_lock.

Signed-off-by: Karsten Wiese <fzu@wemgehoertderstaat.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>


# 9d19f48c 06-Sep-2006 Takashi Iwai <tiwai@suse.de>

[ALSA] Add pcm_class attribute to PCM sysfs entry

This patch adds a new attribute, pcm_class, to each PCM sysfs entry.
It's useful to detect what kind of PCM stream is, for example, HAL
can check whether it's a modem or not.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>


# 2b29b13c 23-Jun-2006 Takashi Iwai <tiwai@suse.de>

[ALSA] Deprecate snd_card_free_in_thread()

Deprecated snd_card_free_in_thread(), replaced with
snd_card_free_when_closed().

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>


# c461482c 23-Jun-2006 Takashi Iwai <tiwai@suse.de>

[ALSA] Unregister device files at disconnection

Orignally proposed by Sam Revitch <sam.revitch@gmail.com>.
Unregister device files at disconnection to avoid the futher accesses.
Also, the dev_unregister callback is removed and replaced with the
combination of disconnect + free.
A new function snd_card_free_when_closed() is introduced, which is
used in USB disconnect callback.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>


# 562b590d 05-Jul-2006 Clemens Ladisch <clemens@ladisch.de>

[ALSA] remove unused snd_minor.name field

Drop the snd_minor structure's name field that was just a helper for
devfs device deregistration.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>


# 746df948 15-May-2006 Takashi Iwai <tiwai@suse.de>

[ALSA] Fix rwlock around snd_iprintf() in sound core

Fixed rwlock around snd_iprintf() in sound core part.
Replaced with mutex.
Also, make mutex and flags static variables with addition of
snd_card_locked() function (just for sound.c).

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 6fdb94bd 02-Apr-2006 Linus Torvalds <torvalds@g5.osdl.org>

Update dummy snd_power_wait() function for new calling convention

Apparently nobody had tried to compile the ALSA CVS tree without power
management enabled.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>


# cbac4b0c 26-Mar-2006 Takashi Iwai <tiwai@suse.de>

[ALSA] Cleanup unused argument for snd_power_wait()

Removed the unused file argument of snd_power_wait().

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 99ac48f5 28-Mar-2006 Arjan van de Ven <arjan@infradead.org>

[PATCH] mark f_ops const in the inode

Mark the f_ops members of inodes as const, as well as fix the
ripple-through this causes by places that copy this f_ops and then "do
stuff" with it.

Signed-off-by: Arjan van de Ven <arjan@infradead.org>
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>


# 1a60d4c5 16-Jan-2006 Ingo Molnar <mingo@elte.hu>

[ALSA] semaphore -> mutex (core part)

Semaphore to mutex conversion.

The conversion was generated via scripts, and the result was validated
automatically via a script as well.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 0863afb3 09-Jan-2006 Martin Waitz <tali@admingilde.org>

[PATCH] DocBook: fix kernel-doc comments

Fix typos in comments to remove kernel-doc warnings.

Signed-off-by: Martin Waitz <tali@admingilde.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>


# 3e23c658 03-Jan-2006 Takashi Iwai <tiwai@suse.de>

[ALSA] Revert the nested-device patch

Modules: ALSA Core

Revert the nested-device patch to keep the compatibility with the
current HAL configuration.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 416c1079 07-Dec-2005 Clemens Ladisch <clemens@ladisch.de>

[ALSA] Nest sound devices

Modules: ALSA Core

Make the control device parent of all other ALSA devices of a card.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>


# f87135f5 20-Nov-2005 Clemens Ladisch <clemens@ladisch.de>

[ALSA] dynamic minors (3/6): store device-specific object pointers dynamically

Instead of storing the pointers to the device-specific structures in an
array, put them into the struct snd_minor, and look them up dynamically.

This makes the device type modules independent of the minor number
encoding.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>


# 6983b724 20-Nov-2005 Clemens Ladisch <clemens@ladisch.de>

[ALSA] dynamic minors (2/6): simplify storage of snd_minor structures

Modules: ALSA Core

Store the snd_minor structure pointers in one array instead of using a
separate list for each card. This simplifies the mapping from device
files to minor struct by removing the need to know about the encoding
of the card number in the minor number.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>


# 2af677fc 20-Nov-2005 Clemens Ladisch <clemens@ladisch.de>

[ALSA] dynamic minors (1/6): store device type in struct snd_minor

Instead of a comment string, store the device type in the snd_minor
structure. This makes snd_minor more flexible, and has the nice side
effect that we don't need anymore to create a separate snd_minor
template for registering a device but can pass the file_operations
directly to snd_register_device().

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>


# a381a7a6 17-Nov-2005 Takashi Iwai <tiwai@suse.de>

[ALSA] Decentralize PM control

Modules: ALSA Core,Control Midlevel,/oss/Makefile

Remove the centralized PM control in the sound core.
Each driver is responsible to get callbacks from bus/driver now.

SND_GENERIC_DRIVER is removed together with this action.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 512bbd6a 17-Nov-2005 Takashi Iwai <tiwai@suse.de>

[ALSA] Remove xxx_t typedefs: Core component

Modules: ALSA Core

Remove xxx_t typedefs from the core component.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# f1902860 24-Oct-2005 Clemens Ladisch <clemens@ladisch.de>

[ALSA] fix improper CONFIG_SND_MAJOR usage

Modules: HWDEP Midlevel,PCM Midlevel,RawMidi Midlevel,ALSA Core

Replace usage of CONFIG_SND_MAJOR with snd_major, where appropriate.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>


# b709e574 11-Oct-2005 Takashi Iwai <tiwai@suse.de>

[ALSA] Add the missing forward declration

Modules: ALSA Core

Added the missing forward declaration before function prototypes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# e38e0cfa 10-Oct-2005 Takashi Iwai <tiwai@suse.de>

[ALSA] Remove kmalloc wrappers

Modules: ALSA Core

Remove kmalloc wrappers.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# b1d5776d 10-Oct-2005 Takashi Iwai <tiwai@suse.de>

[ALSA] Remove vmalloc wrapper, kfree_nocheck()

- Remove vmalloc wrapper
- Add release_and_free_resource() to remove kfree_nocheck() from each driver
and simplify the code

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 93f2e378 10-Oct-2005 Takashi Iwai <tiwai@suse.de>

[ALSA] Make snd_task_name() module local

Modules: ALSA Core,ALSA<-OSS emulation

Remove a global function snd_task_name(), and move it local
to snd-pcm-oss module.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 07799e75 10-Oct-2005 Takashi Iwai <tiwai@suse.de>

[ALSA] Use getnstimeofday()

Modules: Documentation,PCM Midlevel,Timer Midlevel,ALSA Core

Use the standard getnstimeofday() function instead of ALSA's own one.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 7c22f1aa 10-Oct-2005 Takashi Iwai <tiwai@suse.de>

[ALSA] Remove snd_runtime_check() macro

Remove snd_runtime_check() macro.
This macro worsens the readability of codes. They should be either
normal if() or removable asserts.

Also, the assert displays stack-dump, instead of only the last caller
pointer.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# dd0fc66f 07-Oct-2005 Al Viro <viro@ftp.linux.org.uk>

[PATCH] gfp flags annotations - part 1

- added typedef unsigned int __nocast gfp_t;

- replaced __nocast uses for gfp flags with gfp_t - it gives exactly
the same warnings as far as sparse is concerned, doesn't change
generated code (from gcc point of view we replaced unsigned int with
typedef) and documents what's going on far better.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>


# ecbcfe36 05-Sep-2005 Takashi Iwai <tiwai@suse.de>

[ALSA] Introduce snd_card_set_generic_dev()

ALSA Core
A new function snd_card_set_generic_dev() is introduced to add the
'generic device' support for devices without proper bus on sysfs.
It's a last resort, and should be removed in future when they have
a proper bus, instead.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 8db08ea7 06-Sep-2005 Pekka Enberg <penberg@cs.helsinki.fi>

[PATCH] ALSA: convert kcalloc to kzalloc

This patch introduces a memory-leak tracking version of kzalloc for ALSA.

Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: Jaroslav Kysela <perex@suse.cz>
Signed-off-by: Jiri Slaby <xslaby@fi.muni.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>


# 276bd31c 23-Aug-2005 Al Viro <viro@www.linux.org.uk>

[PATCH] Kconfig fix (ISA_DMA_API and sound/*)

fixed kconfig dependencies on ISA_DMA_API for parts of sound/* that rely
on it.

Signed-off-by: Al Viro <viro@parcelfarce.linux.theplanet.co.uk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>


# 5a0f217d 26-Jul-2005 Victor Fusco <victor@cetuc.puc-rio.br>

[ALSA] sound/core Fix the sparse warning 'implicit cast to nocast type'

Memalloc module,ALSA Core,Instrument layer
Fix the sparse warning 'implicit cast to nocast type'

File/Subsystem:sound/core

Signed-off-by: Victor Fusco <victor@cetuc.puc-rio.br>
Signed-off-by: Domen Puncer <domen@coderock.org>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>


# d5750f67 29-Jun-2005 Henrik Kretzschmar <henne@nachtwindheim.de>

[ALSA] cleanup and typo-correction

ALSA Core
This patch changes, adds and remove some comments, which will
make now more sense and fit on a 80-char line. It also changes
the order of snd_power_wait() to make the file more readable.
It removes the device.c comment in front of _snd_minor,
cause snd_minor has nothing to do with device.c.
The both typos in the kernel-docs were corrected too.

Signed-off-by: Henrik Kretzschmar <henne@nachtwindheim.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 543537bd 23-Jun-2005 Paulo Marques <pmarques@grupopie.com>

[PATCH] create a kstrdup library function

This patch creates a new kstrdup library function and changes the "local"
implementations in several places to use this function.

Most of the changes come from the sound and net subsystems. The sound part
had already been acknowledged by Takashi Iwai and the net part by David S.
Miller.

I left UML alone for now because I would need more time to read the code
carefully before making changes there.

Signed-off-by: Paulo Marques <pmarques@grupopie.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>


# 1da177e4 16-Apr-2005 Linus Torvalds <torvalds@ppc970.osdl.org>

Linux-2.6.12-rc2

Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.

Let it rip!