summaryrefslogtreecommitdiff
path: root/sound/core/sound_oss.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2012-11-14 08:49:49 +0100
committerIngo Molnar <mingo@kernel.org>2012-11-14 08:49:49 +0100
commita7a0aaa17ace589897021d668e09d474e7fc4c4d (patch)
tree41de5bb6fb7135d950ef8b344e1e02d1208449c8 /sound/core/sound_oss.c
parent38ca9c927c7d3db61f57e3d3a9334958c3af6e9a (diff)
parent77b67063bb6bce6d475e910d3b886a606d0d91f7 (diff)
Merge tag 'v3.7-rc5' into sched/core
Merge Linux 3.7-rc5, to pick up fixes. Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'sound/core/sound_oss.c')
-rw-r--r--sound/core/sound_oss.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/sound/core/sound_oss.c b/sound/core/sound_oss.c
index e9528333e36d..726a49ac9725 100644
--- a/sound/core/sound_oss.c
+++ b/sound/core/sound_oss.c
@@ -40,6 +40,9 @@
static struct snd_minor *snd_oss_minors[SNDRV_OSS_MINORS];
static DEFINE_MUTEX(sound_oss_mutex);
+/* NOTE: This function increments the refcount of the associated card like
+ * snd_lookup_minor_data(); the caller must call snd_card_unref() appropriately
+ */
void *snd_lookup_oss_minor_data(unsigned int minor, int type)
{
struct snd_minor *mreg;
@@ -49,9 +52,11 @@ void *snd_lookup_oss_minor_data(unsigned int minor, int type)
return NULL;
mutex_lock(&sound_oss_mutex);
mreg = snd_oss_minors[minor];
- if (mreg && mreg->type == type)
+ if (mreg && mreg->type == type) {
private_data = mreg->private_data;
- else
+ if (private_data && mreg->card_ptr)
+ atomic_inc(&mreg->card_ptr->refcount);
+ } else
private_data = NULL;
mutex_unlock(&sound_oss_mutex);
return private_data;
@@ -123,6 +128,7 @@ int snd_register_oss_device(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_oss_mutex);
snd_oss_minors[minor] = preg;
minor_unit = SNDRV_MINOR_OSS_DEVICE(minor);