diff options
author | Mark Farrugia <mark.farrugia@fiberdyne.com.au> | 2019-01-04 18:22:35 +1100 |
---|---|---|
committer | Mark Farrugia <mark.farrugia@fiberdyne.com.au> | 2019-01-04 18:23:17 +1100 |
commit | e423837602e5cdc11a0912f4bd27904d4e0c6946 (patch) | |
tree | ea020146810cf26499daded939fd8e608117f719 | |
parent | dbfb35abbe8548fe5e33763bcab5a5c04ade0d36 (diff) |
Create PCM devices as soon as the AVIRT map is setguppy_6.99.4guppy/6.99.46.99.4
We no longer need to wait until the card is sealed to create the PCM device. We can create it right away.
Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
-rw-r--r-- | configfs.c | 5 | ||||
-rw-r--r-- | core.c | 17 | ||||
-rw-r--r-- | core.h | 2 |
3 files changed, 12 insertions, 12 deletions
@@ -49,6 +49,11 @@ static ssize_t cfg_snd_avirt_stream_map_store(struct config_item *item, split = strsep((char **)&page, "\n"); memcpy(stream->map, (char *)split, count); + /* Create the PCM device now */ + stream->pcm = snd_avirt_pcm_create(stream); + if (IS_ERROR_NULL(stream->pcm)) + return 0; + return count; } CONFIGFS_ATTR(cfg_snd_avirt_stream_, map); @@ -220,7 +220,7 @@ static void pcm_private_data_free(struct snd_pcm *pcm) kfree(pcm->private_data); } -static struct snd_pcm *pcm_create(struct snd_avirt_stream *stream) +struct snd_pcm *snd_avirt_pcm_create(struct snd_avirt_stream *stream) { struct snd_avirt_private_data *avirt_private_data; struct snd_avirt_audiopath *audiopath; @@ -270,8 +270,11 @@ static struct snd_pcm *pcm_create(struct snd_avirt_stream *stream) err = snd_pcm_new(core.card, stream->name, stream->device, playback, capture, &pcm); - if (err < 0) + if (err < 0) { + D_ERRORK("Failed to create PCM device for stream: '%s'", + stream->name); return ERR_PTR(err); + } /** Register driver callbacks */ if (playback) @@ -441,16 +444,6 @@ int snd_avirt_streams_seal(void) return -1; } - 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) - return -EFAULT; - stream->pcm = pcm_create(stream); - if (IS_ERR_OR_NULL(stream->pcm)) - return (PTR_ERR(stream->pcm)); - } - list_for_each_entry(ap_obj, &audiopath_list, list) { D_INFOK("configure() AP uid: %s", ap_obj->path->uid); for (i = 0; i < MAX_STREAMS; i++) @@ -69,6 +69,8 @@ struct snd_avirt_stream *snd_avirt_stream_find_by_device(unsigned int device); struct snd_avirt_stream *snd_avirt_stream_create(const char *name, int direction); +struct snd_pcm *snd_avirt_pcm_create(struct snd_avirt_stream *stream); + /** * snd_avirt_audiopath_get - retrieves the Audio Path by it's UID * @uid: Unique ID for the Audio Path |