aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2014-06-16 12:13:02 -0400
committerMark Brown <broonie@linaro.org>2014-06-21 16:04:24 -0400
commitf4333203ec933f9272c90c7add01774ec2cf94d3 (patch)
tree4a7f0bd37c7a5d00105dd91980fca721e181bee4
parent94f99c875c109e51decf0d8c25ec2c946db20c56 (diff)
ASoC: Move name and id from CODEC/platform to component
The component struct already has a name and id field which are initialized to the same values as the same fields in the CODEC and platform structs. So remove them from the CODEC and platform structs and used the ones from the component struct instead. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r--include/sound/soc.h4
-rw-r--r--include/trace/events/asoc.h6
-rw-r--r--sound/soc/codecs/tlv320dac33.c2
-rw-r--r--sound/soc/soc-cache.c7
-rw-r--r--sound/soc/soc-compress.c8
-rw-r--r--sound/soc/soc-core.c53
-rw-r--r--sound/soc/soc-dapm.c8
-rw-r--r--sound/soc/soc-pcm.c4
8 files changed, 38 insertions, 54 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h
index e1cce0042f8a..f64bf9452466 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -710,8 +710,6 @@ struct snd_soc_component {
710 710
711/* SoC Audio Codec device */ 711/* SoC Audio Codec device */
712struct snd_soc_codec { 712struct snd_soc_codec {
713 const char *name;
714 int id;
715 struct device *dev; 713 struct device *dev;
716 const struct snd_soc_codec_driver *driver; 714 const struct snd_soc_codec_driver *driver;
717 715
@@ -848,8 +846,6 @@ struct snd_soc_platform_driver {
848}; 846};
849 847
850struct snd_soc_platform { 848struct snd_soc_platform {
851 const char *name;
852 int id;
853 struct device *dev; 849 struct device *dev;
854 const struct snd_soc_platform_driver *driver; 850 const struct snd_soc_platform_driver *driver;
855 851
diff --git a/include/trace/events/asoc.h b/include/trace/events/asoc.h
index c75c795a377b..0194a641e4e2 100644
--- a/include/trace/events/asoc.h
+++ b/include/trace/events/asoc.h
@@ -296,17 +296,17 @@ TRACE_EVENT(snd_soc_cache_sync,
296 TP_ARGS(codec, type, status), 296 TP_ARGS(codec, type, status),
297 297
298 TP_STRUCT__entry( 298 TP_STRUCT__entry(
299 __string( name, codec->name ) 299 __string( name, codec->component.name)
300 __string( status, status ) 300 __string( status, status )
301 __string( type, type ) 301 __string( type, type )
302 __field( int, id ) 302 __field( int, id )
303 ), 303 ),
304 304
305 TP_fast_assign( 305 TP_fast_assign(
306 __assign_str(name, codec->name); 306 __assign_str(name, codec->component.name);
307 __assign_str(status, status); 307 __assign_str(status, status);
308 __assign_str(type, type); 308 __assign_str(type, type);
309 __entry->id = codec->id; 309 __entry->id = codec->component.id;
310 ), 310 ),
311 311
312 TP_printk("codec=%s.%d type=%s status=%s", __get_str(name), 312 TP_printk("codec=%s.%d type=%s status=%s", __get_str(name),
diff --git a/sound/soc/codecs/tlv320dac33.c b/sound/soc/codecs/tlv320dac33.c
index df3a7506c023..ff006cc95520 100644
--- a/sound/soc/codecs/tlv320dac33.c
+++ b/sound/soc/codecs/tlv320dac33.c
@@ -1404,7 +1404,7 @@ static int dac33_soc_probe(struct snd_soc_codec *codec)
1404 if (dac33->irq >= 0) { 1404 if (dac33->irq >= 0) {
1405 ret = request_irq(dac33->irq, dac33_interrupt_handler, 1405 ret = request_irq(dac33->irq, dac33_interrupt_handler,
1406 IRQF_TRIGGER_RISING, 1406 IRQF_TRIGGER_RISING,
1407 codec->name, codec); 1407 codec->component.name, codec);
1408 if (ret < 0) { 1408 if (ret < 0) {
1409 dev_err(codec->dev, "Could not request IRQ%d (%d)\n", 1409 dev_err(codec->dev, "Could not request IRQ%d (%d)\n",
1410 dac33->irq, ret); 1410 dac33->irq, ret);
diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c
index 00e70b6c7da2..a9f82b5aba9d 100644
--- a/sound/soc/soc-cache.c
+++ b/sound/soc/soc-cache.c
@@ -78,7 +78,7 @@ int snd_soc_cache_init(struct snd_soc_codec *codec)
78 mutex_init(&codec->cache_rw_mutex); 78 mutex_init(&codec->cache_rw_mutex);
79 79
80 dev_dbg(codec->dev, "ASoC: Initializing cache for %s codec\n", 80 dev_dbg(codec->dev, "ASoC: Initializing cache for %s codec\n",
81 codec->name); 81 codec->component.name);
82 82
83 if (codec_drv->reg_cache_default) 83 if (codec_drv->reg_cache_default)
84 codec->reg_cache = kmemdup(codec_drv->reg_cache_default, 84 codec->reg_cache = kmemdup(codec_drv->reg_cache_default,
@@ -98,8 +98,7 @@ int snd_soc_cache_init(struct snd_soc_codec *codec)
98int snd_soc_cache_exit(struct snd_soc_codec *codec) 98int snd_soc_cache_exit(struct snd_soc_codec *codec)
99{ 99{
100 dev_dbg(codec->dev, "ASoC: Destroying cache for %s codec\n", 100 dev_dbg(codec->dev, "ASoC: Destroying cache for %s codec\n",
101 codec->name); 101 codec->component.name);
102
103 kfree(codec->reg_cache); 102 kfree(codec->reg_cache);
104 codec->reg_cache = NULL; 103 codec->reg_cache = NULL;
105 return 0; 104 return 0;
@@ -192,7 +191,7 @@ int snd_soc_cache_sync(struct snd_soc_codec *codec)
192 return 0; 191 return 0;
193 192
194 dev_dbg(codec->dev, "ASoC: Syncing cache for %s codec\n", 193 dev_dbg(codec->dev, "ASoC: Syncing cache for %s codec\n",
195 codec->name); 194 codec->component.name);
196 trace_snd_soc_cache_sync(codec, name, "start"); 195 trace_snd_soc_cache_sync(codec, name, "start");
197 ret = snd_soc_flat_cache_sync(codec); 196 ret = snd_soc_flat_cache_sync(codec);
198 if (!ret) 197 if (!ret)
diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c
index 10f7f1da2aca..f96fb96b2678 100644
--- a/sound/soc/soc-compress.c
+++ b/sound/soc/soc-compress.c
@@ -37,7 +37,8 @@ static int soc_compr_open(struct snd_compr_stream *cstream)
37 if (platform->driver->compr_ops && platform->driver->compr_ops->open) { 37 if (platform->driver->compr_ops && platform->driver->compr_ops->open) {
38 ret = platform->driver->compr_ops->open(cstream); 38 ret = platform->driver->compr_ops->open(cstream);
39 if (ret < 0) { 39 if (ret < 0) {
40 pr_err("compress asoc: can't open platform %s\n", platform->name); 40 pr_err("compress asoc: can't open platform %s\n",
41 platform->component.name);
41 goto out; 42 goto out;
42 } 43 }
43 } 44 }
@@ -84,7 +85,8 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream)
84 if (platform->driver->compr_ops && platform->driver->compr_ops->open) { 85 if (platform->driver->compr_ops && platform->driver->compr_ops->open) {
85 ret = platform->driver->compr_ops->open(cstream); 86 ret = platform->driver->compr_ops->open(cstream);
86 if (ret < 0) { 87 if (ret < 0) {
87 pr_err("compress asoc: can't open platform %s\n", platform->name); 88 pr_err("compress asoc: can't open platform %s\n",
89 platform->component.name);
88 goto out; 90 goto out;
89 } 91 }
90 } 92 }
@@ -680,7 +682,7 @@ int soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num)
680 ret = snd_compress_new(rtd->card->snd_card, num, direction, compr); 682 ret = snd_compress_new(rtd->card->snd_card, num, direction, compr);
681 if (ret < 0) { 683 if (ret < 0) {
682 pr_err("compress asoc: can't create compress for codec %s\n", 684 pr_err("compress asoc: can't create compress for codec %s\n",
683 codec->name); 685 codec->component.name);
684 goto compr_err; 686 goto compr_err;
685 } 687 }
686 688
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index ba822e927187..b8cc88a9f947 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -274,7 +274,7 @@ static void soc_init_codec_debugfs(struct snd_soc_codec *codec)
274{ 274{
275 struct dentry *debugfs_card_root = codec->card->debugfs_card_root; 275 struct dentry *debugfs_card_root = codec->card->debugfs_card_root;
276 276
277 codec->debugfs_codec_root = debugfs_create_dir(codec->name, 277 codec->debugfs_codec_root = debugfs_create_dir(codec->component.name,
278 debugfs_card_root); 278 debugfs_card_root);
279 if (!codec->debugfs_codec_root) { 279 if (!codec->debugfs_codec_root) {
280 dev_warn(codec->dev, 280 dev_warn(codec->dev,
@@ -306,8 +306,8 @@ static void soc_init_platform_debugfs(struct snd_soc_platform *platform)
306{ 306{
307 struct dentry *debugfs_card_root = platform->card->debugfs_card_root; 307 struct dentry *debugfs_card_root = platform->card->debugfs_card_root;
308 308
309 platform->debugfs_platform_root = debugfs_create_dir(platform->name, 309 platform->debugfs_platform_root = debugfs_create_dir(
310 debugfs_card_root); 310 platform->component.name, debugfs_card_root);
311 if (!platform->debugfs_platform_root) { 311 if (!platform->debugfs_platform_root) {
312 dev_warn(platform->dev, 312 dev_warn(platform->dev,
313 "ASoC: Failed to create platform debugfs directory\n"); 313 "ASoC: Failed to create platform debugfs directory\n");
@@ -335,7 +335,7 @@ static ssize_t codec_list_read_file(struct file *file, char __user *user_buf,
335 335
336 list_for_each_entry(codec, &codec_list, list) { 336 list_for_each_entry(codec, &codec_list, list) {
337 len = snprintf(buf + ret, PAGE_SIZE - ret, "%s\n", 337 len = snprintf(buf + ret, PAGE_SIZE - ret, "%s\n",
338 codec->name); 338 codec->component.name);
339 if (len >= 0) 339 if (len >= 0)
340 ret += len; 340 ret += len;
341 if (ret > PAGE_SIZE) { 341 if (ret > PAGE_SIZE) {
@@ -406,7 +406,7 @@ static ssize_t platform_list_read_file(struct file *file,
406 406
407 list_for_each_entry(platform, &platform_list, list) { 407 list_for_each_entry(platform, &platform_list, list) {
408 len = snprintf(buf + ret, PAGE_SIZE - ret, "%s\n", 408 len = snprintf(buf + ret, PAGE_SIZE - ret, "%s\n",
409 platform->name); 409 platform->component.name);
410 if (len >= 0) 410 if (len >= 0)
411 ret += len; 411 ret += len;
412 if (ret > PAGE_SIZE) { 412 if (ret > PAGE_SIZE) {
@@ -528,7 +528,7 @@ static int soc_ac97_dev_register(struct snd_soc_codec *codec)
528 codec->ac97->dev.release = soc_ac97_device_release; 528 codec->ac97->dev.release = soc_ac97_device_release;
529 529
530 dev_set_name(&codec->ac97->dev, "%d-%d:%s", 530 dev_set_name(&codec->ac97->dev, "%d-%d:%s",
531 codec->card->snd_card->number, 0, codec->name); 531 codec->card->snd_card->number, 0, codec->component.name);
532 err = device_register(&codec->ac97->dev); 532 err = device_register(&codec->ac97->dev);
533 if (err < 0) { 533 if (err < 0) {
534 dev_err(codec->dev, "ASoC: Can't register ac97 bus\n"); 534 dev_err(codec->dev, "ASoC: Can't register ac97 bus\n");
@@ -857,7 +857,7 @@ static struct snd_soc_codec *soc_find_codec(const struct device_node *codec_of_n
857 if (codec->dev->of_node != codec_of_node) 857 if (codec->dev->of_node != codec_of_node)
858 continue; 858 continue;
859 } else { 859 } else {
860 if (strcmp(codec->name, codec_name)) 860 if (strcmp(codec->component.name, codec_name))
861 continue; 861 continue;
862 } 862 }
863 863
@@ -945,7 +945,7 @@ static int soc_bind_dai_link(struct snd_soc_card *card, int num)
945 dai_link->platform_of_node) 945 dai_link->platform_of_node)
946 continue; 946 continue;
947 } else { 947 } else {
948 if (strcmp(platform->name, platform_name)) 948 if (strcmp(platform->component.name, platform_name))
949 continue; 949 continue;
950 } 950 }
951 951
@@ -1177,7 +1177,7 @@ static int soc_probe_codec(struct snd_soc_card *card,
1177 WARN(codec->dapm.idle_bias_off && 1177 WARN(codec->dapm.idle_bias_off &&
1178 codec->dapm.bias_level != SND_SOC_BIAS_OFF, 1178 codec->dapm.bias_level != SND_SOC_BIAS_OFF,
1179 "codec %s can not start from non-off bias with idle_bias_off==1\n", 1179 "codec %s can not start from non-off bias with idle_bias_off==1\n",
1180 codec->name); 1180 codec->component.name);
1181 } 1181 }
1182 1182
1183 if (driver->controls) 1183 if (driver->controls)
@@ -1647,7 +1647,8 @@ static struct snd_soc_codec *soc_find_matching_codec(struct snd_soc_card *card,
1647 if (aux_dev->codec_of_node && 1647 if (aux_dev->codec_of_node &&
1648 (codec->dev->of_node != aux_dev->codec_of_node)) 1648 (codec->dev->of_node != aux_dev->codec_of_node))
1649 continue; 1649 continue;
1650 if (aux_dev->codec_name && strcmp(codec->name, aux_dev->codec_name)) 1650 if (aux_dev->codec_name &&
1651 strcmp(codec->component.name, aux_dev->codec_name))
1651 continue; 1652 continue;
1652 return codec; 1653 return codec;
1653 } 1654 }
@@ -4131,11 +4132,6 @@ int snd_soc_add_platform(struct device *dev, struct snd_soc_platform *platform,
4131{ 4132{
4132 int ret; 4133 int ret;
4133 4134
4134 /* create platform component name */
4135 platform->name = fmt_single_name(dev, &platform->id);
4136 if (platform->name == NULL)
4137 return -ENOMEM;
4138
4139 platform->dev = dev; 4135 platform->dev = dev;
4140 platform->driver = platform_drv; 4136 platform->driver = platform_drv;
4141 platform->dapm.dev = dev; 4137 platform->dapm.dev = dev;
@@ -4161,7 +4157,8 @@ int snd_soc_add_platform(struct device *dev, struct snd_soc_platform *platform,
4161 list_add(&platform->list, &platform_list); 4157 list_add(&platform->list, &platform_list);
4162 mutex_unlock(&client_mutex); 4158 mutex_unlock(&client_mutex);
4163 4159
4164 dev_dbg(dev, "ASoC: Registered platform '%s'\n", platform->name); 4160 dev_dbg(dev, "ASoC: Registered platform '%s'\n",
4161 platform->component.name);
4165 4162
4166 return 0; 4163 return 0;
4167} 4164}
@@ -4205,8 +4202,7 @@ void snd_soc_remove_platform(struct snd_soc_platform *platform)
4205 mutex_unlock(&client_mutex); 4202 mutex_unlock(&client_mutex);
4206 4203
4207 dev_dbg(platform->dev, "ASoC: Unregistered platform '%s'\n", 4204 dev_dbg(platform->dev, "ASoC: Unregistered platform '%s'\n",
4208 platform->name); 4205 platform->component.name);
4209 kfree(platform->name);
4210} 4206}
4211EXPORT_SYMBOL_GPL(snd_soc_remove_platform); 4207EXPORT_SYMBOL_GPL(snd_soc_remove_platform);
4212 4208
@@ -4312,13 +4308,6 @@ int snd_soc_register_codec(struct device *dev,
4312 if (codec == NULL) 4308 if (codec == NULL)
4313 return -ENOMEM; 4309 return -ENOMEM;
4314 4310
4315 /* create CODEC component name */
4316 codec->name = fmt_single_name(dev, &codec->id);
4317 if (codec->name == NULL) {
4318 ret = -ENOMEM;
4319 goto fail_codec;
4320 }
4321
4322 if (codec_drv->write) 4311 if (codec_drv->write)
4323 codec->component.write = snd_soc_codec_drv_write; 4312 codec->component.write = snd_soc_codec_drv_write;
4324 if (codec_drv->read) 4313 if (codec_drv->read)
@@ -4368,19 +4357,17 @@ int snd_soc_register_codec(struct device *dev,
4368 codec, dai_drv, num_dai, false); 4357 codec, dai_drv, num_dai, false);
4369 if (ret < 0) { 4358 if (ret < 0) {
4370 dev_err(codec->dev, "ASoC: Failed to regster component: %d\n", ret); 4359 dev_err(codec->dev, "ASoC: Failed to regster component: %d\n", ret);
4371 goto fail_codec_name; 4360 goto fail_codec;
4372 } 4361 }
4373 4362
4374 dev_dbg(codec->dev, "ASoC: Registered codec '%s'\n", codec->name); 4363 dev_dbg(codec->dev, "ASoC: Registered codec '%s'\n",
4364 codec->component.name);
4375 return 0; 4365 return 0;
4376 4366
4377fail_codec_name: 4367fail_codec:
4378 mutex_lock(&client_mutex); 4368 mutex_lock(&client_mutex);
4379 list_del(&codec->list); 4369 list_del(&codec->list);
4380 mutex_unlock(&client_mutex); 4370 mutex_unlock(&client_mutex);
4381
4382 kfree(codec->name);
4383fail_codec:
4384 kfree(codec); 4371 kfree(codec);
4385 return ret; 4372 return ret;
4386} 4373}
@@ -4408,10 +4395,10 @@ found:
4408 list_del(&codec->list); 4395 list_del(&codec->list);
4409 mutex_unlock(&client_mutex); 4396 mutex_unlock(&client_mutex);
4410 4397
4411 dev_dbg(codec->dev, "ASoC: Unregistered codec '%s'\n", codec->name); 4398 dev_dbg(codec->dev, "ASoC: Unregistered codec '%s'\n",
4399 codec->component.name);
4412 4400
4413 snd_soc_cache_exit(codec); 4401 snd_soc_cache_exit(codec);
4414 kfree(codec->name);
4415 kfree(codec); 4402 kfree(codec);
4416} 4403}
4417EXPORT_SYMBOL_GPL(snd_soc_unregister_codec); 4404EXPORT_SYMBOL_GPL(snd_soc_unregister_codec);
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 2f29b289a333..074e9ce136f8 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -3400,8 +3400,8 @@ void snd_soc_dapm_connect_dai_link_widgets(struct snd_soc_card *card)
3400 source = cpu_dai->playback_widget; 3400 source = cpu_dai->playback_widget;
3401 sink = codec_dai->playback_widget; 3401 sink = codec_dai->playback_widget;
3402 dev_dbg(rtd->dev, "connected DAI link %s:%s -> %s:%s\n", 3402 dev_dbg(rtd->dev, "connected DAI link %s:%s -> %s:%s\n",
3403 cpu_dai->codec->name, source->name, 3403 cpu_dai->component->name, source->name,
3404 codec_dai->platform->name, sink->name); 3404 codec_dai->component->name, sink->name);
3405 3405
3406 snd_soc_dapm_add_path(&card->dapm, source, sink, 3406 snd_soc_dapm_add_path(&card->dapm, source, sink,
3407 NULL, NULL); 3407 NULL, NULL);
@@ -3412,8 +3412,8 @@ void snd_soc_dapm_connect_dai_link_widgets(struct snd_soc_card *card)
3412 source = codec_dai->capture_widget; 3412 source = codec_dai->capture_widget;
3413 sink = cpu_dai->capture_widget; 3413 sink = cpu_dai->capture_widget;
3414 dev_dbg(rtd->dev, "connected DAI link %s:%s -> %s:%s\n", 3414 dev_dbg(rtd->dev, "connected DAI link %s:%s -> %s:%s\n",
3415 codec_dai->codec->name, source->name, 3415 codec_dai->component->name, source->name,
3416 cpu_dai->platform->name, sink->name); 3416 cpu_dai->component->name, sink->name);
3417 3417
3418 snd_soc_dapm_add_path(&card->dapm, source, sink, 3418 snd_soc_dapm_add_path(&card->dapm, source, sink,
3419 NULL, NULL); 3419 NULL, NULL);
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 54d18f22a33e..9b78bb619bec 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -376,7 +376,7 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
376 ret = platform->driver->ops->open(substream); 376 ret = platform->driver->ops->open(substream);
377 if (ret < 0) { 377 if (ret < 0) {
378 dev_err(platform->dev, "ASoC: can't open platform" 378 dev_err(platform->dev, "ASoC: can't open platform"
379 " %s: %d\n", platform->name, ret); 379 " %s: %d\n", platform->component.name, ret);
380 goto platform_err; 380 goto platform_err;
381 } 381 }
382 } 382 }
@@ -707,7 +707,7 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream,
707 ret = platform->driver->ops->hw_params(substream, params); 707 ret = platform->driver->ops->hw_params(substream, params);
708 if (ret < 0) { 708 if (ret < 0) {
709 dev_err(platform->dev, "ASoC: %s hw params failed: %d\n", 709 dev_err(platform->dev, "ASoC: %s hw params failed: %d\n",
710 platform->name, ret); 710 platform->component.name, ret);
711 goto platform_err; 711 goto platform_err;
712 } 712 }
713 } 713 }