- 06 Feb, 2019 2 commits
-
-
Takashi Iwai authored
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>
-
Takashi Iwai authored
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>
-
- 28 May, 2018 1 commit
-
-
Joe Perches authored
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>
-
- 27 Feb, 2018 1 commit
-
-
Jaejoong Kim authored
The show() method should use scnprintf() not snprintf() because snprintf() may returns a value that exceeds its second argument. Signed-off-by:
Jaejoong Kim <climbbb.kim@gmail.com> Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
- 11 Feb, 2018 1 commit
-
-
Linus Torvalds authored
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>
-
- 27 Nov, 2017 1 commit
-
-
Al Viro authored
Signed-off-by:
Al Viro <viro@zeniv.linux.org.uk>
-
- 11 Oct, 2017 1 commit
-
-
Takashi Iwai authored
In case of user unbind ALSA driver during playing back / capturing, each driver needs to stop and remove it correctly. One note here is that we can't cancel from remove function in such case, because unbind operation doesn't check return value from remove function. So, we *must* stop and remove in this case. For this purpose, we need to sync (= wait) until the all top-level operations are canceled at remove function. For example, snd_card_free() processes the disconnection procedure at first, then waits for the completion. That's how the hot-unplug works safely. It's implemented, at least, in the top-level driver removal. Now for the lower level driver, we need a similar strategy. Notify to the toplevel for hot-unplug (disconnect in ALSA), and sync with the stop operation, then continue the rest of its own remove procedure. This patch adds snd_card_disconnect_sync(), and driver can use it from remove function. Note: the "lower level" driver here refers to a middle layer driver (e.g. ASoC components) that can be unbound freely during operation. Most of legacy ALSA helper drivers don't have such a problem because they can't be unbound. Note#2: snd_card_disconnect_sync() merely calls snd_card_disconnect() and syncs with closing all pending files. It takes only the files opened by user-space into account, and doesn't care about object refcounts. (The latter is handled by snd_card_free() completion call, BTW.) Also, the function doesn't free resources by itself. Tested-by:
Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
- 30 Aug, 2017 1 commit
-
-
Takashi Iwai authored
Currently we're taking power_lock at each card component for assuring the power-up sequence, but it doesn't help anything in the implementation at the moment: it just serializes unnecessarily the callers, but it doesn't protect about the power state change itself. It used to have some usefulness in the early days where we managed the PM manually. But now the suspend/resume core procedure is beyond our hands, and power_lock lost its meaning. This patch drops the power_lock from allover the places. There shouldn't be any issues by this change, as it's no helper regarding the power state change. Rather we'll get better performance by removing the serialization; which is the only slight concern of any behavior change, but it can't be a showstopper, after all. Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
- 04 Aug, 2017 1 commit
-
-
Takashi Sakamoto authored
At a previous commit, concurrent requests for TLV data are maintained exclusively between read requests and write/command requests. TLV callback handlers in each driver has no risk from concurrent access for reference/change. In current implementation, 'struct snd_card' has a mutex to control concurrent accesses to user-defined element sets. This commit obsoletes it. Signed-off-by:
Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
- 20 Jun, 2017 1 commit
-
-
Ingo Molnar authored
Rename: wait_queue_t => wait_queue_entry_t 'wait_queue_t' was always a slight misnomer: its name implies that it's a "queue", but in reality it's a queue *entry*. The 'real' queue is the wait queue head, which had to carry the name. Start sorting this out by renaming it to 'wait_queue_entry_t'. This also allows the real structure name 'struct __wait_queue' to lose its double underscore and become 'struct wait_queue_entry', which is the more canonical nomenclature for such data types. Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: linux-kernel@vger.kernel.org Signed-off-by:
Ingo Molnar <mingo@kernel.org>
-
- 16 Jun, 2017 1 commit
-
-
Takashi Iwai authored
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>
-
- 12 Jan, 2016 1 commit
-
-
Heiner Kallweit authored
Currently the info in /proc/interrupts doesn't allow to figure out which interrupt belongs to which card (HDMI, PCH, ..). Therefore add card details to the interrupt description. With the patch the info in /proc/interrupts looks like this: PCI-MSI 442368-edge snd_hda_intel:card1 PCI-MSI 49152-edge snd_hda_intel:card0 NOTE: this patch adds the new irq_descr field snd_card struct that is filled automatically at a card object creation. This can be used generically for other drivers as well. The changes for others will follow later -- tiwai Signed-off-by:
Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
- 29 Jun, 2015 1 commit
-
-
Colin Ian King authored
Static analysis with cppcheck found the following error: [sound/core/init.c:118]: (error) Uninitialized variable: err ..this was introduced by commit 2471b6c8 ("ALSA: info: Register proc entries recursively, too") where the call to snd_info_card_register was removed and no longer setting the error return in err. When snd_info_create_card_entry fails to allocate a an entry, the error path exits with garbage in err. Fix is to return -ENOMEM if entry fails to be allocated. Fixes: 2471b6c8 ("ALSA: info: Register proc entries recursively, too") Signed-off-by:
Colin Ian King <colin.king@canonical.com> Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
- 27 May, 2015 1 commit
-
-
Jie Yang authored
We may disable proc fs only for sound part, to reduce ALSA memory footprint. So add CONFIG_SND_PROC_FS and replace the old CONFIG_PROC_FSs in alsa code. With sound proc fs disabled, we can save about 9KB memory size on X86_64 platform. Signed-off-by:
Jie Yang <yang.jie@intel.com> Reviewed-by:
Mark Brown <broonie@kernel.org> Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
- 18 May, 2015 1 commit
-
-
Takashi Iwai authored
The commit [c560a679: 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: c560a679 ('ALSA: core: Remove child proc file elements recursively') Reported-by:
"Lu, Han" <han.lu@intel.com> Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
- 24 Apr, 2015 2 commits
-
-
Takashi Iwai authored
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>
-
Takashi Iwai authored
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>
-
- 03 Mar, 2015 1 commit
-
-
Takashi Iwai authored
Revive snd_device_disconnect() again so that it can be called from the individual driver. This time, HD-audio will need it. Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
- 06 Feb, 2015 1 commit
-
-
Takashi Iwai authored
For assigning sysfs entries for a card device from the driver, introduce a new helper function, snd_card_add_dev_attr(). In this way, we can avoid the possible race between the device registration and the sysfs addition / removal. The driver can pass a new attribute group to add freely. This has to be called before snd_card_register(). Currently, up to two extra groups can be added. More than that, it'll return an error. Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
- 02 Feb, 2015 1 commit
-
-
Takashi Iwai authored
Introduce a new helper function snd_device_initialize() to initialize the device object for sound devices. Reviewed-by:
Jaroslav Kysela <perex@perex.cz> Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
- 30 Oct, 2014 1 commit
-
-
Takashi Iwai authored
Some functions missed the proper kerneldoc comments. Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
- 18 Jun, 2014 1 commit
-
-
Lars-Peter Clausen authored
The user-control put and get handlers as well as the tlv do not protect against concurrent access from multiple threads. Since the state of the control is not updated atomically it is possible that either two write operations or a write and a read operation race against each other. Both can lead to arbitrary memory disclosure. This patch introduces a new lock that protects user-controls from concurrent access. Since applications typically access controls sequentially than in parallel a single lock per card should be fine. Signed-off-by:
Lars-Peter Clausen <lars@metafoo.de> Acked-by:
Jaroslav Kysela <perex@perex.cz> Cc: <stable@vger.kernel.org> Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
- 25 Feb, 2014 2 commits
-
-
Takashi Iwai authored
A few code cleanups and optimizations. In addition, drop snd_device_disconnect() that isn't used at all, and drop the return values from snd_device_free*(). Another slight difference by this change is that now the device state will become always SNDRV_DEV_REGISTERED no matter whether dev_register ops is present or not. It's for better consistency. There should be no impact for the current tree, as the state isn't checked. Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
Takashi Iwai authored
Basically, the device type specifies the priority of the device to be registered / freed, too. However, the priority value isn't well utilized but only it's checked as a group. This results in inconsistent register and free order (where each of them should be in reversed direction). This patch simplifies the device list management code by simply inserting a list entry at creation time in an incremental order for the priority value. Since we can just follow the link for register, disconnect and free calls, we don't have to specify the group; so the whole enum definitions are also simplified as well. The visible change to outside is that the priorities of some object types are revisited. For example, now the SNDRV_DEV_LOWLEVEL object is registered before others (control, PCM, etc) and, in return, released after others. Similarly, SNDRV_DEV_CODEC is in a lower priority than SNDRV_DEV_BUS for ensuring the dependency. Also, the unused SNDRV_DEV_TOPLEVEL, SNDRV_DEV_LOWLEVEL_PRE and SNDRV_DEV_LOWLEVEL_NORMAL are removed as a cleanup. Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
- 19 Feb, 2014 1 commit
-
-
Takashi Iwai authored
While moving the card device into struct snd_card, the reference to the assigned card in sysfs show/store callbacks were forgotten to be refreshed, still accessing to the no longer used drvdata. Fix these places to refer correctly via container_of(). Also, remove the superfluous NULL checks since it's guaranteed to be non-NULL now. Fixes: 8bfb181c ('ALSA: Embed card device into struct snd_card') Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
- 14 Feb, 2014 4 commits
-
-
Takashi Iwai authored
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>
-
Takashi Iwai authored
Drop the own refcount but use the standard device refcounting via get_device() and put_device(). Introduce a new completion to snd_card instead of the wait queue for syncing the last release, which is used in snd_card_free(). Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
Takashi Iwai authored
... instead of calling device_create_file() manually. No functional change. Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
Takashi Iwai authored
As prepared in the previous patch, we are ready to create a device struct for the card object in snd_card_create() now. This patch changes the scheme from the old style to: - embed a device struct for the card object into snd_card struct, - initialize the card device in snd_card_create() (but not register), - registration is done in snd_card_register() via device_add() The actual card device is stored in card->card_dev. The card->dev pointer is kept unchanged and pointing to the parent device as before for compatibility reason. Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
- 12 Feb, 2014 1 commit
-
-
Takashi Iwai authored
This is a part of preliminary works for modernizing the ALSA device structure. So far, we set card->dev at later point after the object creation. Because of this, the core layer doesn't always know which device is being handled before it's actually registered, and it makes impossible to show the device in error messages, for example. The first goal is to achieve a proper struct device initialization at the very beginning of probing. As a first step, this patch introduces snd_card_new() function (yes there was the same named function in the very past), in order to receive the parent device pointer from the very beginning. snd_card_create() is marked as deprecated. At this point, there is no functional change other than that. The actual change of the device creation scheme will follow later. Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
- 10 Feb, 2014 1 commit
-
-
Takashi Iwai authored
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>
-
- 23 Jan, 2014 2 commits
-
-
Takashi Iwai authored
There are two loops that are almost identical but only with different checks. Refactor them with a simple helper, and give a bit more comments what's doing there. Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
Dan Carpenter authored
The test here is intended intended to prevent shift wrapping bugs when we do "1U << idx2". We should consider the number of bits in a u32 instead of the number of bytes. [fix another chunk similarly by tiwai] Fixes: 7bb2491b ('ALSA: Add kconfig to specify the max card numbers') Signed-off-by:
Dan Carpenter <dan.carpenter@oracle.com> Cc: <stable@vger.kernel.org> Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
- 29 Oct, 2013 2 commits
-
-
Takashi Iwai authored
When no proper id string is given, the driver tries to fall back to copy the proc_root name string via strcpy(), but this might overflow the fixed string size. Let's use strlcpy(). Spotted by coverity CID 139008. Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
Takashi Iwai authored
module->name is a fixed array, so we can check the empty contents straightforwardly in module_slot_match(). Spotted by coverity CID 1056786. Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
- 24 May, 2013 2 commits
-
-
Takashi Iwai authored
Currently ALSA supports up to 32 card instances when the dynamic minor is used. While 32 cards are usually big enough for normal use cases, there are sometimes weird requirements with more card support. Actually, this limitation, 32, comes from the index option, where you can pass the bit mask to assign the card. Other than that, we can actually give more cards up to the minor number limits (currently 256, which can be extended more, too). This patch adds a new Kconfig to specify the max card numbers, and changes a few places to accept more than 32 cards. The only incompatibility with high card numbers would be the handling of index option. The index option can be still used to pass the bitmask for card assignments, but this works only up to 32 slots. More than 32, no bitmask style option is available but only a single slot can be specified via index option. Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
Takashi Iwai authored
ALSA core tries to add a suffix as "_1" automatically when the given id string conflicts. The current code assumes implicitly that the max card number is 16 so that the single hex "_X" suffix can be put. However, with the dynamic device management, the card can be at most 32, so it can put even a non-hex character there. Also, when the max card number is increased in future, this would result in worse. This patch rewrites the code to add the suffix string in a simpler (thus cleaner) way. It can support up to three digits, so it should suffice for most requirements. Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
- 12 Mar, 2013 1 commit
-
-
Yacine Belkadi authored
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>
-
- 30 Oct, 2012 1 commit
-
-
Takashi Iwai authored
For more strict protection for wild disconnections, a refcount is introduced to the card instance, and let it up/down when an object is referred via snd_lookup_*() in the open ops. The free-after-last-close check is also changed to check this refcount instead of the empty list, too. Reported-by:
Matthieu CASTET <matthieu.castet@parrot.com> Cc: <stable@vger.kernel.org> Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
- 11 Mar, 2012 1 commit
-
-
Paul Gortmaker authored
For files that are actively using linux/device.h, make sure that they call it out. This will allow us to clean up some of the implicit uses of linux/device.h within include/* without introducing build regressions. Yes, this was created by "cheating" -- i.e. the headers were cleaned up, and then the fallout was found and fixed, and then the two commits were reordered. This ensures we don't introduce build regressions into the git history. Signed-off-by:
Paul Gortmaker <paul.gortmaker@windriver.com>
-