diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-11-16 22:27:58 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-11-16 22:27:58 -0500 |
commit | d05f06e60df4f56a70fb8a3e46335b40687169e9 (patch) | |
tree | c1eec6749fed86a21b08606e1e4acefe4b033253 /sound/core/sound.c | |
parent | 0af1c5300db31f25a412e6e83d42b1747d56c9de (diff) | |
parent | 1d72d9f83df057e71c7951def41138a0230bf737 (diff) | |
download | blackbird-op-linux-d05f06e60df4f56a70fb8a3e46335b40687169e9.tar.gz blackbird-op-linux-d05f06e60df4f56a70fb8a3e46335b40687169e9.zip |
Merge branch 'arch-frv' into no-rebases
Diffstat (limited to 'sound/core/sound.c')
-rw-r--r-- | sound/core/sound.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/sound/core/sound.c b/sound/core/sound.c index 643976000ce8..89780c323f19 100644 --- a/sound/core/sound.c +++ b/sound/core/sound.c @@ -98,6 +98,10 @@ static void snd_request_other(int minor) * * Checks that a minor device with the specified type is registered, and returns * its user data pointer. + * + * This function increments the reference counter of the card instance + * if an associated instance with the given minor number and type is found. + * The caller must call snd_card_unref() appropriately later. */ void *snd_lookup_minor_data(unsigned int minor, int type) { @@ -108,9 +112,11 @@ void *snd_lookup_minor_data(unsigned int minor, int type) return NULL; mutex_lock(&sound_mutex); mreg = snd_minors[minor]; - if (mreg && mreg->type == type) + if (mreg && mreg->type == type) { private_data = mreg->private_data; - else + if (mreg->card_ptr) + atomic_inc(&mreg->card_ptr->refcount); + } else private_data = NULL; mutex_unlock(&sound_mutex); return private_data; @@ -275,6 +281,7 @@ int snd_register_device_for_dev(int type, struct snd_card *card, int dev, preg->device = dev; preg->f_ops = f_ops; preg->private_data = private_data; + preg->card_ptr = card; mutex_lock(&sound_mutex); #ifdef CONFIG_SND_DYNAMIC_MINORS minor = snd_find_free_minor(type); |