Commit f9368c18 authored by Tony Lindgren's avatar Tony Lindgren Committed by Al Viro

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: default avatarTony Lindgren <tony@atomide.com>
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 1eb5b23a
...@@ -37,7 +37,8 @@ ...@@ -37,7 +37,8 @@
#include <linux/suspend.h> #include <linux/suspend.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/proc_fs.h> #include <linux/debugfs.h>
#include <linux/seq_file.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/sysfs.h> #include <linux/sysfs.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -422,23 +423,12 @@ void omap1_pm_suspend(void) ...@@ -422,23 +423,12 @@ void omap1_pm_suspend(void)
omap_rev()); omap_rev());
} }
#if defined(DEBUG) && defined(CONFIG_PROC_FS) #ifdef CONFIG_DEBUG_FS
static int g_read_completed;
/* /*
* Read system PM registers for debugging * Read system PM registers for debugging
*/ */
static int omap_pm_read_proc( static int omap_pm_debug_show(struct seq_file *m, void *v)
char *page_buffer,
char **my_first_byte,
off_t virtual_start,
int length,
int *eof,
void *data)
{ {
int my_buffer_offset = 0;
char * const my_base = page_buffer;
ARM_SAVE(ARM_CKCTL); ARM_SAVE(ARM_CKCTL);
ARM_SAVE(ARM_IDLECT1); ARM_SAVE(ARM_IDLECT1);
ARM_SAVE(ARM_IDLECT2); ARM_SAVE(ARM_IDLECT2);
...@@ -479,10 +469,7 @@ static int omap_pm_read_proc( ...@@ -479,10 +469,7 @@ static int omap_pm_read_proc(
MPUI1610_SAVE(EMIFS_CONFIG); MPUI1610_SAVE(EMIFS_CONFIG);
} }
if (virtual_start == 0) { seq_printf(m,
g_read_completed = 0;
my_buffer_offset += sprintf(my_base + my_buffer_offset,
"ARM_CKCTL_REG: 0x%-8x \n" "ARM_CKCTL_REG: 0x%-8x \n"
"ARM_IDLECT1_REG: 0x%-8x \n" "ARM_IDLECT1_REG: 0x%-8x \n"
"ARM_IDLECT2_REG: 0x%-8x \n" "ARM_IDLECT2_REG: 0x%-8x \n"
...@@ -512,8 +499,8 @@ static int omap_pm_read_proc( ...@@ -512,8 +499,8 @@ static int omap_pm_read_proc(
ULPD_SHOW(ULPD_STATUS_REQ), ULPD_SHOW(ULPD_STATUS_REQ),
ULPD_SHOW(ULPD_POWER_CTRL)); ULPD_SHOW(ULPD_POWER_CTRL));
if (cpu_is_omap7xx()) { if (cpu_is_omap7xx()) {
my_buffer_offset += sprintf(my_base + my_buffer_offset, seq_printf(m,
"MPUI7XX_CTRL_REG 0x%-8x \n" "MPUI7XX_CTRL_REG 0x%-8x \n"
"MPUI7XX_DSP_STATUS_REG: 0x%-8x \n" "MPUI7XX_DSP_STATUS_REG: 0x%-8x \n"
"MPUI7XX_DSP_BOOT_CONFIG_REG: 0x%-8x \n" "MPUI7XX_DSP_BOOT_CONFIG_REG: 0x%-8x \n"
...@@ -526,8 +513,8 @@ static int omap_pm_read_proc( ...@@ -526,8 +513,8 @@ static int omap_pm_read_proc(
MPUI7XX_SHOW(MPUI_DSP_API_CONFIG), MPUI7XX_SHOW(MPUI_DSP_API_CONFIG),
MPUI7XX_SHOW(EMIFF_SDRAM_CONFIG), MPUI7XX_SHOW(EMIFF_SDRAM_CONFIG),
MPUI7XX_SHOW(EMIFS_CONFIG)); MPUI7XX_SHOW(EMIFS_CONFIG));
} else if (cpu_is_omap15xx()) { } else if (cpu_is_omap15xx()) {
my_buffer_offset += sprintf(my_base + my_buffer_offset, seq_printf(m,
"MPUI1510_CTRL_REG 0x%-8x \n" "MPUI1510_CTRL_REG 0x%-8x \n"
"MPUI1510_DSP_STATUS_REG: 0x%-8x \n" "MPUI1510_DSP_STATUS_REG: 0x%-8x \n"
"MPUI1510_DSP_BOOT_CONFIG_REG: 0x%-8x \n" "MPUI1510_DSP_BOOT_CONFIG_REG: 0x%-8x \n"
...@@ -540,8 +527,8 @@ static int omap_pm_read_proc( ...@@ -540,8 +527,8 @@ static int omap_pm_read_proc(
MPUI1510_SHOW(MPUI_DSP_API_CONFIG), MPUI1510_SHOW(MPUI_DSP_API_CONFIG),
MPUI1510_SHOW(EMIFF_SDRAM_CONFIG), MPUI1510_SHOW(EMIFF_SDRAM_CONFIG),
MPUI1510_SHOW(EMIFS_CONFIG)); MPUI1510_SHOW(EMIFS_CONFIG));
} else if (cpu_is_omap16xx()) { } else if (cpu_is_omap16xx()) {
my_buffer_offset += sprintf(my_base + my_buffer_offset, seq_printf(m,
"MPUI1610_CTRL_REG 0x%-8x \n" "MPUI1610_CTRL_REG 0x%-8x \n"
"MPUI1610_DSP_STATUS_REG: 0x%-8x \n" "MPUI1610_DSP_STATUS_REG: 0x%-8x \n"
"MPUI1610_DSP_BOOT_CONFIG_REG: 0x%-8x \n" "MPUI1610_DSP_BOOT_CONFIG_REG: 0x%-8x \n"
...@@ -554,28 +541,37 @@ static int omap_pm_read_proc( ...@@ -554,28 +541,37 @@ static int omap_pm_read_proc(
MPUI1610_SHOW(MPUI_DSP_API_CONFIG), MPUI1610_SHOW(MPUI_DSP_API_CONFIG),
MPUI1610_SHOW(EMIFF_SDRAM_CONFIG), MPUI1610_SHOW(EMIFF_SDRAM_CONFIG),
MPUI1610_SHOW(EMIFS_CONFIG)); MPUI1610_SHOW(EMIFS_CONFIG));
}
g_read_completed++;
} else if (g_read_completed >= 1) {
*eof = 1;
return 0;
} }
g_read_completed++;
*my_first_byte = page_buffer; return 0;
return my_buffer_offset; }
static int omap_pm_debug_open(struct inode *inode, struct file *file)
{
return single_open(file, omap_pm_debug_show,
&inode->i_private);
} }
static void omap_pm_init_proc(void) static const struct file_operations omap_pm_debug_fops = {
.open = omap_pm_debug_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
};
static void omap_pm_init_debugfs(void)
{ {
/* XXX Appears to leak memory */ struct dentry *d;
create_proc_read_entry("driver/omap_pm",
S_IWUSR | S_IRUGO, NULL, d = debugfs_create_dir("pm_debug", NULL);
omap_pm_read_proc, NULL); if (!d)
return;
(void) debugfs_create_file("omap_pm", S_IWUSR | S_IRUGO,
d, NULL, &omap_pm_debug_fops);
} }
#endif /* DEBUG && CONFIG_PROC_FS */ #endif /* CONFIG_DEBUG_FS */
/* /*
* omap_pm_prepare - Do preliminary suspend work. * omap_pm_prepare - Do preliminary suspend work.
...@@ -701,8 +697,8 @@ static int __init omap_pm_init(void) ...@@ -701,8 +697,8 @@ static int __init omap_pm_init(void)
suspend_set_ops(&omap_pm_ops); suspend_set_ops(&omap_pm_ops);
#if defined(DEBUG) && defined(CONFIG_PROC_FS) #ifdef CONFIG_DEBUG_FS
omap_pm_init_proc(); omap_pm_init_debugfs();
#endif #endif
#ifdef CONFIG_OMAP_32K_TIMER #ifdef CONFIG_OMAP_32K_TIMER
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment