diff options
Diffstat (limited to 'arch/arm/plat-omap/clock.c')
-rw-r--r-- | arch/arm/plat-omap/clock.c | 51 |
1 files changed, 42 insertions, 9 deletions
diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c index c9122dd6ee8..3ba4d11ca73 100644 --- a/arch/arm/plat-omap/clock.c +++ b/arch/arm/plat-omap/clock.c | |||
@@ -475,18 +475,48 @@ int __init clk_init(struct clk_functions * custom_clocks) | |||
475 | /* | 475 | /* |
476 | * debugfs support to trace clock tree hierarchy and attributes | 476 | * debugfs support to trace clock tree hierarchy and attributes |
477 | */ | 477 | */ |
478 | |||
479 | #include <linux/debugfs.h> | ||
480 | #include <linux/seq_file.h> | ||
481 | |||
478 | static struct dentry *clk_debugfs_root; | 482 | static struct dentry *clk_debugfs_root; |
479 | 483 | ||
484 | static int clk_dbg_show_summary(struct seq_file *s, void *unused) | ||
485 | { | ||
486 | struct clk *c; | ||
487 | struct clk *pa; | ||
488 | |||
489 | seq_printf(s, "%-30s %-30s %-10s %s\n", | ||
490 | "clock-name", "parent-name", "rate", "use-count"); | ||
491 | |||
492 | list_for_each_entry(c, &clocks, node) { | ||
493 | pa = c->parent; | ||
494 | seq_printf(s, "%-30s %-30s %-10lu %d\n", | ||
495 | c->name, pa ? pa->name : "none", c->rate, c->usecount); | ||
496 | } | ||
497 | |||
498 | return 0; | ||
499 | } | ||
500 | |||
501 | static int clk_dbg_open(struct inode *inode, struct file *file) | ||
502 | { | ||
503 | return single_open(file, clk_dbg_show_summary, inode->i_private); | ||
504 | } | ||
505 | |||
506 | static const struct file_operations debug_clock_fops = { | ||
507 | .open = clk_dbg_open, | ||
508 | .read = seq_read, | ||
509 | .llseek = seq_lseek, | ||
510 | .release = single_release, | ||
511 | }; | ||
512 | |||
480 | static int clk_debugfs_register_one(struct clk *c) | 513 | static int clk_debugfs_register_one(struct clk *c) |
481 | { | 514 | { |
482 | int err; | 515 | int err; |
483 | struct dentry *d, *child, *child_tmp; | 516 | struct dentry *d; |
484 | struct clk *pa = c->parent; | 517 | struct clk *pa = c->parent; |
485 | char s[255]; | ||
486 | char *p = s; | ||
487 | 518 | ||
488 | p += sprintf(p, "%s", c->name); | 519 | d = debugfs_create_dir(c->name, pa ? pa->dent : clk_debugfs_root); |
489 | d = debugfs_create_dir(s, pa ? pa->dent : clk_debugfs_root); | ||
490 | if (!d) | 520 | if (!d) |
491 | return -ENOMEM; | 521 | return -ENOMEM; |
492 | c->dent = d; | 522 | c->dent = d; |
@@ -509,10 +539,7 @@ static int clk_debugfs_register_one(struct clk *c) | |||
509 | return 0; | 539 | return 0; |
510 | 540 | ||
511 | err_out: | 541 | err_out: |
512 | d = c->dent; | 542 | debugfs_remove_recursive(c->dent); |
513 | list_for_each_entry_safe(child, child_tmp, &d->d_subdirs, d_u.d_child) | ||
514 | debugfs_remove(child); | ||
515 | debugfs_remove(c->dent); | ||
516 | return err; | 543 | return err; |
517 | } | 544 | } |
518 | 545 | ||
@@ -551,6 +578,12 @@ static int __init clk_debugfs_init(void) | |||
551 | if (err) | 578 | if (err) |
552 | goto err_out; | 579 | goto err_out; |
553 | } | 580 | } |
581 | |||
582 | d = debugfs_create_file("summary", S_IRUGO, | ||
583 | d, NULL, &debug_clock_fops); | ||
584 | if (!d) | ||
585 | return -ENOMEM; | ||
586 | |||
554 | return 0; | 587 | return 0; |
555 | err_out: | 588 | err_out: |
556 | debugfs_remove_recursive(clk_debugfs_root); | 589 | debugfs_remove_recursive(clk_debugfs_root); |