History log of /linux-master/sound/aoa/soundbus/i2sbus/pcm.c
Revision Date Author Comments
# a707885a 18-Aug-2023 Takashi Iwai <tiwai@suse.de>

ALSA: aoa: Fix typos in PCM fix patch

There was typos in the previous fix for PCM to detach the struct
device that caused build errors. Corrected here.

Fixes: bc41a7228ced ("ALSA: pcm: Don't embed device")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202308181347.q3XPr3Lm-lkp@intel.com/
Link: https://lore.kernel.org/r/20230818070913.23336-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


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

ALSA: pcm: Don't embed device

So far we use the embedded struct device for each PCM substreams in
struct snd_pcm. This may result in UAF when the delayed kobj release
is used; each corresponding struct device is still accessed at the
(delayed) device release, while the snd_pcm object may be already
gone.

As a workaround, detach the struct device from the snd_pcm object by
allocating via the new snd_device_alloc() helper.

A caveat is that we store the PCM substream pointer to drvdata since
the device resume and others require the access to it.

This patch 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-4-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 37d122c5 17-Jun-2021 Zhen Lei <thunder.leizhen@huawei.com>

ALSA: aoa: remove unnecessary oom message

Fixes scripts/checkpatch.pl warning:
WARNING: Possible unnecessary 'out of memory' message

Remove it can help us save a bit of memory.

Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
Link: https://lore.kernel.org/r/20210617102746.1709-1-thunder.leizhen@huawei.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 5656a7a0 02-Sep-2020 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ALSA: aoa: i2sbus: use DECLARE_COMPLETION_ONSTACK() macro

Follow recommendation in Documentation/scheduler/completion.rst and
use macro to declare local 'struct completion'

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200902212133.30964-10-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# f2b44229 09-Dec-2019 Takashi Iwai <tiwai@suse.de>

ALSA: aoa: Drop superfluous ioctl PCM ops

PCM core deals the empty ioctl field now as default(*).
Let's kill the redundant lines.

(*) commit fc033cbf6fb7 ("ALSA: pcm: Allow NULL ioctl ops")

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


# 9b2433a9 09-Dec-2019 Takashi Iwai <tiwai@suse.de>

ALSA: aoa: Use managed buffer allocation

Clean up the driver with the new managed buffer allocation API.
The hw_params callbacks became superfluous and got dropped.

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


# 3ca5fc06 05-Nov-2019 Takashi Iwai <tiwai@suse.de>

ALSA: aoa: Avoid non-standard macro usage

Pass the device pointer from the PCI pointer directly, instead of a
non-standard macro. The macro didn't give any better readability.

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


# d6869352 02-Jun-2019 Thomas Gleixner <tglx@linutronix.de>

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

Based on 1 normalized pattern(s):

gpl v2 can be found in copying

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-only

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

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Allison Randal <allison@lohutok.net>
Reviewed-by: Alexios Zavras <alexios.zavras@intel.com>
Reviewed-by: Enrico Weigelt <info@metux.net>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190602204655.283615864@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 18f6dda9 18-Aug-2017 Arvind Yadav <arvind.yadav.cs@gmail.com>

ALSA: aoa: constify snd_pcm_ops structures

snd_pcm_ops are not supposed to change at runtime. All functions
working with snd_pcm_ops provided by <sound/pcm.h> work with
const snd_pcm_ops. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


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

ALSA: pcm: Embed struct device

Like previous patches, at this time we embed the struct device into
PCM object. However, this needs a bit more caution: struct snd_pcm
doesn't own one device but two, for both playback and capture! Thus
not struct snd_pcm but struct snd_pcm_str object contains the device.

Along with this change, pcm->dev field is dropped for avoiding
confusion. It was meant to point to a non-standard parent. But,
since now we can touch each struct device directly, we can manipulate
the parent field easily there, too.

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


# 6cbbfe1c 28-Jan-2015 Takashi Iwai <tiwai@suse.de>

ALSA: Include linux/io.h instead of asm/io.h

Nowadays it's recommended. Replace all in a shot.

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


# 74c34ca1 22-Apr-2013 Eldad Zack <eldad@fogrefinery.com>

ALSA: pcm_format_to_bits strong-typed conversion

Add a function to handle conversion from snd_pcm_format_t
to bitwise with proper typing.

Change such conversions to use this function and silence sparse
warnings.

Signed-off-by: Eldad Zack <eldad@fogrefinery.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# da155d5b 14-Jul-2011 Paul Gortmaker <paul.gortmaker@windriver.com>

sound: Add module.h to the previously silent sound users

Lots of sound drivers were getting module.h via the implicit presence
of it in <linux/device.h> but we are going to clean that up. So
fix up those users now.

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


# 5a0e3ad6 24-Mar-2010 Tejun Heo <tj@kernel.org>

include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h

percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.

percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.

http://userweb.kernel.org/~tj/misc/slabh-sweep.py

The script does the followings.

* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.

* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.

* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.

The conversion was done in the following steps.

1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.

2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.

3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.

4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.

5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.

6. percpu.h was updated not to include slab.h.

7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).

* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig

8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.

Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.

Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>


# 888dcb7c 23-Oct-2008 Johannes Berg <johannes@sipsolutions.net>

ALSA: aoa: clean up file names

This cleans up the apple onboard audio driver filenames.

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