History log of /linux-master/sound/core/sound_oss.c
Revision Date Author Comments
# 742ecf3c 27-Feb-2024 Takashi Iwai <tiwai@suse.de>

ALSA: core: Use guard() for locking

We can simplify the code gracefully with new guard() macro and co for
automatic cleanup of locks.

Only the code refactoring, and no functional changes.

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


# 97d91787 11-Oct-2022 Takashi Iwai <tiwai@suse.de>

ALSA: oss: Fix potential deadlock at unregistration

We took sound_oss_mutex around the calls of unregister_sound_special()
at unregistering OSS devices. This may, however, lead to a deadlock,
because we manage the card release via the card's device object, and
the release may happen at unregister_sound_special() call -- which
will take sound_oss_mutex again in turn.

Although the deadlock might be fixed by relaxing the rawmidi mutex in
the previous commit, it's safer to move unregister_sound_special()
calls themselves out of the sound_oss_mutex, too. The call is
race-safe as the function has a spinlock protection by itself.

Link: https://lore.kernel.org/r/CAB7eexJP7w1B0mVgDF0dQ+gWor7UdkiwPczmL7pn91xx8xpzOA@mail.gmail.com
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20221011070147.7611-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# e3ded899 08-Jun-2021 Takashi Iwai <tiwai@suse.de>

ALSA: core: Fix assignment in if condition

There are a few places doing assignments in if condition in ALSA core
code, which is a bad coding style that may confuse readers and
occasionally lead to bugs.

This patch is merely for coding-style fixes, no functional changes.

Link: https://lore.kernel.org/r/20210608140540.17885-54-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>


# 35f80014 16-Jun-2017 Takashi Iwai <tiwai@suse.de>

ALSA: core: Follow standard EXPORT_SYMBOL() declarations

Just a tidy up to follow the standard EXPORT_SYMBOL*() declarations
in order to improve grep-ability.

- Move EXPORT_SYMBOL*() to the position right after its definition
- Remove superfluous blank line before EXPORT_SYMBOL*() lines

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


# cd6a6503 27-May-2015 Jie Yang <yang.jie@intel.com>

ALSA: replace CONFIG_PROC_FS with CONFIG_SND_PROC_FS

We may disable proc fs only for sound part, to reduce ALSA
memory footprint. So add CONFIG_SND_PROC_FS and replace the
old CONFIG_PROC_FSs in alsa code.

With sound proc fs disabled, we can save about 9KB memory
size on X86_64 platform.

Signed-off-by: Jie Yang <yang.jie@intel.com>
Reviewed-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 85d14318 23-Apr-2015 Takashi Iwai <tiwai@suse.de>

ALSA: core: Build conditionally and remove superfluous ifdefs

Minor cleanups of Makefile to build some codes conditionally so that
a few ifdefs can be reduced.

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


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

ALSA: core: Don't ignore errors at creating proc files

So far we've ignored the errors at creating proc files in many places.
But they should be rather treated seriously.

Also, by assuring the error handling, we can get rid of superfluous
snd_info_free_entry() calls as they will be removed by the parent in
the caller side.

This patch fixes the missing error checks and reduces the superfluous
free calls.

Acked-by: Jaroslav Kysela <perex@perex.cz>
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>


# 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>


# 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>


# 8eeaa2f9 10-Feb-2014 Takashi Iwai <tiwai@suse.de>

ALSA: Replace with IS_ENABLED()

Replace the lengthy #if defined(XXX) || defined(XXX_MODULE) with the
new IS_ENABLED() macro.

The patch still doesn't cover all ifdefs. For example, the dependency
on CONFIG_GAMEPORT is still open-coded because this also has an extra
dependency on MODULE. Similarly, an open-coded ifdef in pcm_oss.c and
some sequencer-related stuff are left untouched.

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


# 8bb4d9ce 08-Nov-2012 Takashi Iwai <tiwai@suse.de>

ALSA: Fix card refcount unbalance

There are uncovered cases whether the card refcount introduced by the
commit a0830dbd isn't properly increased or decreased:
- OSS PCM and mixer success paths
- When lookup function gets NULL

This patch fixes these places.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=50251

Cc: <stable@vger.kernel.org>
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>


# 779ae5a0 08-May-2012 Takashi Iwai <tiwai@suse.de>

ALSA: Fix the card number limit of OSS-emulation

There are left-over codes from the ancient days with the static device
number limitation of 8. Actaully OSS can support up to 16 cards.

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


# d81a6d71 22-Sep-2011 Paul Gortmaker <paul.gortmaker@windriver.com>

sound: Add export.h for THIS_MODULE/EXPORT_SYMBOL where needed

These aren't modules, but they do make use of these macros, so
they will need export.h to get that definition. Previously,
they got it via the implicit module.h inclusion.

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


# 808c569f 18-Jan-2010 Takashi Iwai <tiwai@suse.de>

ALSA: Remove warning message for invalid OSS minor ranges

When a card instance with a higher card number is registered, warning
messages are spewed eventually with stack traces due to the invalid minor
number for OSS device registration. For example, thinkpad-acpi registers
the card number 29 as default, and you'll see always these messages.
This is rather confusing (and worries users), thus better to return
simply the error code.

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


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

ALSA: Kill snd_assert() in sound/core/*

Kill snd_assert() in sound/core/*, either removed or replaced with
if () with snd_BUG_ON().

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


# 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>


# 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>


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

[ALSA] Fix disconnection of proc interface

- Add the linked list to each proc entry to enable a single-shot
disconnection (unregister)
- Deprecate snd_info_unregister(), use snd_info_free_entry()
- Removed NULL checks of snd_info_free_entry()

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


# 6581f4e7 17-May-2006 Takashi Iwai <tiwai@suse.de>

[ALSA] Remove zero-initialization of static variables

Removed zero-initializations of static variables.
A tiny optimization.

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


# bf850204 28-Apr-2006 Takashi Iwai <tiwai@suse.de>

[ALSA] Remove unneeded read/write_size fields in proc text ops

Remove unneeded read/write_size fields in proc text ops.
snd_info_set_text_ops() is fixed, too.

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


# c0d3fb39 28-Apr-2006 Takashi Iwai <tiwai@suse.de>

[ALSA] Clean up EXPORT_SYMBOL()s in snd module

Move EXPORT_SYMBOL()s to places adjacent to functions/variables.

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>


# 3a63e444 13-Mar-2006 Adrian Bunk <bunk@stusta.de>

[ALSA] sound/core/: fix 3 off-by-one errors

Modules: ALSA Core

This patch fixes three off-by-one errors found by the Coverity checker.

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 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>


# e28563cc 01-Dec-2005 Takashi Iwai <tiwai@suse.de>

[ALSA] Optimize for config without PROC_FS

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

Optimize the code when compiled without CONFIG_PROC_FS.

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


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

[ALSA] dynamic minors (6/6): increase maximum number of sound cards

Modules: ALSA Core,Memalloc module,ALSA sequencer

With dynamic minor numbers, we can increase the number of sound cards.

This requires that the sequencer client numbers of some kernel drivers
are allocated dynamically, too.

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>


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

[ALSA] Remove xxx_t typedefs: OSS-emulation

Modules: ALSA Core

Remove xxx_t typedefs from the core OSS-emulation codes.

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


# d568121c 30-Aug-2005 Takashi Iwai <tiwai@suse.de>

[PATCH] Assign device pointer to OSS devices

Add register_sound_special_device() function to allow assignment of
device pointer to a specific OSS device for HAL.

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


# 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!