From 8c7cba43618d1aca05cad1e10ea238a082e313ee Mon Sep 17 00:00:00 2001 From: Mark Farrugia Date: Fri, 1 Mar 2019 17:34:08 +1100 Subject: Restructure streams_seal algorithm, formatting fixes. Signed-off-by: Mark Farrugia --- .vscode/settings.json | 13 +++++++------ configfs.c | 6 ++++-- core.c | 22 +++++++++++----------- 3 files changed, 22 insertions(+), 19 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 4dc08b0..0839b43 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,8 +1,9 @@ { - "editor.tabSize": 8, - "editor.insertSpaces": false, - "editor.rulers": [ - 80 - ], - "editor.formatOnSave": true, + "editor.tabSize": 8, + "editor.insertSpaces": false, + "editor.rulers": [ + 80 + ], + "editor.formatOnSave": true, + "editor.trimAutoWhitespace": true } \ No newline at end of file diff --git a/configfs.c b/configfs.c index 58e523f..5668cb3 100644 --- a/configfs.c +++ b/configfs.c @@ -358,8 +358,10 @@ static struct config_item_type cfg_avirt_group_type = { }; static struct configfs_subsystem cfg_subsys = { - .su_group = { - .cg_item = { + .su_group = + { + .cg_item = + { .ci_namebuf = "snd-avirt", .ci_type = &cfg_avirt_group_type, }, diff --git a/core.c b/core.c index e1b056e..a618bfe 100644 --- a/core.c +++ b/core.c @@ -187,9 +187,7 @@ struct snd_avirt_audiopath *snd_avirt_audiopath_get(const char *uid) { struct snd_avirt_audiopath_obj *ap_obj; - list_for_each_entry(ap_obj, &audiopath_list, list) { - //D_INFOK("snd_avirt_audiopath_get, map:%s", uid); - + list_for_each_entry (ap_obj, &audiopath_list, list) { if (!strcmp(ap_obj->path->uid, uid)) return ap_obj->path; } @@ -339,16 +337,18 @@ int snd_avirt_streams_seal(void) return -1; } - list_for_each_entry(ap_obj, &audiopath_list, list) { + list_for_each_entry (ap_obj, &audiopath_list, list) { for (i = 0; i < MAX_STREAMS; i++) stream_array.streams[i] = NULL; stream_array.count = 0; - if (snd_avirt_streams_get(ap_obj->path->uid, &stream_array) > - 0) { - D_INFOK("Do configure for AP: %s streams:%d", - ap_obj->path->uid, stream_array.count); - ap_obj->path->configure(core.card, &stream_array); - } + if (snd_avirt_streams_get(ap_obj->path->uid, &stream_array) <= + 0) + continue; + + D_INFOK("Do configure for AP: %s streams:%d cb:%p", + ap_obj->path->uid, stream_array.count, + ap_obj->path->configure); + ap_obj->path->configure(core.card, &stream_array); } core.streams_sealed = true; @@ -372,7 +372,7 @@ struct snd_avirt_stream *snd_avirt_stream_find_by_device(unsigned int device) return ERR_PTR(-EINVAL); } - list_for_each(entry, &core.stream_group->cg_children) { + list_for_each (entry, &core.stream_group->cg_children) { item = container_of(entry, struct config_item, ci_entry); stream = snd_avirt_stream_from_config_item(item); if (!stream) -- cgit 1.2.3-korg