History log of /linux-master/sound/pci/lola/lola_pcm.c
Revision Date Author Comments
# 12626530 20-May-2022 Kees Cook <keescook@chromium.org>

ALSA: lola: Bounds check loop iterator against streams array size

GCC 12 sees that it's technically possible for num_streams to be larger
than ARRAY_SIZE(pcm->streams). Bounds-check the iterator.

../sound/pci/lola/lola_pcm.c: In function 'lola_pcm_update':
../sound/pci/lola/lola_pcm.c:567:64: warning: array subscript [0, 31] is outside array bounds of 'struct lola_stream[16]' [-Warray-bounds]
567 | struct lola_stream *str = &pcm->streams[i];
| ~~~~~~~~~~~~^~~
In file included from ../sound/pci/lola/lola_pcm.c:15:
../sound/pci/lola/lola.h:307:28: note: while referencing 'streams'
307 | struct lola_stream streams[MAX_STREAM_COUNT];
| ^~~~~~~

Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20220520165537.2139826-1-keescook@chromium.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>


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

ALSA: lola: Allocate resources with device-managed APIs

This patch converts the resource management in PCI lola driver with
devres as a clean up. Each manual resource management is converted
with the corresponding devres helper, the page allocations are done
with the devres helper, and the card object release is managed now via
card->private_free instead of a lowlevel snd_device.

This should give no user-visible functional changes.

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


# 75b1a8f9 04-Jan-2021 Joe Perches <joe@perches.com>

ALSA: Convert strlcpy to strscpy when return value is unused

strlcpy is deprecated. see: Documentation/process/deprecated.rst

Change the calls that do not use the strlcpy return value to the
preferred strscpy.

Done with cocci script:

@@
expression e1, e2, e3;
@@

- strlcpy(
+ strscpy(
e1, e2, e3);

This cocci script leaves the instances where the return value is
used unchanged.

After this patch, sound/ has 3 uses of strlcpy() that need to be
manually inspected for conversion and changed one day.

$ git grep -w strlcpy sound/
sound/usb/card.c: len = strlcpy(card->longname, s, sizeof(card->longname));
sound/usb/mixer.c: return strlcpy(buf, p->name, buflen);
sound/usb/mixer.c: return strlcpy(buf, p->names[index], buflen);

Miscellenea:

o Remove trailing whitespace in conversion of sound/core/hwdep.c

Link: https://lore.kernel.org/lkml/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/

Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/22b393d1790bb268769d0bab7bacf0866dcb0c14.camel@perches.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


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

ALSA: pci: 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-16-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


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

ALSA: lola: Use managed buffer allocation

Clean up the driver with the new managed buffer allocation API.
The superfluous snd_pcm_lib_malloc_pages() and
snd_pcm_lib_free_pages() calls are dropped.

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


# 6974f8ad 05-Nov-2019 Takashi Iwai <tiwai@suse.de>

ALSA: pci: 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-24-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 16ccca11 05-Nov-2019 Takashi Iwai <tiwai@suse.de>

ALSA: pci: Drop superfluous snd_pcm_sgbuf_ops_page

snd_pcm_sgbuf_ops_page is no longer needed to be set explicitly to PCM
page ops since the recent change in the PCM core (*). Leaving it NULL
should work as long as the preallocation has been done properly.

This patch drops the redundant lines.

(*) 7e8edae39fd1: ALSA: pcm: Handle special page mapping in the
default mmap handler

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


# 0d9a26fc 25-Jul-2018 Takashi Iwai <tiwai@suse.de>

ALSA: lola: Proper endian notations

The BDL entries in lola driver are little-endian while we code them as
u32. This leads to sparse warnings like:
sound/pci/lola/lola.c:105:40: warning: incorrect type in assignment (different base types)
sound/pci/lola/lola.c:105:40: expected unsigned int [unsigned] [usertype] <noident>
sound/pci/lola/lola.c:105:40: got restricted __le32 [usertype] <noident>

This patch fixes the declarations to the proper __le32 type.

Also, there was a typo in the original code, where __user was used
that was intended as __iomem. This was caused also by sparse:
sound/pci/lola/lola_mixer.c:132:27: warning: incorrect type in assignment (different address spaces)
Fixed in this patch as well.

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


# 5cf84795 12-Aug-2017 Bhumika Goyal <bhumirks@gmail.com>

ALSA: lola: make snd_pcm_hardware const

Make this const as it is only used during a copy operation.
Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 6769e988 01-Sep-2016 Julia Lawall <Julia.Lawall@lip6.fr>

ALSA: constify snd_pcm_ops structures

Check for snd_pcm_ops structures that are only stored in the ops field of a
snd_soc_platform_driver structure or passed as the third argument to
snd_pcm_set_ops. The corresponding field or parameter is declared const,
so snd_pcm_ops structures that have this property can be declared as const
also.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct snd_pcm_ops i@p = { ... };

@ok1@
identifier r.i;
struct snd_soc_platform_driver e;
position p;
@@
e.ops = &i@p;

@ok2@
identifier r.i;
expression e1, e2;
position p;
@@
snd_pcm_set_ops(e1, e2, &i@p)

@bad@
position p != {r.p,ok1.p,ok2.p};
identifier r.i;
struct snd_pcm_ops e;
@@
e@i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
struct snd_pcm_ops i = { ... };
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


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

ALSA: lola: Use standard printk helpers

Convert with dev_err() and co from snd_printk(), etc.

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


# e23e7a14 05-Dec-2012 Bill Pemberton <wfp5p@virginia.edu>

ALSA: pci: remove __dev* attributes

CONFIG_HOTPLUG is going away as an option. As result the __dev*
markings will be going away.

Remove use of __devinit, __devexit_p, __devinitdata, __devinitconst,
and __devexit.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# f044785d 03-May-2011 Takashi Iwai <tiwai@suse.de>

ALSA: lola - Add missing inclusion of linux/delay.h

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


# 2db30020 03-May-2011 Takashi Iwai <tiwai@suse.de>

ALSA: lola - Rename to Digital SRC Capture Switch

Renamed to Digial SRC Capture Switch for more correct representation.
Also fixed analog volume control on Lola161611 and lola881.

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


# c7aad3c3 03-May-2011 Takashi Iwai <tiwai@suse.de>

ALSA: lola - Add sync in loop implementation

For assuring the synchronized state with the pause operation,
loop over the all linked streams and waits until all get ready
in a loop.

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


# 7e79f226 03-May-2011 Takashi Iwai <tiwai@suse.de>

ALSA: lola - Add SRC refcounting

Added the refcounting for the exclusive SRC control.
Also, fixed the possible stall after PCM pause operations.

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


# 8bd172dc 03-May-2011 Takashi Iwai <tiwai@suse.de>

ALSA: lola - Allow granularity changes

Add some sanity checks.
Change PCM parameters appropriately per granularity.

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


# 972505cc 03-May-2011 Takashi Iwai <tiwai@suse.de>

ALSA: lola - Use SG-buffer

Completely switch to SG-buffer now, as it's working stably.

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


# 0f8f56c9 03-May-2011 Takashi Iwai <tiwai@suse.de>

ALSA: lola - Fix PCM stalls

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


# 333ff397 03-May-2011 Takashi Iwai <tiwai@suse.de>

ALSA: lola - Use a single BDL

Use a single BDL for both buffers instead of allocating for each.

Also a few tune-up to avoid the stream stalls in the PCM code and
the prelimianry work for SG-buffer support are added, too.

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


# d43f3010 03-May-2011 Takashi Iwai <tiwai@suse.de>

ALSA: Add the driver for Digigram Lola PCI-e boards

Added a new driver for supporting Digigram Lola PCI-e boards.

Lola has a similar h/w design like HD-audio but with extended verbs.
Thus the driver is written similarly like HD-audio driver in the bus
part. The codec part is rather written in a fixed way specific to the
Lola board because of the verb incompatibility.

The driver provides basic PCM, supporting multi-streams and mixing.

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