summaryrefslogtreecommitdiffstats
path: root/configfs.c
diff options
context:
space:
mode:
authorMark Farrugia <mark.farrugia@fiberdyne.com.au>2019-04-03 17:41:32 +1100
committerMark Farrugia <mark.farrugia@fiberdyne.com.au>2019-04-03 17:41:32 +1100
commitde95b5d9cb985acf9e28ea4e1a8592d335e601b1 (patch)
treeaf02bdc00e2c2dd0242e97fe1dc8002ca6df24ae /configfs.c
parente152900bc73f1f7d3b33aa5369c36da762b0b042 (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 'configfs.c')
-rw-r--r--configfs.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/configfs.c b/configfs.c
index 4f88bf8..8f2d452 100644
--- a/configfs.c
+++ b/configfs.c
@@ -285,8 +285,7 @@ static void cfg_snd_avirt_stream_release(struct config_item *item)
}
D_INFOK("Release stream: %s", stream->name);
- kfree(stream->pcm_ops);
- kfree(stream);
+ snd_avirt_stream_try_destroy(stream);
}
static void cfg_snd_avirt_route_release(struct config_item *item)
@@ -420,12 +419,12 @@ cfg_snd_avirt_stream_group_configured_store(struct config_item *item,
CHK_ERR(kstrtoul(p, 10, &tmp));
- if (tmp != 1) {
- D_ERRORK("streams can only be sealed, not unsealed!");
+ if (tmp > 1) {
+ D_ERRORK("Configure streams must be 0 or 1!");
return -ERANGE;
}
- snd_avirt_streams_seal();
+ (tmp) ? snd_avirt_streams_configure() : snd_avirt_streams_unconfigure();
return count;
}