diff options
author | Yangtao Li <tiny.windzz@gmail.com> | 2018-12-15 03:21:48 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2018-12-20 14:38:42 +0000 |
commit | 3e60b4fc86710cd2095628c67b296e7cc4b239c1 (patch) | |
tree | d05d6540d06b8f659b4539595b12ba18c0e56279 /drivers/regulator/core.c | |
parent | f4c8f980283b4832dad4d9ff4d5ecb3d7763efae (diff) | |
download | linux-3e60b4fc86710cd2095628c67b296e7cc4b239c1.tar.gz linux-3e60b4fc86710cd2095628c67b296e7cc4b239c1.tar.bz2 linux-3e60b4fc86710cd2095628c67b296e7cc4b239c1.zip |
regulator: convert to DEFINE_SHOW_ATTRIBUTE
Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.
Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/regulator/core.c')
-rw-r--r-- | drivers/regulator/core.c | 37 |
1 files changed, 5 insertions, 32 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index f211aa7da44e..0e402606e8be 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -5278,23 +5278,8 @@ static int supply_map_show(struct seq_file *sf, void *data) return 0; } +DEFINE_SHOW_ATTRIBUTE(supply_map); -static int supply_map_open(struct inode *inode, struct file *file) -{ - return single_open(file, supply_map_show, inode->i_private); -} -#endif - -static const struct file_operations supply_map_fops = { -#ifdef CONFIG_DEBUG_FS - .open = supply_map_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -#endif -}; - -#ifdef CONFIG_DEBUG_FS struct summary_data { struct seq_file *s; struct regulator_dev *parent; @@ -5516,21 +5501,8 @@ static int regulator_summary_show(struct seq_file *s, void *data) return 0; } - -static int regulator_summary_open(struct inode *inode, struct file *file) -{ - return single_open(file, regulator_summary_show, inode->i_private); -} -#endif - -static const struct file_operations regulator_summary_fops = { -#ifdef CONFIG_DEBUG_FS - .open = regulator_summary_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -#endif -}; +DEFINE_SHOW_ATTRIBUTE(regulator_summary); +#endif /* CONFIG_DEBUG_FS */ static int __init regulator_init(void) { @@ -5542,12 +5514,13 @@ static int __init regulator_init(void) if (!debugfs_root) pr_warn("regulator: Failed to create debugfs directory\n"); +#ifdef CONFIG_DEBUG_FS debugfs_create_file("supply_map", 0444, debugfs_root, NULL, &supply_map_fops); debugfs_create_file("regulator_summary", 0444, debugfs_root, NULL, ®ulator_summary_fops); - +#endif regulator_dummy_init(); return ret; |