X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=sound%2Fcore%2Fsound_oss.c;h=e1d79ee3590650d12e9d2c99a260ae63aed221c2;hb=a0830dbd4e42b38aefdf3fb61ba5019a1a99ea85;hp=e9528333e36d01e6e0282255639da08b7174e505;hpb=054552272e6e152ff40f8b7f164dd390a5a62097;p=profile%2Fivi%2Fkernel-adaptation-intel-automotive.git diff --git a/sound/core/sound_oss.c b/sound/core/sound_oss.c index e952833..e1d79ee 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 (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);