ARM: OMAP2+: reuse DEFINE_SHOW_ATTRIBUTE() macro
Reuse DEFINE_SHOW_ATTRIBUTE() macro instead of open coding file operations followed by custom ->open() callbacks per each attribute. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
This commit is contained in:
parent
6d609b35c8
commit
eb07fe9f9f
@ -47,11 +47,6 @@ static int pm_dbg_init_done;
|
|||||||
|
|
||||||
static int pm_dbg_init(void);
|
static int pm_dbg_init(void);
|
||||||
|
|
||||||
enum {
|
|
||||||
DEBUG_FILE_COUNTERS = 0,
|
|
||||||
DEBUG_FILE_TIMERS,
|
|
||||||
};
|
|
||||||
|
|
||||||
static const char pwrdm_state_names[][PWRDM_MAX_PWRSTS] = {
|
static const char pwrdm_state_names[][PWRDM_MAX_PWRSTS] = {
|
||||||
"OFF",
|
"OFF",
|
||||||
"RET",
|
"RET",
|
||||||
@ -141,39 +136,21 @@ static int pwrdm_dbg_show_timer(struct powerdomain *pwrdm, void *user)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pm_dbg_show_counters(struct seq_file *s, void *unused)
|
static int pm_dbg_counters_show(struct seq_file *s, void *unused)
|
||||||
{
|
{
|
||||||
pwrdm_for_each(pwrdm_dbg_show_counter, s);
|
pwrdm_for_each(pwrdm_dbg_show_counter, s);
|
||||||
clkdm_for_each(clkdm_dbg_show_counter, s);
|
clkdm_for_each(clkdm_dbg_show_counter, s);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
DEFINE_SHOW_ATTRIBUTE(pm_dbg_counters);
|
||||||
|
|
||||||
static int pm_dbg_show_timers(struct seq_file *s, void *unused)
|
static int pm_dbg_timers_show(struct seq_file *s, void *unused)
|
||||||
{
|
{
|
||||||
pwrdm_for_each(pwrdm_dbg_show_timer, s);
|
pwrdm_for_each(pwrdm_dbg_show_timer, s);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
DEFINE_SHOW_ATTRIBUTE(pm_dbg_timers);
|
||||||
static int pm_dbg_open(struct inode *inode, struct file *file)
|
|
||||||
{
|
|
||||||
switch ((int)inode->i_private) {
|
|
||||||
case DEBUG_FILE_COUNTERS:
|
|
||||||
return single_open(file, pm_dbg_show_counters,
|
|
||||||
&inode->i_private);
|
|
||||||
case DEBUG_FILE_TIMERS:
|
|
||||||
default:
|
|
||||||
return single_open(file, pm_dbg_show_timers,
|
|
||||||
&inode->i_private);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static const struct file_operations debug_fops = {
|
|
||||||
.open = pm_dbg_open,
|
|
||||||
.read = seq_read,
|
|
||||||
.llseek = seq_lseek,
|
|
||||||
.release = single_release,
|
|
||||||
};
|
|
||||||
|
|
||||||
static int pwrdm_suspend_get(void *data, u64 *val)
|
static int pwrdm_suspend_get(void *data, u64 *val)
|
||||||
{
|
{
|
||||||
@ -259,10 +236,8 @@ static int __init pm_dbg_init(void)
|
|||||||
if (!d)
|
if (!d)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
(void) debugfs_create_file("count", S_IRUGO,
|
(void) debugfs_create_file("count", 0444, d, NULL, &pm_dbg_counters_fops);
|
||||||
d, (void *)DEBUG_FILE_COUNTERS, &debug_fops);
|
(void) debugfs_create_file("time", 0444, d, NULL, &pm_dbg_timers_fops);
|
||||||
(void) debugfs_create_file("time", S_IRUGO,
|
|
||||||
d, (void *)DEBUG_FILE_TIMERS, &debug_fops);
|
|
||||||
|
|
||||||
pwrdm_for_each(pwrdms_setup, (void *)d);
|
pwrdm_for_each(pwrdms_setup, (void *)d);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user