diff options
author | Mark Farrugia <mark.farrugia@fiberdyne.com.au> | 2018-10-31 18:41:33 +1100 |
---|---|---|
committer | Mark Farrugia <mark.farrugia@fiberdyne.com.au> | 2018-10-31 18:41:33 +1100 |
commit | 0765c6c497379a9f850d15be3b3cbdaba59fe7fc (patch) | |
tree | 9059ea9d2e62080e4a55f8f30868d6f72485e5f8 | |
parent | 80973a617ada9181a40a69e25b7f23e7c02bc545 (diff) |
Remove coreinfo, absorb version info into core
Since coreinfo only has version info, and this is not being used
at all, we can absorb the version info into the private
avirt_core structure.
We could in future implement a function to retrieve the version,
when, and if, it is required.
Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
-rw-r--r-- | core.c | 13 | ||||
-rw-r--r-- | core.h | 1 | ||||
-rw-r--r-- | dummy/dummy.c | 8 | ||||
-rw-r--r-- | loopback/loopback.c | 7 | ||||
-rw-r--r-- | sound/avirt.h | 11 |
5 files changed, 12 insertions, 28 deletions
@@ -28,14 +28,11 @@ MODULE_LICENSE("GPL v2"); #define SND_AVIRTUAL_DRIVER "snd_avirt" static struct snd_avirt_core core = { + .version = { 0, 0, 1 }, .stream_count = 0, .streams_sealed = false, }; -struct snd_avirt_coreinfo coreinfo = { - .version = { 0, 0, 1 }, -}; - static LIST_HEAD(audiopath_list); struct snd_avirt_audiopath_obj { @@ -256,11 +253,9 @@ struct snd_avirt_audiopath *snd_avirt_audiopath_get(const char *uid) /** * snd_avirt_audiopath_register - register Audio Path with AVIRT * @audiopath: Audio Path to be registered - * @core: ALSA virtual driver core info * @return: 0 on success or error code otherwise */ -int snd_avirt_audiopath_register(struct snd_avirt_audiopath *audiopath, - struct snd_avirt_coreinfo **info) +int snd_avirt_audiopath_register(struct snd_avirt_audiopath *audiopath) { struct snd_avirt_audiopath_obj *audiopath_obj; @@ -451,8 +446,8 @@ static int __init core_init(void) { int err; - D_INFOK("Alsa Virtual Sound Driver avirt-%d.%d.%d", coreinfo.version[0], - coreinfo.version[1], coreinfo.version[2]); + D_INFOK("Alsa Virtual Sound Driver avirt-%d.%d.%d", core.version[0], + core.version[1], core.version[2]); core.avirt_class = class_create(THIS_MODULE, SND_AVIRTUAL_DRIVER); if (IS_ERR(core.avirt_class)) { @@ -17,6 +17,7 @@ extern struct snd_pcm_ops pcm_ops; struct snd_avirt_core { + int version[3]; struct snd_card *card; struct device *dev; struct class *avirt_class; diff --git a/dummy/dummy.c b/dummy/dummy.c index 5f19564..7c85531 100644 --- a/dummy/dummy.c +++ b/dummy/dummy.c @@ -34,8 +34,6 @@ MODULE_LICENSE("GPL v2"); #define get_dummy_ops(substream) \ (*(const struct dummy_timer_ops **)(substream)->runtime->private_data) -static struct snd_avirt_coreinfo *coreinfo; - /******************************************************************************* * System Timer Interface * @@ -287,9 +285,9 @@ static int __init dummy_init(void) pr_info("init()\n"); - err = snd_avirt_audiopath_register(&dummyap_module, &coreinfo); - if ((err < 0) || (!coreinfo)) { - pr_err("%s: coreinfo is NULL!\n", __func__); + err = snd_avirt_audiopath_register(&dummyap_module); + if (err < 0) { + AP_ERRORK("Failed to register with AVIRT"); return err; } diff --git a/loopback/loopback.c b/loopback/loopback.c index b4a82e5..c3e06be 100644 --- a/loopback/loopback.c +++ b/loopback/loopback.c @@ -46,7 +46,6 @@ MODULE_LICENSE("GPL"); #define NO_PITCH 100000 -static struct snd_avirt_coreinfo *coreinfo; static struct loopback *loopback; struct loopback_pcm; @@ -1093,9 +1092,9 @@ static int __init alsa_card_loopback_init(void) { int err = 0; - err = snd_avirt_audiopath_register(&loopbackap_module, &coreinfo); - if ((err < 0) || (!coreinfo)) { - AP_ERRORK("coreinfo is NULL!"); + err = snd_avirt_audiopath_register(&loopbackap_module); + if (err < 0) { + AP_ERRORK("Failed to register with AVIRT"); return err; } diff --git a/sound/avirt.h b/sound/avirt.h index 1a5c546..b077bbc 100644 --- a/sound/avirt.h +++ b/sound/avirt.h @@ -63,20 +63,11 @@ struct snd_avirt_stream { }; /** - * AVIRT core info - */ -struct snd_avirt_coreinfo { - unsigned int version[3]; -}; - -/** * snd_avirt_audiopath_register - register Audio Path with AVIRT * @audiopath: Audio Path to be registered - * @core: ALSA virtual driver core info * @return: 0 on success or error code otherwise */ -int snd_avirt_audiopath_register(struct snd_avirt_audiopath *audiopath, - struct snd_avirt_coreinfo **coreinfo); +int snd_avirt_audiopath_register(struct snd_avirt_audiopath *audiopath); /** * snd_avirt_audiopath_deregister - deregister Audio Path with AVIRT |