1
0
Fork 0
Commit Graph

79 Commits (redonkable)

Author SHA1 Message Date
Takashi Iwai 0f87dabe44 ALSA: info: Drop WARN_ON() from buffer NULL sanity check
commit 60379ba085 upstream.

snd_info_get_line() has a sanity check of NULL buffer -- both buffer
itself being NULL and buffer->buffer being NULL.  Basically both
checks are valid and necessary, but the problem is that it's with
snd_BUG_ON() macro that triggers WARN_ON().  The latter condition
(NULL buffer->buffer) can be met arbitrarily by user since the buffer
is allocated at the first write, so it means that user can trigger
WARN_ON() at will.

This patch addresses it by simply moving buffer->buffer NULL check out
of snd_BUG_ON() so that spurious WARNING is no longer triggered.

Reported-by: syzbot+e42d0746c3c3699b6061@syzkaller.appspotmail.com
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20200717084023.5928-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-07-29 10:18:30 +02:00
Thomas Gleixner 1a59d1b8e0 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>
2019-05-30 11:26:35 -07:00
Takashi Iwai 8c2f870890 ALSA: info: Fix racy addition/deletion of nodes
The ALSA proc helper manages the child nodes in a linked list, but its
addition and deletion is done without any lock.  This leads to a
corruption if they are operated concurrently.  Usually this isn't a
problem because the proc entries are added sequentially in the driver
probe procedure itself.  But the card registrations are done often
asynchronously, and the crash could be actually reproduced with
syzkaller.

This patch papers over it by protecting the link addition and deletion
with the parent's mutex.  There is "access" mutex that is used for the
file access, and this can be reused for this purpose as well.

Reported-by: syzbot+48df349490c36f9f54ab@syzkaller.appspotmail.com
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-04-16 15:49:48 +02:00
Takashi Iwai 29b2625ff6 ALSA: info: Move card id proc creation into info.c
The creation of card's id proc file can be moved gracefully into
info.c.  Also, the assignment of card->proc_id is superfluous and can
be dropped.  So let's do it.

Basically this is no functional change but code refactoring, but one
potential behavior change is that now it returns properly the error
code from snd_info_card_register(), which is a good thing (tm).

Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-02-06 18:11:58 +01:00
Takashi Iwai a858ee6655 ALSA: info: Minor optimization
Just a minor code optimization to reduce the source code size
slightly.  No functional changes.

Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-02-06 18:11:58 +01:00
Takashi Iwai 9725752867 ALSA: info: Drop unused snd_info_entry.card field
It's referred only in snd_card_id_read() which can receive the card
object via private_data.

Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-02-06 18:11:58 +01:00
Takashi Iwai 7453e1dafd ALSA: info: Add standard helpers for card proc file entries
Two new helper functions are added here for cleaning up the existing
lengthy calls.

Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-02-06 18:11:55 +01:00
Takashi Iwai 348c5ad5d6 ALSA: info: Always register entries recursively
Make sure that all children entries are registered by a single call of
snd_info_register().  OTOH, don't register if a parent isn't
registered yet.

This allows us to create the whole procfs tree in a shot at the last
stage of card registration phase in a later patch.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-02-05 13:58:03 +01:00
Takashi Iwai 3a55437141 ALSA: proc: Avoid possible leaks of snd_info_entry objects
This patch changes the parent pointer assignment of snd_info_entry
object to be always non-NULL.  More specifically,check the parent
argument in snd_info_create_module_entry() & co, and assign
snd_proc_root if NULL is passed there.

This assures that the proc object is always freed when the root is
freed, so avoid possible memory leaks.  For example, some error paths
(e.g. snd_info_register() error at snd_minor_info_init()) may leave
snd_info_entry object although the proc file itself is freed.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-01-24 14:40:26 +01:00
Joe Perches 6a73cf46ce sound: Use octal not symbolic permissions
Convert the S_<FOO> symbolic permissions to their octal equivalents as
using octal and not symbolic permissions is preferred by many as more
readable.

see: https://lkml.org/lkml/2016/8/2/1945

Done with automated conversion via:
$ ./scripts/checkpatch.pl -f --types=SYMBOLIC_PERMS --fix-inplace <files...>

Miscellanea:

o Wrapped one multi-line call to a single line

Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-28 11:27:20 +02:00
Linus Torvalds a9a08845e9 vfs: do bulk POLL* -> EPOLL* replacement
This is the mindless scripted replacement of kernel use of POLL*
variables as described by Al, done by this script:

    for V in IN OUT PRI ERR RDNORM RDBAND WRNORM WRBAND HUP RDHUP NVAL MSG; do
        L=`git grep -l -w POLL$V | grep -v '^t' | grep -v /um/ | grep -v '^sa' | grep -v '/poll.h$'|grep -v '^D'`
        for f in $L; do sed -i "-es/^\([^\"]*\)\(\<POLL$V\>\)/\\1E\\2/" $f; done
    done

with de-mangling cleanups yet to come.

NOTE! On almost all architectures, the EPOLL* constants have the same
values as the POLL* constants do.  But they keyword here is "almost".
For various bad reasons they aren't the same, and epoll() doesn't
actually work quite correctly in some cases due to this on Sparc et al.

The next patch from Al will sort out the final differences, and we
should be all done.

Scripted-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-02-11 14:34:03 -08:00
Al Viro 680ef72abd sound: annotate ->poll() instances
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2017-11-27 16:20:02 -05:00
Takashi Iwai 35f8001415 ALSA: core: Follow standard EXPORT_SYMBOL() declarations
Just a tidy up to follow the standard EXPORT_SYMBOL*() declarations
in order to improve grep-ability.

- Move EXPORT_SYMBOL*() to the position right after its definition
- Remove superfluous blank line before EXPORT_SYMBOL*() lines

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-06-16 16:19:16 +02:00
Takashi Iwai ffb73b08e7 ALSA: info: Use kvzalloc() for a temporary write buffer
We used to use kmalloc (more exactly, krealloc()) for creating and
growing the temporary buffer for text proc write.  It can grow up to
16kB, and it's already a bit doubtful whether it's always safe to use
kmalloc().  With the recent addition of kvmalloc(), we can have a
better chance for succeed of memory allocation, so let's switch to
that new API.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-05-23 07:04:06 +02:00
Takashi Iwai 6809cd682b ALSA: info: Return error for invalid read/write
Currently the ALSA proc handler allows read or write even if the proc
file were write-only or read-only.  It's mostly harmless, does thing
but allocating memory and ignores the input/output.  But it doesn't
tell user about the invalid use, and it's confusing and inconsistent
in comparison with other proc files.

This patch adds some sanity checks and let the proc handler returning
an -EIO error when the invalid read/write is performed.

Cc: <stable@vger.kernel.org> # v4.2+
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-11-08 14:37:26 +01:00
Takashi Iwai 027a9fe683 ALSA: info: Limit the proc text input size
The ALSA proc handler allows currently the write in the unlimited size
until kmalloc() fails.  But basically the write is supposed to be only
for small inputs, mostly for one line inputs, and we don't have to
handle too large sizes at all.  Since the kmalloc error results in the
kernel warning, it's better to limit the size beforehand.

This patch adds the limit of 16kB, which must be large enough for the
currently existing code.

Cc: stable@vger.kernel.org # v4.2+
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-11-08 13:16:40 +01:00
Takashi Iwai c309c467ed ALSA: info: Drop kerneldoc comment from snd_info_create_entry()
It's no longer a part of API but merely a local function.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-05-18 09:45:11 +02:00
Takashi Iwai 8e7ccb7ba3 ALSA: info: Move list addition to snd_info_create_entry()
Just a minor refactoring, no functional changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-05-18 09:44:28 +02:00
Takashi Iwai 2471b6c80a ALSA: info: Register proc entries recursively, too
The commit [c560a6797e3b: ALSA: core: Remove child proc file elements
recursively] converted snd_card_proc_new() with the normal
snd_info_*() call and removed snd_device chain for such info
entries. However, it misses one point: the creation of the proc entry
was managed by snd_device chain in the former code, and now it's also
gone, which results in no proc files creation at all.  Mea culpa.

This patch makes snd_info_card_register() creating the all pending
child proc entries in a shot.  Also, since snd_card_register() might
be called multiple times, this function is also changed to be callable
multiple times.

Along with the changes above, now the linked list of snd_info_entry is
added at creation time instead of snd_info_register() for keeping eyes
of pending info entries.

Fixes: c560a6797e ('ALSA: core: Remove child proc file elements recursively')
Reported-by: "Lu, Han" <han.lu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-05-18 09:20:24 +02:00
Takashi Iwai 90a409aad4 ALSA: info: Fix leaks of child entries at snd_info_free_entry()
snd_info_free_entry() releases the all children nodes as well, but due
to the wrong timing of releasing the link, the children nodes may be
disconnected but left unreleased.  This patch fixes it by moving the
link free at the right position.  Also it eases list_for_each_entry()
without _safe option in snd_info_disconnect() because it no longer
frees the children nodes there.

Fixes: c560a6797e ('ALSA: core: Remove child proc file elements recursively')
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-05-18 09:10:45 +02:00
Takashi Iwai a0dca822e9 ALSA: core: Clean up OSS proc file management
A few minor cleanups:
- Move the call of snd_info_minor_register() into snd_info_init() so
  that we can call all proc-related stuff in a shot
- Add missing __init prefix to snd_info_minor_register()
- Return an error properly from snd_oss_info_register()
- Drop snd_info_minor_unregister() that is superfluous now

Acked-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-24 17:31:08 +02:00
Takashi Iwai 85d1431807 ALSA: core: Build conditionally and remove superfluous ifdefs
Minor cleanups of Makefile to build some codes conditionally so that
a few ifdefs can be reduced.

Acked-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-24 17:31:07 +02:00
Takashi Iwai b591b6e9e9 ALSA: core: Don't ignore errors at creating proc files
So far we've ignored the errors at creating proc files in many places.
But they should be rather treated seriously.

Also, by assuring the error handling, we can get rid of superfluous
snd_info_free_entry() calls as they will be removed by the parent in
the caller side.

This patch fixes the missing error checks and reduces the superfluous
free calls.

Acked-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-24 17:31:06 +02:00
Takashi Iwai b046d244e2 ALSA: core: Remove superfluous exit calls for proc entries
Since each proc entry is freed automatically by the parent, we don't
have to take care of its life cycle any longer.  This allows us to
reduce a few more lines of codes.

Acked-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-24 17:31:04 +02:00
Takashi Iwai 644dbd64dc ALSA: core: Manage asound root directory with snd_info_entry
Using snd_info_entry for /proc/asound root makes easier to release the
all children, too.  Further cleanups will follow.

Acked-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-24 17:31:02 +02:00
Takashi Iwai c560a6797e ALSA: core: Remove child proc file elements recursively
This patch changes the way to manage the resource release of proc
files: namely, let snd_info_free_entry() freeing the whole children.

This makes it us possible to drop the snd_device_*() management.  Then
snd_card_proc_new() becomes merely a wrapper to
snd_info_create_card_entry().

Together with this change, now you need to call snd_info_free_entry()
for a proc entry created via snd_card_proc_new(), while it was freed
via snd_device_free() beforehand.

Acked-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-24 17:27:57 +02:00
Takashi Iwai 886364f679 ALSA: core: Fix possible memory leaks at error path in info.c
Currently, snd_info_init() just returns an error without releasing the
previously assigned resources at error path.  The assigned proc and
info entries have to be released properly.  This patch covers it.

While we are at it, refactor the code a bit, too.

Acked-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-23 17:11:23 +02:00
Takashi Iwai 4adb7bcbcb ALSA: core: Use seq_file for text proc file reads
seq_file is _the_ standard interface for simple text proc files.
Though, we still need to support the binary proc files and the text
file write, and also we need to manage the device disconnection
gracefully.  Thus this patch just replaces the text file read code
with seq_file while keeping the rest intact.

snd_iprintf() helper function is now a macro to expand itself to
seq_printf() to be compatible with the existing code.  The seq_file
object is stored to the unused entry->rbuffer->buffer pointer.

When the output size is expected to be large (greater than PAGE_SIZE),
the driver should set entry->size field beforehand.  Then the given
size will be preallocated and the multiple show calls can be avoided.

Acked-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-23 17:11:02 +02:00
Clemens Ladisch ddc64b278a ALSA: core: fix buffer overflow in snd_info_get_line()
snd_info_get_line() documents that its last parameter must be one
less than the buffer size, but this API design guarantees that
(literally) every caller gets it wrong.

Just change this parameter to have its obvious meaning.

Reported-by: Tommi Rantala <tt.rantala@gmail.com>
Cc: <stable@vger.kernel.org> # v2.2.26+
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-08-22 07:21:05 +02:00
Takashi Iwai f2f9307a4f ALSA: core: Use standard printk helpers
Use dev_err() & co as much as possible.  If not available (no device
assigned at the calling point), use pr_xxx() helpers instead.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-02-14 08:14:15 +01:00
Takashi Iwai 8eeaa2f9e0 ALSA: Replace with IS_ENABLED()
Replace the lengthy #if defined(XXX) || defined(XXX_MODULE) with the
new IS_ENABLED() macro.

The patch still doesn't cover all ifdefs.  For example, the dependency
on CONFIG_GAMEPORT is still open-coded because this also has an extra
dependency on MODULE.  Similarly, an open-coded ifdef in pcm_oss.c and
some sequencer-related stuff are left untouched.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-02-10 11:42:00 +01:00
Linus Torvalds 9992ba7232 sound updates for v3.10-rc1
Mostly many small changes spread as seen in diffstat in sound/*
 directory by this update.  A significant change in the subsystem level
 is the introduction of snd_soc_component, which will help more generic
 handling of SoC and off-SoC components.
 
 Also, snd_BUG_ON() macro is enabled unconditionally now due to its
 misuses, so people might hit kernel warnings (it's a good thing for
 us).
 
 - compress-offload: support for capture by Charles Keepax
 - HD-audio: codec delay support by Dylan Reid
 - HD-audio: improvements/fixes in generic parser: better headphone mic
   and headset mic support, jack_modes hint consolidation, proper beep
   attach/detachment, generalized power filter controls by David
   Henningsson, et al
 - HD-audio: Improved management of HDMI codec pins/converters
 - HD-audio: Better pin/DAC assignment for VIA codecs
 - HD-audio: Haswell HDMI workarounds
 - HD-audio: ALC268 codec support, a few new quirks for Chromebooks
 - USB: regression fixes: USB-MIDI autopm fix, the recent ISO latency
   fix by Clemens Ladisch
 - USB: support for DSD formats by Daniel Mack
 - USB: A few UAC2 device endian/cock fixes by Eldad Zack
 - USB: quirks for Emu 192kHz support, Novation Twitch DJ controller,
   Yamaha THRxx devices
 - HDSPM: updates for TCO controls by Adrian Knoth
 - ASoC: Add a snd_soc_component object type for generic handling of
   SoC and off-SoC components by Kuninori Morimoto,
 - dmaengine: a large set of cleanups and conversions by Lars-Peter
   Clausen
 - ASoC DAPM: performance optimizations from Ryo Tsutsui
 - ASoC DAPM: support for mixer control sharing by Stephen Warren
 - ASoC: multiplatform ARM cleanups from Arnd Bergmann
 - ASoC: new codec drivers for AK5385 and TAS5086 from Daniel Mack
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.19 (GNU/Linux)
 
 iQIcBAABAgAGBQJRg2bUAAoJEGwxgFQ9KSmksasQAIq1ypbylrLA3vf7PUXmL7Jb
 hMtC5tzasZqJsIZ2fyhiZL8J5yQ78Z5dhjehFWlCbJEaKhsjZVyb67RpuK597b6K
 Ypa30OghbWuCoKjmaXK9AFTuijTxdefmewIJfgwVMYtgA5rBU70qt96NC/b/UQXk
 gEPI740i7EFJL2wfcqRpGoKGO1o80yMuKzIj3gHUZMFHYYhPgvVuGt9cCe3cXwLV
 IBT77PjMoGt1Q7iJQkX4DGlB5n526l1G8a6VptdCou0qyEWfhgSik5I3msNuAXte
 1KYE4zj0Rq4xqN28/D/eAF1o3q+X9aiLttGpG0sJLiwGagdWVFaXLyJDMhZxCbwz
 1F4k+B8UCucojw3HtNzoIQJezoRX2aHMjlAZ50b416hITkg5VQe5+sJBxpjIJo4I
 GSmizUiNahDk9jtI/PEGo7yr8CdRTY3v38mdZRGYxyWgJ1a8sNwQwqUdH6A0D/w6
 3wMp4Y9Zt8AK/kiWLLWvsDVvwRptqplrXistTvv4v2xVJgvU+klDsDpa5Lz7kG7Z
 q43RA4o+yWdG6d1hTgMXp7FGwUkcer7WKWEmAZsQmX03Q0zjZqMhfUwVUtaHIx9c
 6YipHdVMAJ0sz/dYrKnZ92hbZcXNj/A9zfqYWeFlA/18FCO6u4BXODBup8BLwyUm
 hfOv+M/q6haNA98GDHS9
 =sYiI
 -----END PGP SIGNATURE-----

Merge tag 'sound-3.10' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound

Pull sound updates from Takashi Iwai:
 "Mostly many small changes spread as seen in diffstat in sound/*
  directory by this update.  A significant change in the subsystem level
  is the introduction of snd_soc_component, which will help more generic
  handling of SoC and off-SoC components.

  Also, snd_BUG_ON() macro is enabled unconditionally now due to its
  misuses, so people might hit kernel warnings (it's a good thing for
  us).

   - compress-offload: support for capture by Charles Keepax
   - HD-audio: codec delay support by Dylan Reid
   - HD-audio: improvements/fixes in generic parser: better headphone
     mic and headset mic support, jack_modes hint consolidation, proper
     beep attach/detachment, generalized power filter controls by David
     Henningsson, et al
   - HD-audio: Improved management of HDMI codec pins/converters
   - HD-audio: Better pin/DAC assignment for VIA codecs
   - HD-audio: Haswell HDMI workarounds
   - HD-audio: ALC268 codec support, a few new quirks for Chromebooks
   - USB: regression fixes: USB-MIDI autopm fix, the recent ISO latency
     fix by Clemens Ladisch
   - USB: support for DSD formats by Daniel Mack
   - USB: A few UAC2 device endian/cock fixes by Eldad Zack
   - USB: quirks for Emu 192kHz support, Novation Twitch DJ controller,
     Yamaha THRxx devices
   - HDSPM: updates for TCO controls by Adrian Knoth
   - ASoC: Add a snd_soc_component object type for generic handling of
     SoC and off-SoC components by Kuninori Morimoto,
   - dmaengine: a large set of cleanups and conversions by Lars-Peter
     Clausen
   - ASoC DAPM: performance optimizations from Ryo Tsutsui
   - ASoC DAPM: support for mixer control sharing by Stephen Warren
   - ASoC: multiplatform ARM cleanups from Arnd Bergmann
   - ASoC: new codec drivers for AK5385 and TAS5086 from Daniel Mack"

* tag 'sound-3.10' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (315 commits)
  ALSA: usb-audio: caiaq: fix endianness bug in snd_usb_caiaq_maschine_dispatch
  ALSA: asihpi: add format support check in snd_card_asihpi_capture_formats
  ALSA: pcm_format_to_bits strong-typed conversion
  ALSA: compress: fix the states to check for allowing read
  ALSA: hda - Move Thinkpad X220 to use auto parser
  ALSA: USB: adjust for changed 3.8 USB API
  ALSA: usb - Avoid unnecessary sample rate changes on USB 2.0 clock sources
  sound: oss/dmabuf: use dma_map_single
  ALSA: ali5451: use mdelay instead of large udelay constants
  ALSA: hda - Add the support for ALC286 codec
  ALSA: usb-audio: USB quirk for Yamaha THR10C
  ALSA: usb-audio: USB quirk for Yamaha THR5A
  ALSA: usb-audio: USB quirk for Yamaha THR10
  ALSA: usb-audio: Fix autopm error during probing
  ALSA: snd-usb: try harder to find USB_DT_CS_ENDPOINT
  ALSA: sound kconfig typo
  ALSA: emu10k1: Fix dock firmware loading
  ASoC: ux500: forward declare msp_i2s_platform_data
  ASoC: davinci-mcasp: Add Support BCLK-to-LRCLK ratio for TDM modes
  ASoC: davinci-pcm, davinci-mcasp: Clean up active_serializers
  ...
2013-05-03 09:10:23 -07:00
David Howells a8ca16ea7b proc: Supply a function to remove a proc entry by PDE
Supply a function (proc_remove()) to remove a proc entry (and any subtree
rooted there) by proc_dir_entry pointer rather than by name and (optionally)
root dir entry pointer.  This allows us to eliminate all remaining pde->name
accesses outside of procfs.

Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Grant Likely <grant.likely@linaro.or>
cc: linux-acpi@vger.kernel.org
cc: openipmi-developer@lists.sourceforge.net
cc: devicetree-discuss@lists.ozlabs.org
cc: linux-pci@vger.kernel.org
cc: netdev@vger.kernel.org
cc: netfilter-devel@vger.kernel.org
cc: alsa-devel@alsa-project.org
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-05-01 17:29:46 -04:00
David Howells 271a15eabe proc: Supply PDE attribute setting accessor functions
Supply accessor functions to set attributes in proc_dir_entry structs.

The following are supplied: proc_set_size() and proc_set_user().

Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com>
cc: linuxppc-dev@lists.ozlabs.org
cc: linux-media@vger.kernel.org
cc: netdev@vger.kernel.org
cc: linux-wireless@vger.kernel.org
cc: linux-pci@vger.kernel.org
cc: netfilter-devel@vger.kernel.org
cc: alsa-devel@alsa-project.org
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-05-01 17:29:18 -04:00
Al Viro d9dda78bad procfs: new helper - PDE_DATA(inode)
The only part of proc_dir_entry the code outside of fs/proc
really cares about is PDE(inode)->data.  Provide a helper
for that; static inline for now, eventually will be moved
to fs/proc, along with the knowledge of struct proc_dir_entry
layout.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-04-09 14:13:32 -04:00
Al Viro aee0c612b1 snd_info_register: switch to proc_create_data/proc_mkdir_mode
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-04-09 14:13:04 -04:00
Takashi Iwai 0bc0ec903c ALSA: info: Small refactoring and a sanity check in snd_info_get_line()
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-03-13 12:11:13 +01:00
Takashi Iwai 0d861ac238 ALSA: info: Avoid leaking kernel memory
Make sure that the allocated buffer for reading the proc file won't
expose the uncleared kernel memory.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-03-13 12:03:33 +01:00
Yacine Belkadi eb7c06e8e9 ALSA: add/change some comments describing function return values
script/kernel-doc reports the following type of warnings (when run in verbose
mode):

Warning(sound/core/init.c:152): No description found for return value of
'snd_card_create'

To fix that:
- add missing descriptions of function return values
- use "Return:" sections to describe those return values

Along the way:
- complete some descriptions
- fix some typos

Signed-off-by: Yacine Belkadi <yacine.belkadi.1@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-03-12 08:32:53 +01:00
Al Viro 496ad9aa8e new helper: file_inode(file)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-02-22 23:31:31 -05:00
Jaroslav Kysela 4266274836 ALSA: remove the main version information
Remove the main ALSA version number from the kernel ALSA driver.
The ALSA driver package release diverges from the upstream. This may
confuse users to see the same ALSA version for many kernel releases
and this version lost it's original purpose and connection.

The "ioctl" APIs have own version numbers, so the user space may check
for specific API changes only.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2012-09-04 11:38:32 +02:00
Paul Gortmaker da155d5b40 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>
2011-10-31 19:31:21 -04:00
Al Viro e55d92b92d get rid of create_proc_entry() abuses - proc_mkdir() is there for purpose
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-07-24 10:12:33 -04:00
Arnd Bergmann 451a3c24b0 BKL: remove extraneous #include <smp_lock.h>
The big kernel lock has been removed from all these files at some point,
leaving only the #include.

Remove this too as a cleanup.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-11-17 08:59:32 -08:00
Takashi Iwai 73029e0ff1 ALSA: info - Implement common llseek for binary mode
The llseek implementation is identical for existing driver implementations,
so let's merge to the common layer.  The same code for the text proc file
can be used even for the binary proc file.

The driver can provide its own llseek method if needed.  Then the common
code will be skipped.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-04-13 12:01:20 +02:00
Takashi Iwai d97e1b7823 ALSA: info - Check file position validity in common layer
Check the validity of the file position in the common info layer before
calling read or write callbacks in assumption that entry->size is set up
properly to indicate the max file size.

Removed the redundant checks from the callbacks as well.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-04-13 12:01:14 +02:00
Takashi Iwai 067e4a5d23 Merge branch 'topic/bkl' into topic/core-cleanup 2010-04-13 11:24:34 +02:00
Takashi Iwai 5b5cd553e3 ALSA: info - Remove BKL
Use the fine-grained mutex for the assigned info object, instead.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-04-07 18:33:57 +02:00
Tejun Heo 5a0e3ad6af 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>
2010-03-30 22:02:32 +09:00
Takashi Iwai 6a0f402146 Merge branch 'topic/dummy' into for-linus
* topic/dummy:
  ALSA: dummy - Increase MAX_PCM_SUBSTREAMS to 128
  ALSA: dummy - Add debug proc file
  ALSA: Add const prefix to proc helper functions
  ALSA: Re-export snd_pcm_format_name() function
  ALSA: dummy - Fake buffer allocations
  ALSA: dummy - Fix the timer calculation in systimer mode
  ALSA: dummy - Add more description
  ALSA: dummy - Better jiffies handling
  ALSA: dummy - Support high-res timer mode
2009-09-10 15:32:51 +02:00