History log of /linux-master/sound/pci/ctxfi/ctpcm.c
Revision Date Author Comments
# 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>


# fe372850 02-Jul-2020 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ALSA: pci/ctxfi: fix kernel-doc warnings

Fix W=1 warnings. The files contain formatting that isn't kernel-doc.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200702193604.169059-10-pierre-louis.bossart@linux.intel.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>


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

ALSA: ctxfi: 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-34-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>


# 5765e78e 31-May-2019 Thomas Gleixner <tglx@linutronix.de>

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

Based on 1 normalized pattern(s):

this source file is released under gpl v2 license no other versions
see the copying file included in the main directory of this source
distribution for the license terms and conditions

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-only

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

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Allison Randal <allison@lohutok.net>
Reviewed-by: Armijn Hemel <armijn@tjaldur.nl>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190531081035.780831265@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# cbb7eb20 22-Aug-2017 Markus Elfring <elfring@users.sourceforge.net>

ALSA: ctxfi: Use common error handling code in two functions

Add jump targets so that a bit of exception handling can be better reused
at the end of these functions.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 4f8f04e8 12-Aug-2017 Bhumika Goyal <bhumirks@gmail.com>

ALSA: ctxfi: make snd_pcm_hardware const

Make these const as they are 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>


# 0cae90a9 29-Sep-2014 Sudip Mukherjee <sudipm.mukherjee@gmail.com>

ALSA: ctxfi: pr_* replaced with dev_*

pr_* macros replaced with dev_* as they are more preffered over pr_*.
each file which had pr_* was reviewed manually and replaced with dev_*.
here we have actually used the various snd_card which was added to some
structures of ctxfi via a previous patch of this series.

in the ctvmem.c file we have passed a reference of ct_atc as an
argument to get_vm_block function so that it can be used from
dev_*.

since dev_* will print the device information , so the prefix of
"ctxfi" from the various pr_* were also removed.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 57f2d8b7 25-Aug-2014 Sudip Mukherjee <sudipm.mukherjee@gmail.com>

ALSA: ctxfi: ctpcm.c: printk replacement

replaced printk with corresponding pr_err

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 7b31d009 12-Sep-2012 Takashi Iwai <tiwai@suse.de>

ALSA: Define more channel map positions

For following the standard, define more channel map positions and
shuffle the items a bit:

- As both PulseAudio and gstreamer define MONO channel position
explicitly, we should follow that, too. The mono streams point to
this channel position unless they are explicitly assigned to certain
channel positions.

- Top-front-* and Top-rear-* positions are added, carried from
PulseAudio's definitions.

- Move NA and MONO definitions at the top of table right after
UNKNOWN, since these are more abstract in comparison with other
practical positions.

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


# 7e8d613b 12-Sep-2012 Takashi Iwai <tiwai@suse.de>

ALSA: ctxfi: Fix mono channel map to UNKNOWN

To follow the previous commit.

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


# 8d50cdc1 03-Aug-2012 Takashi Iwai <tiwai@suse.de>

ALSA: ctxfi: Implement channel maps

Assign the multi-channel map to front PCM, and other channel map to
each other channel PCM.

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


# c7561cd8 14-Aug-2012 Takashi Iwai <tiwai@suse.de>

ALSA: PCI: Replace CONFIG_PM with CONFIG_PM_SLEEP

Otherwise we may get compile warnings due to unused functions.

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


# 391e6914 23-Aug-2011 Maarten Lankhorst <m.b.lankhorst@gmail.com>

ALSA: ctxfi: Bump playback substreams to 256

There are references in the code to 256 sources, so I tested it with 256 aplays,
of which the first and last with real data and the rest playing /dev/zero .

Also increase amount of page tables, so the default aplay size works.

Signed-off-by: Maarten Lankhorst <m.b.lankhorst@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# fa2b30af 09-Nov-2010 Julia Lawall <julia@diku.dk>

ALSA: sound/pci/ctxfi/ctpcm.c: Remove potential for use after free

In each function, the value apcm is stored in the private_data field of
runtime. At the same time the function ct_atc_pcm_free_substream is stored
in the private_free field of the same structure. ct_atc_pcm_free_substream
dereferences and ultimately frees the value in the private_data field. But
each function can exit in an error case with apcm having been freed, in
which case a subsequent call to the private_free function would perform a
dereference after free. On the other hand, if the private_free field is
not initialized, it is NULL, and not invoked (see snd_pcm_detach_substream
in sound/core/pcm.c). To avoid the introduction of a dangling pointer, the
initializations of the private_data and private_free fields are moved to
the end of the function, past any possible free of apcm. This is safe
because the previous calls to snd_pcm_hw_constraint_integer and
snd_pcm_hw_constraint_minmax, which take runtime as an argument, do not
refer to either of these fields.

In each function, there is one error case where apcm needs to be freed, and
a call to kfree is added.

The sematic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression e,e1,e2,e3;
identifier f,free1,free2;
expression a;
@@

*e->f = a
... when != e->f = e1
when any
if (...) {
... when != free1(...,e,...)
when != e->f = e2
* kfree(a)
... when != free2(...,e,...)
when != e->f = e3
}
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


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


# 35ebf6e7 22-Jul-2009 Takashi Iwai <tiwai@suse.de>

ALSA: ctxfi - Simple code clean up

- replace NULL == xxx with !xxx
- replace NULL != xxx with xxx
- similar trivial cleanups

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


# 29959a09 22-Jun-2009 Wai Yew CHAY <wychay@ctl.creative.com>

ALSA: ctxfi - Add PM support

Added the suspend/resume support to ctxfi driver.

The team tested on the following seems ok:
AMD Athlon 64 3500+ / ASUS A8N-E / 512MB DDR ATI / Radeon X1300
20k1 & 20k2 cards

Signed-off-by: Wai Yew CHAY <wychay@ctl.creative.com>
Singed-off-by: Ryan RICHARDS <ryan_richards@creativelabs.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# a5990dc5 09-Jun-2009 Takashi Iwai <tiwai@suse.de>

ALSA: ctxfi - Clear PCM resources at hw_params and hw_free

Currently the PCM resources are allocated only once and ever in prepare
callback, assuming that the PCM parameters are never changed. But it's
not true.

This patch adds the call of atc->pcm_release_resources() at hw_params
and hw_free callbacks to assure that the PCM setup is done correctly
for each h/w parameter changes.

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


# af8500bb 08-Jun-2009 Takashi Iwai <tiwai@suse.de>

ALSA: ctxfi - Fix possible buffer pointer overrun

Fix possible buffer pointer overruns. Back to zero when it's equal
or over the buffer size.

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


# 775ffa1d 05-Jun-2009 Takashi Iwai <tiwai@suse.de>

ALSA: ctxfi - Set periods_min to 2

Set 2 to minimal periods of playback pcm setups, too.

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


# b7bbf876 05-Jun-2009 Takashi Iwai <tiwai@suse.de>

ALSA: ctxfi - Use native timer interrupt on emu20k1

emu20k1 has a native timer interrupt based on the audio clock, which
is more accurate than the system timer (from the synchronization POV).
This patch adds the code to handle this with multiple streams.

The system timer is still used on emu20k2, and can be used also for
emu20k1 easily by changing USE_SYSTEM_TIMER to 1 in cttimer.c.

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


# c76157d9 02-Jun-2009 Takashi Iwai <tiwai@suse.de>

ALSA: ctxfi - Support SG-buffers

Use SG-buffers instead of contiguous pages.

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


# d2b9b96c 02-Jun-2009 Takashi Iwai <tiwai@suse.de>

ALSA: ctxfi - Fix supported PCM formats

The device seems supporting only U8, S16, S24_3LE, S32. Other linear
formats result in bad outputs.

Also, added the support for 32bit float format, which wasn't listed
in the original code.

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


# 8372d498 02-Jun-2009 Takashi Iwai <tiwai@suse.de>

ALSA: ctxfi - Fix PCM device naming

PCM names for surround streams should be also fixed as well as the mixer
element names. Also, a bit clean up for PCM name setup.

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


# b3e0afe6 14-May-2009 Takashi Iwai <tiwai@suse.de>

ALSA: ctxfi - Add prefix to debug prints

Added ctxfi: prefix to each debug print.

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


# 8cc72361 14-May-2009 Wai Yew CHAY <wychay@ctl.creative.com>

ALSA: SB X-Fi driver merge

The Sound Blaster X-Fi driver supports Creative solutions based on
20K1 and 20K2 chipsets.

Supported hardware :

Creative Sound Blaster X-Fi Titanium Fatal1ty® Champion Series
Creative Sound Blaster X-Fi Titanium Fatal1ty Professional Series
Creative Sound Blaster X-Fi Titanium Professional Audio
Creative Sound Blaster X-Fi Titanium
Creative Sound Blaster X-Fi Elite Pro
Creative Sound Blaster X-Fi Platinum
Creative Sound Blaster X-Fi Fatal1ty
Creative Sound Blaster X-Fi XtremeGamer
Creative Sound Blaster X-Fi XtremeMusic

Current release features:

* ALSA PCM Playback
* ALSA Record
* ALSA Mixer

Note:

* External I/O modules detection not included.

Signed-off-by: Wai Yew CHAY <wychay@ctl.creative.com>
Singed-off-by: Ryan RICHARDS <ryan_richards@creativelabs.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>