diff options
author | Tony Lindgren <tony@atomide.com> | 2013-04-11 14:03:41 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-04-29 15:41:59 -0400 |
commit | f9368c18e9a99d86c509ac113363e9d295e0bf74 (patch) | |
tree | 4f9e67efe97d0240b44fb9f4f393c3cfec808a57 /arch/arm/mach-omap1 | |
parent | 1eb5b23ae72b2b858800c8eee6adeef7c098e767 (diff) |
ARM: OMAP1: Replace PM debug create_proc_read_entry() with debugfs
There's no need to keep this entry in proc, it is PM
related debug only entry. Let's move it into debugfs.
Based on an earlier patch David Howells <dhowells@redhat.com>
to use seq_printf and to update to use create_proc_read_entry().
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-omap1')
-rw-r--r-- | arch/arm/mach-omap1/pm.c | 78 |
1 files changed, 37 insertions, 41 deletions
diff --git a/arch/arm/mach-omap1/pm.c b/arch/arm/mach-omap1/pm.c index 7a7690ab6cb8..ff72d297a172 100644 --- a/arch/arm/mach-omap1/pm.c +++ b/arch/arm/mach-omap1/pm.c | |||
@@ -37,7 +37,8 @@ | |||
37 | 37 | ||
38 | #include <linux/suspend.h> | 38 | #include <linux/suspend.h> |
39 | #include <linux/sched.h> | 39 | #include <linux/sched.h> |
40 | #include <linux/proc_fs.h> | 40 | #include <linux/debugfs.h> |
41 | #include <linux/seq_file.h> | ||
41 | #include <linux/interrupt.h> | 42 | #include <linux/interrupt.h> |
42 | #include <linux/sysfs.h> | 43 | #include <linux/sysfs.h> |
43 | #include <linux/module.h> | 44 | #include <linux/module.h> |
@@ -422,23 +423,12 @@ void omap1_pm_suspend(void) | |||
422 | omap_rev()); | 423 | omap_rev()); |
423 | } | 424 | } |
424 | 425 | ||
425 | #if defined(DEBUG) && defined(CONFIG_PROC_FS) | 426 | #ifdef CONFIG_DEBUG_FS |
426 | static int g_read_completed; | ||
427 | |||
428 | /* | 427 | /* |
429 | * Read system PM registers for debugging | 428 | * Read system PM registers for debugging |
430 | */ | 429 | */ |
431 | static int omap_pm_read_proc( | 430 | static int omap_pm_debug_show(struct seq_file *m, void *v) |
432 | char *page_buffer, | ||
433 | char **my_first_byte, | ||
434 | off_t virtual_start, | ||
435 | int length, | ||
436 | int *eof, | ||
437 | void *data) | ||
438 | { | 431 | { |
439 | int my_buffer_offset = 0; | ||
440 | char * const my_base = page_buffer; | ||
441 | |||
442 | ARM_SAVE(ARM_CKCTL); | 432 | ARM_SAVE(ARM_CKCTL); |
443 | ARM_SAVE(ARM_IDLECT1); | 433 | ARM_SAVE(ARM_IDLECT1); |
444 | ARM_SAVE(ARM_IDLECT2); | 434 | ARM_SAVE(ARM_IDLECT2); |
@@ -479,10 +469,7 @@ static int omap_pm_read_proc( | |||
479 | MPUI1610_SAVE(EMIFS_CONFIG); | 469 | MPUI1610_SAVE(EMIFS_CONFIG); |
480 | } | 470 | } |
481 | 471 | ||
482 | if (virtual_start == 0) { | 472 | seq_printf(m, |
483 | g_read_completed = 0; | ||
484 | |||
485 | my_buffer_offset += sprintf(my_base + my_buffer_offset, | ||
486 | "ARM_CKCTL_REG: 0x%-8x \n" | 473 | "ARM_CKCTL_REG: 0x%-8x \n" |
487 | "ARM_IDLECT1_REG: 0x%-8x \n" | 474 | "ARM_IDLECT1_REG: 0x%-8x \n" |
488 | "ARM_IDLECT2_REG: 0x%-8x \n" | 475 | "ARM_IDLECT2_REG: 0x%-8x \n" |
@@ -512,8 +499,8 @@ static int omap_pm_read_proc( | |||
512 | ULPD_SHOW(ULPD_STATUS_REQ), | 499 | ULPD_SHOW(ULPD_STATUS_REQ), |
513 | ULPD_SHOW(ULPD_POWER_CTRL)); | 500 | ULPD_SHOW(ULPD_POWER_CTRL)); |
514 | 501 | ||
515 | if (cpu_is_omap7xx()) { | 502 | if (cpu_is_omap7xx()) { |
516 | my_buffer_offset += sprintf(my_base + my_buffer_offset, | 503 | seq_printf(m, |
517 | "MPUI7XX_CTRL_REG 0x%-8x \n" | 504 | "MPUI7XX_CTRL_REG 0x%-8x \n" |
518 | "MPUI7XX_DSP_STATUS_REG: 0x%-8x \n" | 505 | "MPUI7XX_DSP_STATUS_REG: 0x%-8x \n" |
519 | "MPUI7XX_DSP_BOOT_CONFIG_REG: 0x%-8x \n" | 506 | "MPUI7XX_DSP_BOOT_CONFIG_REG: 0x%-8x \n" |
@@ -526,8 +513,8 @@ static int omap_pm_read_proc( | |||
526 | MPUI7XX_SHOW(MPUI_DSP_API_CONFIG), | 513 | MPUI7XX_SHOW(MPUI_DSP_API_CONFIG), |
527 | MPUI7XX_SHOW(EMIFF_SDRAM_CONFIG), | 514 | MPUI7XX_SHOW(EMIFF_SDRAM_CONFIG), |
528 | MPUI7XX_SHOW(EMIFS_CONFIG)); | 515 | MPUI7XX_SHOW(EMIFS_CONFIG)); |
529 | } else if (cpu_is_omap15xx()) { | 516 | } else if (cpu_is_omap15xx()) { |
530 | my_buffer_offset += sprintf(my_base + my_buffer_offset, | 517 | seq_printf(m, |
531 | "MPUI1510_CTRL_REG 0x%-8x \n" | 518 | "MPUI1510_CTRL_REG 0x%-8x \n" |
532 | "MPUI1510_DSP_STATUS_REG: 0x%-8x \n" | 519 | "MPUI1510_DSP_STATUS_REG: 0x%-8x \n" |
533 | "MPUI1510_DSP_BOOT_CONFIG_REG: 0x%-8x \n" | 520 | "MPUI1510_DSP_BOOT_CONFIG_REG: 0x%-8x \n" |
@@ -540,8 +527,8 @@ static int omap_pm_read_proc( | |||
540 | MPUI1510_SHOW(MPUI_DSP_API_CONFIG), | 527 | MPUI1510_SHOW(MPUI_DSP_API_CONFIG), |
541 | MPUI1510_SHOW(EMIFF_SDRAM_CONFIG), | 528 | MPUI1510_SHOW(EMIFF_SDRAM_CONFIG), |
542 | MPUI1510_SHOW(EMIFS_CONFIG)); | 529 | MPUI1510_SHOW(EMIFS_CONFIG)); |
543 | } else if (cpu_is_omap16xx()) { | 530 | } else if (cpu_is_omap16xx()) { |
544 | my_buffer_offset += sprintf(my_base + my_buffer_offset, | 531 | seq_printf(m, |
545 | "MPUI1610_CTRL_REG 0x%-8x \n" | 532 | "MPUI1610_CTRL_REG 0x%-8x \n" |
546 | "MPUI1610_DSP_STATUS_REG: 0x%-8x \n" | 533 | "MPUI1610_DSP_STATUS_REG: 0x%-8x \n" |
547 | "MPUI1610_DSP_BOOT_CONFIG_REG: 0x%-8x \n" | 534 | "MPUI1610_DSP_BOOT_CONFIG_REG: 0x%-8x \n" |
@@ -554,28 +541,37 @@ static int omap_pm_read_proc( | |||
554 | MPUI1610_SHOW(MPUI_DSP_API_CONFIG), | 541 | MPUI1610_SHOW(MPUI_DSP_API_CONFIG), |
555 | MPUI1610_SHOW(EMIFF_SDRAM_CONFIG), | 542 | MPUI1610_SHOW(EMIFF_SDRAM_CONFIG), |
556 | MPUI1610_SHOW(EMIFS_CONFIG)); | 543 | MPUI1610_SHOW(EMIFS_CONFIG)); |
557 | } | ||
558 | |||
559 | g_read_completed++; | ||
560 | } else if (g_read_completed >= 1) { | ||
561 | *eof = 1; | ||
562 | return 0; | ||
563 | } | 544 | } |
564 | g_read_completed++; | ||
565 | 545 | ||
566 | *my_first_byte = page_buffer; | 546 | return 0; |
567 | return my_buffer_offset; | 547 | } |
548 | |||
549 | static int omap_pm_debug_open(struct inode *inode, struct file *file) | ||
550 | { | ||
551 | return single_open(file, omap_pm_debug_show, | ||
552 | &inode->i_private); | ||
568 | } | 553 | } |
569 | 554 | ||
570 | static void omap_pm_init_proc(void) | 555 | static const struct file_operations omap_pm_debug_fops = { |
556 | .open = omap_pm_debug_open, | ||
557 | .read = seq_read, | ||
558 | .llseek = seq_lseek, | ||
559 | .release = seq_release, | ||
560 | }; | ||
561 | |||
562 | static void omap_pm_init_debugfs(void) | ||
571 | { | 563 | { |
572 | /* XXX Appears to leak memory */ | 564 | struct dentry *d; |
573 | create_proc_read_entry("driver/omap_pm", | 565 | |
574 | S_IWUSR | S_IRUGO, NULL, | 566 | d = debugfs_create_dir("pm_debug", NULL); |
575 | omap_pm_read_proc, NULL); | 567 | if (!d) |
568 | return; | ||
569 | |||
570 | (void) debugfs_create_file("omap_pm", S_IWUSR | S_IRUGO, | ||
571 | d, NULL, &omap_pm_debug_fops); | ||
576 | } | 572 | } |
577 | 573 | ||
578 | #endif /* DEBUG && CONFIG_PROC_FS */ | 574 | #endif /* CONFIG_DEBUG_FS */ |
579 | 575 | ||
580 | /* | 576 | /* |
581 | * omap_pm_prepare - Do preliminary suspend work. | 577 | * omap_pm_prepare - Do preliminary suspend work. |
@@ -701,8 +697,8 @@ static int __init omap_pm_init(void) | |||
701 | 697 | ||
702 | suspend_set_ops(&omap_pm_ops); | 698 | suspend_set_ops(&omap_pm_ops); |
703 | 699 | ||
704 | #if defined(DEBUG) && defined(CONFIG_PROC_FS) | 700 | #ifdef CONFIG_DEBUG_FS |
705 | omap_pm_init_proc(); | 701 | omap_pm_init_debugfs(); |
706 | #endif | 702 | #endif |
707 | 703 | ||
708 | #ifdef CONFIG_OMAP_32K_TIMER | 704 | #ifdef CONFIG_OMAP_32K_TIMER |