Commit Graph

330 Commits (d210baf53b699fc61aa891c177b71d7082d3b957)

Author SHA1 Message Date
Linus Torvalds 685d87f7cc Revert "pcm_native.c: remove unused label"
This reverts commit 680db0136e.  The label
is actually used, but hidden behind CONFIG_SND_DEBUG and the horrible
snd_assert() macro.

That macro could probably be improved to be along the lines of

	#define snd_assert(expr, args...) do { if ((void)(expr),0) { args; } } while (0)

or similar to make sure that we always both evaluate 'expr' and parse
'args', but while gcc should optimize it all away, I'm too lazy to
really verify that.  So I'll just admit defeat and will continue to live
with the annoying warning.

Noted-by: Robert P. J. Day <rpjday@crashcourse.ca>
Signed-off-by: Linus "Grr.." Torvalds
2008-08-06 19:26:20 -07:00
Linus Torvalds 680db0136e pcm_native.c: remove unused label
This fixes the warning

  sound/core/pcm_native.c: In function 'snd_pcm_fasync':
  sound/core/pcm_native.c:3262: warning: label 'out' defined but not used

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-08-06 15:14:13 -07:00
Willy Tarreau 82e68f7ffe sound: ensure device number is valid in snd_seq_oss_synth_make_info
snd_seq_oss_synth_make_info() incorrectly reports information
to userspace without first checking for the validity of the
device number, leading to possible information leak (CVE-2008-3272).

Reported-By: Tobias Klein <tk@trapkit.de>
Acked-and-tested-by: Takashi Iwai <tiwai@suse.de>
Cc: stable@kernel.org
Signed-off-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-08-04 17:03:26 -07:00
Andrea Righi 27ac792ca0 PAGE_ALIGN(): correctly handle 64-bit values on 32-bit architectures
On 32-bit architectures PAGE_ALIGN() truncates 64-bit values to the 32-bit
boundary. For example:

	u64 val = PAGE_ALIGN(size);

always returns a value < 4GB even if size is greater than 4GB.

The problem resides in PAGE_MASK definition (from include/asm-x86/page.h for
example):

#define PAGE_SHIFT      12
#define PAGE_SIZE       (_AC(1,UL) << PAGE_SHIFT)
#define PAGE_MASK       (~(PAGE_SIZE-1))
...
#define PAGE_ALIGN(addr)       (((addr)+PAGE_SIZE-1)&PAGE_MASK)

The "~" is performed on a 32-bit value, so everything in "and" with
PAGE_MASK greater than 4GB will be truncated to the 32-bit boundary.
Using the ALIGN() macro seems to be the right way, because it uses
typeof(addr) for the mask.

Also move the PAGE_ALIGN() definitions out of include/asm-*/page.h in
include/linux/mm.h.

See also lkml discussion: http://lkml.org/lkml/2008/6/11/237

[akpm@linux-foundation.org: fix drivers/media/video/uvc/uvc_queue.c]
[akpm@linux-foundation.org: fix v850]
[akpm@linux-foundation.org: fix powerpc]
[akpm@linux-foundation.org: fix arm]
[akpm@linux-foundation.org: fix mips]
[akpm@linux-foundation.org: fix drivers/media/video/pvrusb2/pvrusb2-dvb.c]
[akpm@linux-foundation.org: fix drivers/mtd/maps/uclinux.c]
[akpm@linux-foundation.org: fix powerpc]
Signed-off-by: Andrea Righi <righi.andrea@gmail.com>
Cc: <linux-arch@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-07-24 10:47:21 -07:00
Greg Kroah-Hartman 89409211ff device create: sound: convert device_create to device_create_drvdata
device_create() is race-prone, so use the race-free
device_create_drvdata() instead as device_create() is going away.

Cc: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 21:54:44 -07:00
Linus Torvalds d1794f2c5b Merge branch 'bkl-removal' of git://git.lwn.net/linux-2.6
* 'bkl-removal' of git://git.lwn.net/linux-2.6: (146 commits)
  IB/umad: BKL is not needed for ib_umad_open()
  IB/uverbs: BKL is not needed for ib_uverbs_open()
  bf561-coreb: BKL unneeded for open()
  Call fasync() functions without the BKL
  snd/PCM: fasync BKL pushdown
  ipmi: fasync BKL pushdown
  ecryptfs: fasync BKL pushdown
  Bluetooth VHCI: fasync BKL pushdown
  tty_io: fasync BKL pushdown
  tun: fasync BKL pushdown
  i2o: fasync BKL pushdown
  mpt: fasync BKL pushdown
  Remove BKL from remote_llseek v2
  Make FAT users happier by not deadlocking
  x86-mce: BKL pushdown
  vmwatchdog: BKL pushdown
  vmcp: BKL pushdown
  via-pmu: BKL pushdown
  uml-random: BKL pushdown
  uml-mmapper: BKL pushdown
  ...
2008-07-14 14:48:31 -07:00
Jonathan Corbet 2fceef397f Merge commit 'v2.6.26' into bkl-removal 2008-07-14 15:29:34 -06:00
Johannes Berg ee2da99782 ALSA: remove CONFIG_KMOD from sound
A bunch of things in alsa depend on CONFIG_KMOD,
use CONFIG_MODULES instead where the dependency
is needed at all.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-07-10 09:32:58 +02:00
Jonathan Corbet 2db9f0a35a snd/PCM: fasync BKL pushdown
Chances are this is unneeded, but the code is twisty enough that it is hard
to tell.

Signed-off-by: Jonathan Corbet <corbet@lwn.net>
2008-07-02 15:06:28 -06:00
Jonathan Corbet 78a3c3d7c6 sound: cdev lock_kernel() pushdown
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
2008-06-20 14:05:50 -06:00
Takashi Iwai d3bd67cdbb ALSA: make snd_ctl_elem_read() and snd_ctl_elem_write() static
snd_ctl_elem_read() and snd_ctl_elem_write() are no longer used by
any other drivers.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-06-13 16:48:49 +02:00
Takashi Iwai a93bbaa77e [ALSA] Improve the slots option handling
Fix and improve the slots option handling.  The sound core tries to
find the slot with the given module name first and assign if it's
still available.  If all pre-given slots are unavailable, then try
to find another free slot.

Also, when a module name begins with '!', it means the negative match:
the slot will be given for any modules but that one.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-05-28 15:14:32 +02:00
Takashi Iwai 62cf872a8e [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>
2008-05-27 15:56:21 +02:00
Takashi Iwai 89fe511792 sound: Convert to menuconfig
Convert menu in sound Kconfig files to menuconfig and if.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-05-27 15:56:20 +02:00
Greg Kroah-Hartman 5d99a8b814 SOUND: fix race in device_create
There is a race from when a device is created with device_create() and
then the drvdata is set with a call to dev_set_drvdata() in which a
sysfs file could be open, yet the drvdata will be NULL, causing all
sorts of bad things to happen.

This patch fixes the problem by using the new function,
device_create_drvdata().

Cc: Kay Sievers <kay.sievers@vrfy.org>
Cc: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-05-20 13:31:55 -07:00
Takashi Iwai c17cf06bfc [ALSA] Remove unneeded ugly hack for i386 in memalloc.c
The hack for dma_alloc_coherent() is no longer needed on 2.6.26 since
the base code was improved.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-19 13:19:15 +02:00
Denis V. Lunev 7bf4e6d3e9 sound: use non-racy method for /proc/driver/snd-page-alloc creation
Use proc_create() to make sure that ->proc_fops be setup before gluing PDE to
main tree.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Jaroslav Kysela <perex@suse.cz>
Cc: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-29 08:06:20 -07:00
Alexey Dobriyan c74c120a21 proc: remove proc_root from drivers
Remove proc_root export.  Creation and removal works well if parent PDE is
supplied as NULL -- it worked always that way.

So, one useless export removed and consistency added, some drivers created
PDEs with &proc_root as parent but removed them as NULL and so on.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-29 08:06:18 -07:00
Takashi Iwai f18638dcf0 [ALSA] Clean up snd_card_free*()
A little clean up of snd_card_free*().
Removed snd_card_free_prepare() since it's actually almost identical
with snd_card_disconnect().

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-04-24 12:00:39 +02:00
Takashi Iwai 73d38b13ff [ALSA] Fix the race of card instance unregistration
Move the call of device_unregister() for the card instance in
snd_card_disconnect() to avoid the race of sysfs card entry, which
can be typically found on usb-audio reconnection.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-04-24 12:00:39 +02:00
Nick Andrew a295e09e89 [ALSA] sound: this amplifier only goes up to 7
sound: kernel log levels are 0-7

Kernel log levels are 0-7, not 0-9.

Signed-off-by: Nick Andrew <nick@nick-andrew.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-04-24 12:00:35 +02:00
Harvey Harrison 9bf8e7ddea [ALSA] sound: replace remaining __FUNCTION__ occurences
__FUNCTION__ is gcc-specific, use __func__

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-04-24 12:00:20 +02:00
Takashi Iwai c354cd7d96 [ALSA] seq-oss - Remove invalid BUG()
Removed invalid BUG() - the driver should handle the error case properly
rather than issuing BUG().

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-04-24 12:00:14 +02:00
Takashi Iwai 1c82ed1bc5 [ALSA] Keep private TLV entry in vmaster itself
Use a private array for TLV entries of virtual master controls instead
of (supposed) static array.  This cleans up the existing codes.

Also, now vmaster assumes the simple dB-range TLV that is the only type
it can handle.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-04-24 12:00:12 +02:00
Takashi Iwai e922b0028f [ALSA] Move vmaster code to sound core
Move the codes for virtual master controls to sound core part so that
not only hda-intel drivers can use it.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-04-24 12:00:12 +02:00
Takashi Iwai 6c4cc3a8ed [ALSA] Add more fallbacks to OSS PHONEOUT mixer map
Added more fallbacks to OSS PHONEOUT mixer mapping.  This corresponds
to the speaker output in general, so now "Mono" and "Speaker" are
assigned.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-04-24 12:00:07 +02:00
Jan Blunck 0d63e4f9ea Dont touch fs_struct in drivers
The sound drivers and the pnpbios core test for current->root != NULL.  This
test seems to be unnecessary since we always have rootfs mounted before
initializing the drivers.

Signed-off-by: Jan Blunck <jblunck@suse.de>
Acked-by: Christoph Hellwig <hch@lst.de>
Cc: Bjorn Helgaas <bjorn.helgaas@hp.com>
Cc: Jaroslav Kysela <perex@suse.cz>
Acked-by: Takashi Iwai <tiwai@suse.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-02-14 21:13:32 -08:00
Mark Gross f011e2e2df latency.c: use QoS infrastructure
Replace latency.c use with pm_qos_params use.

Signed-off-by: mark gross <mgross@linux.intel.com>
Cc: "John W. Linville" <linville@tuxdriver.com>
Cc: Len Brown <lenb@kernel.org>
Cc: Jaroslav Kysela <perex@suse.cz>
Cc: Takashi Iwai <tiwai@suse.de>
Cc: Arjan van de Ven <arjan@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-02-05 09:44:22 -08:00
Takashi Iwai 4939c66034 [ALSA] Fix Oops with PCM OSS sync
The PCM OSS emulation can cause Oops at sync operation due to the wrong
data size calculation.  Typically happening on Sparc64:
	http://lkml.org/lkml/2008/1/24/426

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31 17:30:20 +01:00
Miguel Boton bc9abce0de [ALSA] fix compilation warning in GCC
'snd_shutdown_f_ops' is not a pointer so its address will never be NULL.
GCC will complain because 'fops_get' will do an unnecessary check because
'&snd_shutdown_f_ops' is always true.

Signed-off-by: Miguel Boton <mboton@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31 17:29:56 +01:00
Jaroslav Kysela 8c12158687 [ALSA] PCM interface - rename SNDRV_PCM_TSTAMP_MMAP to SNDRV_PCM_TSTAMP_ENABLE
Change semantics for SNDRV_PCM_TSTAMP_MMAP. Doing timestamping only in
the interrupt handler might cause that hw_ptr is not related to actual
timestamp. With this change, grab timestamp at every hw_ptr update to
have always valid timestamp + ring buffer position pair.
With this change, SNDRV_PCM_TSTAMP_MMAP was renamed to
SNDRV_PCM_TSTAMP_ENABLE. It's no regression (I think).

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31 17:29:54 +01:00
Marcin Ślusarz 17596a80d3 [ALSA] rawmidi: let sparse know what is going on _for real_
snd_rawmidi_kernel_read1/write1 weren't annotated but used
copy_to_user/copy_from_user when one of parameters (kernel) was equal to 0
remove it and add properly annotated parameter

Signed-off-by: Marcin Ślusarz <marcin.slusarz@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31 17:29:49 +01:00
Takashi Iwai 9004acc70e [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>
2008-01-31 17:29:48 +01:00
Takashi Iwai 31e8960b35 [ALSA] Remove PCM sleep_min and tick
The 'tick' in PCM is set (again) via sw_params.  And, nobody uses
this feature at all except for a command line option of aplay.
(This is literally 'nobody', as I checked alsa-lib API calls in all
 programs in major distros.)
Above all, if we need finer wake-ups for the position update, it's
basically an issue that the driver should solve, not tuned by each
application.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31 17:29:47 +01:00
Takashi Iwai 130755108b [ALSA] PCM - clean up snd_pcm_lib_read/write
Introduce a common helper function for snd_pcm_lib_read and snd_pcm_lib_write
for cleaning up the code.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31 17:29:47 +01:00
Takashi Iwai d948035a92 [ALSA] Remove PCM xfer_align sw params
The xfer_align sw_params parameter has never been used in a sane manner,
and no one understands what this does exactly.  The current
implementation looks also buggy because it allows write of shorter size
than xfer_align.  So, if you do partial writes, the write isn't actually
aligned at all.
Removing this parameter will make some pcm_lib_* code more readable
(and less buggy).

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31 17:29:47 +01:00
Takashi Iwai fa5717f209 [ALSA] Fix PCM write blocking
The snd_pcm_lib_write1() may block in some weird condition:
  - the stream isn't started
  - avail_min is big (e.g. period size)
  - partial write up to buffer_size - avail_min
The patch fixes this invalid blocking problem.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31 17:29:46 +01:00
Takashi Iwai 8ace4f3c9d [ALSA] Remove indirect control access
This patch removes the indirect control access to the control elements.
The indirect access has never been used and is even broken on 32bit
ioctl wrapper.  Let's clean it up.
The pointers still remain in snd_ctl_elem_* structs just to make sure
that the struct size won't change.  Once after checking the size
consistency, we can get rid of them, too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31 17:29:46 +01:00
Jaroslav Kysela a713b58347 [ALSA] PCM core - remove SNDRV_PCM_TSTAMP_MMAP condition in snd_pcm_status()
The condition caused that the returned ring buffer position does not match
with timestamp when SNDRV_PCM_TSTAMP_MMAP mode was enabled. Removing
condition makes unified behaviour and interrupt based timestamp can be
accessed via PCM_IOCTL_SYNC_PTR or mmaped status area.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31 17:29:46 +01:00
Takashi Iwai 5a7f261921 [ALSA] Add SNDRV_PCM_IOCTL_TSTAMP back to compat ioctl
The replaced one should be re-added for older alsa-lib.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31 17:29:36 +01:00
Jaroslav Kysela 28e9e47384 [ALSA] PCM - added back TSTAMP ioctl for PCM (for old alsa-lib binaries)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31 17:29:36 +01:00
Marcin Ślusarz 3b378e1f7e [ALSA] sound/core/seq: move declarations of globally visible variables to proper headers
sound/core/seq: move declarations of globally visible variables to proper headers

Signed-off-by: Marcin Ślusarz <marcin.slusarz@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31 17:29:35 +01:00
Marcin Ślusarz 36b9cdfea6 [ALSA] info_oss: move prototype of snd_card_info_read_oss to info.h
info_oss: move prototype of snd_card_info_read_oss to info.h

Signed-off-by: Marcin Ślusarz <marcin.slusarz@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31 17:29:35 +01:00
Marcin Ślusarz 67c393172c [ALSA] pcm_lib: fix sparse warning about different signedness
pcm_lib: fix sparse warning about different signedness

Signed-off-by: Marcin Ślusarz <marcin.slusarz@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31 17:29:35 +01:00
Marcin Ślusarz be3e0115e3 [ALSA] pcm_lib: fix sparse warning about shadowing 'n' symbol
pcm_lib: fix sparse warning about shadowing 'n' symbol

Signed-off-by: Marcin Ślusarz <marcin.slusarz@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31 17:29:35 +01:00
Marcin Ślusarz b05e578740 [ALSA] pcm_native: fix sparse warning about shadowing 'state' symbol
pcm_native: fix sparse warning about shadowing 'state' symbol

Signed-off-by: Marcin Ślusarz <marcin.slusarz@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31 17:29:35 +01:00
Andrew Morton 5050b0921a [ALSA] copy_ctl_value_from_user() warning fix
sound/core/control_compat.c: In function 'copy_ctl_value_from_user':
sound/core/control_compat.c:222: warning: 'count' may be used uninitialized in this function

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31 17:29:34 +01:00
Takashi Iwai 6b587ef9a1 [ALSA] Fix old tstamp ioctl for compat_ioctl
Replaced the old SNDRV_PCM_IOCTL_TSTAMP with the new one in
PCM compat_ioctl.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31 17:29:34 +01:00
Nick Piggin 3ad5afcd5f [ALSA] alsa: nopage
Convert ALSA from nopage to fault.
Switch from OOM to SIGBUS if the resource is not available.

Signed-off-by: Nick Piggin <npiggin@suse.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31 17:29:32 +01:00
Jaroslav Kysela 67a7be7e9c [ALSA] PCM - fixed SNDRV_PCM_FORMAT_U24_BE silence constant
Reported by Timur Tabi <timur@freescale.com> .

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31 17:29:31 +01:00