diff options
author | Mark Farrugia <mark.farrugia@fiberdyne.com.au> | 2019-04-03 17:41:32 +1100 |
---|---|---|
committer | Mark Farrugia <mark.farrugia@fiberdyne.com.au> | 2019-04-03 17:41:32 +1100 |
commit | de95b5d9cb985acf9e28ea4e1a8592d335e601b1 (patch) | |
tree | af02bdc00e2c2dd0242e97fe1dc8002ca6df24ae /loopback | |
parent | e152900bc73f1f7d3b33aa5369c36da762b0b042 (diff) |
Introduce 'unconfigure' callback
The 'unconfigure' callback can be used to clean up the 'configured'
state of an Audio Path, for when it is desired to reset the streams,
and/or reload a different stream configuration.
To destroy the streams, we must attempt to force their PCMs
closed. Take note though, that if a PCM is being written to when
an unconfigure command is issued, system instability may occur.
Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
Diffstat (limited to 'loopback')
-rw-r--r-- | loopback/loopback.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/loopback/loopback.c b/loopback/loopback.c index de0f38a..49c188d 100644 --- a/loopback/loopback.c +++ b/loopback/loopback.c @@ -1080,6 +1080,14 @@ static int loopbackap_configure(struct snd_card *card, return 0; } +static int loopbackap_unconfigure(void) +{ + mutex_destroy(&loopback->cable_lock); + kfree(loopback); + + return 0; +} + /******************************************************************************* * Loopback Audio Path AVIRT registration ******************************************************************************/ @@ -1091,6 +1099,7 @@ static struct snd_avirt_audiopath loopbackap_module = { .pcm_playback_ops = &loopbackap_pcm_ops, .pcm_capture_ops = &loopbackap_pcm_ops, .configure = loopbackap_configure, + .unconfigure = loopbackap_unconfigure, }; static int __init alsa_card_loopback_init(void) @@ -1108,6 +1117,8 @@ static int __init alsa_card_loopback_init(void) static void __exit alsa_card_loopback_exit(void) { + mutex_destroy(&loopback->cable_lock); + kfree(loopback); snd_avirt_audiopath_deregister(&loopbackap_module); } |