diff options
author | Mark Farrugia <mark.farrugia@fiberdyne.com.au> | 2019-04-03 17:37:54 +1100 |
---|---|---|
committer | Mark Farrugia <mark.farrugia@fiberdyne.com.au> | 2019-04-08 13:57:46 +1000 |
commit | 16912fcce2802752ba11b884d920c71cae5eb1c9 (patch) | |
tree | a5a1f56d81e7fe6a10e545697430daa7769cca6c /core.c | |
parent | 92c383e87fffd5fd22c553e30b9fc94f2cb5f9c0 (diff) |
Refactor 'sealed' to 'configured'
Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
Diffstat (limited to 'core.c')
-rw-r--r-- | core.c | 30 |
1 files changed, 18 insertions, 12 deletions
@@ -35,7 +35,7 @@ MODULE_LICENSE("GPL v2"); static struct snd_avirt_core core = { .version = { 0, 0, 1 }, .stream_count = 0, - .streams_sealed = false, + .streams_configured = false, }; static LIST_HEAD(audiopath_list); @@ -153,7 +153,7 @@ int snd_avirt_stream_try_complete(struct snd_avirt_stream *stream) struct snd_avirt_route *route; struct snd_pcm_ops *pcm_ops_ap; - if (snd_avirt_streams_sealed()) + if (snd_avirt_streams_configured()) return -EPERM; if ((stream->channels == 0) || (!strcmp(stream->map, "none"))) @@ -475,8 +475,8 @@ int snd_avirt_audiopath_register(struct snd_avirt_audiopath *audiopath) list_add_tail(&audiopath_obj->list, &audiopath_list); - // If we have already sealed the streams, configure this AP - if (core.streams_sealed) { + // If we have already configured the streams, configure this AP + if (core.streams_configured) { stream_array.count = 0; if (snd_avirt_streams_get(audiopath->uid, &stream_array) > 0) audiopath->configure(core.card, &stream_array); @@ -585,14 +585,14 @@ struct snd_avirt_stream *snd_avirt_stream_create(const char *name, return stream; } -int snd_avirt_streams_seal(void) +int snd_avirt_streams_configure(void) { int err = 0, i = 0; struct snd_avirt_audiopath_obj *ap_obj; struct snd_avirt_stream_array stream_array; - if (core.streams_sealed) { - D_ERRORK("streams are already sealed!"); + if (core.streams_configured) { + D_ERRORK("streams are already configured!"); return -1; } @@ -604,19 +604,25 @@ int snd_avirt_streams_seal(void) 0) continue; - D_INFOK("Do configure for AP: %s streams:%d", ap_obj->path->uid, - stream_array.count); + if (!ap_obj->path->configure) { + D_ERRORK("Cannot do 'configure' for AP: %s", + ap_obj->path->uid); + return -EFAULT; + } + + D_INFOK("Do 'configure' for AP: %s streams:%d", + ap_obj->path->uid, stream_array.count); ap_obj->path->configure(core.card, &stream_array); } - core.streams_sealed = true; + core.streams_configured = true; return err; } -bool snd_avirt_streams_sealed(void) +bool snd_avirt_streams_configured(void) { - return core.streams_sealed; + return core.streams_configured; } struct snd_avirt_stream *snd_avirt_stream_find_by_device(unsigned int device) |