diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2010-09-15 13:22:40 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2010-09-16 09:14:14 -0400 |
commit | 19c7ac27a1e6a37f5fb5810ad8ac780c62a204c4 (patch) | |
tree | 55d12cad88c851576d6f8f70f660ca5f2a16035b /sound/soc/soc-core.c | |
parent | f320878032be5c755509583c8a24b57d2ee50b20 (diff) |
ASoC: Add platform listing to debugfs
List registered platforms in debugfs to improve debugability of machine
drivers.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'sound/soc/soc-core.c')
-rw-r--r-- | sound/soc/soc-core.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 63d93b3b7b7a..6001b7f0a138 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -323,6 +323,34 @@ static const struct file_operations dai_list_fops = { | |||
323 | .llseek = default_llseek,/* read accesses f_pos */ | 323 | .llseek = default_llseek,/* read accesses f_pos */ |
324 | }; | 324 | }; |
325 | 325 | ||
326 | static ssize_t platform_list_read_file(struct file *file, | ||
327 | char __user *user_buf, | ||
328 | size_t count, loff_t *ppos) | ||
329 | { | ||
330 | char *buf = kmalloc(PAGE_SIZE, GFP_KERNEL); | ||
331 | ssize_t ret = 0; | ||
332 | struct snd_soc_platform *platform; | ||
333 | |||
334 | if (!buf) | ||
335 | return -ENOMEM; | ||
336 | |||
337 | list_for_each_entry(platform, &platform_list, list) | ||
338 | ret += snprintf(buf + ret, PAGE_SIZE - ret, "%s\n", | ||
339 | platform->name); | ||
340 | |||
341 | if (ret >= 0) | ||
342 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, ret); | ||
343 | |||
344 | kfree(buf); | ||
345 | |||
346 | return ret; | ||
347 | } | ||
348 | |||
349 | static const struct file_operations platform_list_fops = { | ||
350 | .read = platform_list_read_file, | ||
351 | .llseek = default_llseek,/* read accesses f_pos */ | ||
352 | }; | ||
353 | |||
326 | #else | 354 | #else |
327 | 355 | ||
328 | static inline void soc_init_codec_debugfs(struct snd_soc_codec *codec) | 356 | static inline void soc_init_codec_debugfs(struct snd_soc_codec *codec) |
@@ -3252,6 +3280,10 @@ static int __init snd_soc_init(void) | |||
3252 | if (!debugfs_create_file("dais", 0444, debugfs_root, NULL, | 3280 | if (!debugfs_create_file("dais", 0444, debugfs_root, NULL, |
3253 | &dai_list_fops)) | 3281 | &dai_list_fops)) |
3254 | pr_warn("ASoC: Failed to create DAI list debugfs file\n"); | 3282 | pr_warn("ASoC: Failed to create DAI list debugfs file\n"); |
3283 | |||
3284 | if (!debugfs_create_file("platforms", 0444, debugfs_root, NULL, | ||
3285 | &platform_list_fops)) | ||
3286 | pr_warn("ASoC: Failed to create platform list debugfs file\n"); | ||
3255 | #endif | 3287 | #endif |
3256 | 3288 | ||
3257 | return platform_driver_register(&soc_driver); | 3289 | return platform_driver_register(&soc_driver); |