summaryrefslogtreecommitdiffstats
path: root/sound/core
Commit message (Collapse)AuthorAgeFilesLines
* ALSA: remove unneeded power_mutex lock in snd_pcm_dropTakashi Iwai2008-09-251-10/+3
| | | | | | | The power_mutex lock in snd_pcm_drop may cause a possible deadlock chain, and above all, it's unneeded. Let's get rid of it. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: fix locking in snd_pcm_open*() and snd_rawmidi_open*()Takashi Iwai2008-09-252-4/+4
| | | | | | | | | | | | | | | | | | The PCM and rawmidi open callbacks have a lock against card->controls_list but it takes a wrong one, card->controls_rwsem, instead of a right one card->ctl_files_rwlock. This patch fixes them. This change also fixes automatically the potential deadlocks due to mm->mmap_sem in munmap and copy_from/to_user, reported by Sitsofe Wheeler: A: snd_ctl_elem_user_tlv(): card->controls_rwsem => mm->mmap_sem B: snd_pcm_open(): card->open_mutex => card->controls_rwsem C: munmap: mm->mmap_sem => snd_pcm_release(): card->open_mutex The patch breaks the chain. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* Revert "pcm_native.c: remove unused label"Linus Torvalds2008-08-061-0/+1
| | | | | | | | | | | | | | | | | | This reverts commit 680db0136e0778a0d7e025af7572c6a8d82279e2. 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
* pcm_native.c: remove unused labelLinus Torvalds2008-08-061-1/+0
| | | | | | | | | 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>
* sound: ensure device number is valid in snd_seq_oss_synth_make_infoWilly Tarreau2008-08-041-0/+3
| | | | | | | | | | | | 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>
* PAGE_ALIGN(): correctly handle 64-bit values on 32-bit architecturesAndrea Righi2008-07-241-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* device create: sound: convert device_create to device_create_drvdataGreg Kroah-Hartman2008-07-211-2/+3
| | | | | | | | | 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>
* Merge branch 'bkl-removal' of git://git.lwn.net/linux-2.6Linus Torvalds2008-07-142-3/+20
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * '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 ...
| * Merge commit 'v2.6.26' into bkl-removalJonathan Corbet2008-07-141-5/+3
| |\
| * | snd/PCM: fasync BKL pushdownJonathan Corbet2008-07-021-2/+6
| | | | | | | | | | | | | | | | | | | | | 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>
| * | sound: cdev lock_kernel() pushdownJonathan Corbet2008-06-201-1/+14
| | | | | | | | | | | | Signed-off-by: Jonathan Corbet <corbet@lwn.net>
* | | ALSA: remove CONFIG_KMOD from soundJohannes Berg2008-07-104-12/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | ALSA: make snd_ctl_elem_read() and snd_ctl_elem_write() staticTakashi Iwai2008-06-131-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | [ALSA] Improve the slots option handlingTakashi Iwai2008-05-281-27/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | [ALSA] Replace CONFIG_SND_DEBUG_DETECT with CONFIG_SND_DEBUG_VERBOSETakashi Iwai2008-05-271-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | sound: Convert to menuconfigTakashi Iwai2008-05-271-16/+3
| | | | | | | | | | | | | | | | | | Convert menu in sound Kconfig files to menuconfig and if. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* | | [ALSA] Remove unneeded ugly hack for i386 in memalloc.cTakashi Iwai2008-05-191-62/+0
| |/ |/| | | | | | | | | | | | | 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>
* | SOUND: fix race in device_createGreg Kroah-Hartman2008-05-201-5/+3
|/ | | | | | | | | | | | | | | 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>
* sound: use non-racy method for /proc/driver/snd-page-alloc creationDenis V. Lunev2008-04-291-3/+2
| | | | | | | | | | | | | 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>
* proc: remove proc_root from driversAlexey Dobriyan2008-04-291-2/+2
| | | | | | | | | | | | 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>
* [ALSA] Clean up snd_card_free*()Takashi Iwai2008-04-241-17/+9
| | | | | | | | 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>
* [ALSA] Fix the race of card instance unregistrationTakashi Iwai2008-04-241-4/+6
| | | | | | | | 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>
* [ALSA] sound: this amplifier only goes up to 7Nick Andrew2008-04-241-2/+2
| | | | | | | | | 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>
* [ALSA] sound: replace remaining __FUNCTION__ occurencesHarvey Harrison2008-04-241-1/+1
| | | | | | | __FUNCTION__ is gcc-specific, use __func__ Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* [ALSA] seq-oss - Remove invalid BUG()Takashi Iwai2008-04-241-2/+7
| | | | | | | Removed invalid BUG() - the driver should handle the error case properly rather than issuing BUG(). Signed-off-by: Takashi Iwai <tiwai@suse.de>
* [ALSA] Keep private TLV entry in vmaster itselfTakashi Iwai2008-04-241-3/+6
| | | | | | | | | | 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>
* [ALSA] Move vmaster code to sound coreTakashi Iwai2008-04-243-0/+373
| | | | | | | 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>
* [ALSA] Add more fallbacks to OSS PHONEOUT mixer mapTakashi Iwai2008-04-241-0/+2
| | | | | | | | 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>
* Dont touch fs_struct in driversJan Blunck2008-02-144-11/+2
| | | | | | | | | | | | | | | 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>
* latency.c: use QoS infrastructureMark Gross2008-02-051-4/+7
| | | | | | | | | | | | | 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>
* [ALSA] Fix Oops with PCM OSS syncTakashi Iwai2008-01-311-0/+1
| | | | | | | | | 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>
* [ALSA] fix compilation warning in GCCMiguel Boton2008-01-311-1/+1
| | | | | | | | | | | '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>
* [ALSA] PCM interface - rename SNDRV_PCM_TSTAMP_MMAP to SNDRV_PCM_TSTAMP_ENABLEJaroslav Kysela2008-01-313-4/+10
| | | | | | | | | | | 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>
* [ALSA] rawmidi: let sparse know what is going on _for real_Marcin Ślusarz2008-01-311-19/+21
| | | | | | | | | | 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>
* [ALSA] Remove sound/driver.hTakashi Iwai2008-01-3148-49/+1
| | | | | | | | | | | | 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>
* [ALSA] Remove PCM sleep_min and tickTakashi Iwai2008-01-314-152/+3
| | | | | | | | | | | | | 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>
* [ALSA] PCM - clean up snd_pcm_lib_read/writeTakashi Iwai2008-01-311-140/+76
| | | | | | | | 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>
* [ALSA] Remove PCM xfer_align sw paramsTakashi Iwai2008-01-314-29/+4
| | | | | | | | | | | | | 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>
* [ALSA] Fix PCM write blockingTakashi Iwai2008-01-311-2/+5
| | | | | | | | | | | 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>
* [ALSA] Remove indirect control accessTakashi Iwai2008-01-311-31/+20
| | | | | | | | | | | | 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>
* [ALSA] PCM core - remove SNDRV_PCM_TSTAMP_MMAP condition in snd_pcm_status()Jaroslav Kysela2008-01-311-7/+2
| | | | | | | | | 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>
* [ALSA] Add SNDRV_PCM_IOCTL_TSTAMP back to compat ioctlTakashi Iwai2008-01-311-0/+1
| | | | | | | 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>
* [ALSA] PCM - added back TSTAMP ioctl for PCM (for old alsa-lib binaries)Jaroslav Kysela2008-01-311-0/+2
| | | | Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* [ALSA] sound/core/seq: move declarations of globally visible variables to ↵Marcin Ślusarz2008-01-314-9/+9
| | | | | | | | | | 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>
* [ALSA] info_oss: move prototype of snd_card_info_read_oss to info.hMarcin Ślusarz2008-01-311-2/+0
| | | | | | | | 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>
* [ALSA] pcm_lib: fix sparse warning about different signednessMarcin Ślusarz2008-01-311-1/+1
| | | | | | | | 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>
* [ALSA] pcm_lib: fix sparse warning about shadowing 'n' symbolMarcin Ślusarz2008-01-311-6/+10
| | | | | | | | 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>
* [ALSA] pcm_native: fix sparse warning about shadowing 'state' symbolMarcin Ślusarz2008-01-311-3/+3
| | | | | | | | 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>
* [ALSA] copy_ctl_value_from_user() warning fixAndrew Morton2008-01-311-1/+2
| | | | | | | | | 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>
* [ALSA] Fix old tstamp ioctl for compat_ioctlTakashi Iwai2008-01-311-1/+1
| | | | | | | | 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>