@@ -438,17 +438,6 @@ int snd_card_disconnect(struct snd_card *card)
438438
439439EXPORT_SYMBOL (snd_card_disconnect );
440440
441- /**
442- * snd_card_free - frees given soundcard structure
443- * @card: soundcard structure
444- *
445- * This function releases the soundcard structure and the all assigned
446- * devices automatically. That is, you don't have to release the devices
447- * by yourself.
448- *
449- * Return: Zero. Frees all associated devices and frees the control
450- * interface associated to given soundcard.
451- */
452441static int snd_card_do_free (struct snd_card * card )
453442{
454443#if IS_ENABLED (CONFIG_SND_MIXER_OSS )
@@ -469,6 +458,15 @@ static int snd_card_do_free(struct snd_card *card)
469458 return 0 ;
470459}
471460
461+ /**
462+ * snd_card_free_when_closed - Disconnect the card, free it later eventually
463+ * @card: soundcard structure
464+ *
465+ * Unlike snd_card_free(), this function doesn't try to release the card
466+ * resource immediately, but tries to disconnect at first. When the card
467+ * is still in use, the function returns before freeing the resources.
468+ * The card resources will be freed when the refcount gets to zero.
469+ */
472470int snd_card_free_when_closed (struct snd_card * card )
473471{
474472 int ret = snd_card_disconnect (card );
@@ -479,6 +477,19 @@ int snd_card_free_when_closed(struct snd_card *card)
479477}
480478EXPORT_SYMBOL (snd_card_free_when_closed );
481479
480+ /**
481+ * snd_card_free - frees given soundcard structure
482+ * @card: soundcard structure
483+ *
484+ * This function releases the soundcard structure and the all assigned
485+ * devices automatically. That is, you don't have to release the devices
486+ * by yourself.
487+ *
488+ * This function waits until the all resources are properly released.
489+ *
490+ * Return: Zero. Frees all associated devices and frees the control
491+ * interface associated to given soundcard.
492+ */
482493int snd_card_free (struct snd_card * card )
483494{
484495 struct completion released ;
0 commit comments