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;
 
        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)
 {
        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;
 
        u8 *state_after_suspend;
 } rdebug;
 
-static int ux500_regulator_power_state_cnt_print(struct seq_file *s, void *p)
+static int ux500_regulator_power_state_cnt_show(struct seq_file *s, void *p)
 {
        /* print power state count */
        seq_printf(s, "ux500-regulator power state count: %i\n",
 
        return 0;
 }
+DEFINE_SHOW_ATTRIBUTE(ux500_regulator_power_state_cnt);
 
-static int ux500_regulator_power_state_cnt_open(struct inode *inode,
-       struct file *file)
-{
-       return single_open(file, ux500_regulator_power_state_cnt_print,
-               inode->i_private);
-}
-
-static const struct file_operations ux500_regulator_power_state_cnt_fops = {
-       .open = ux500_regulator_power_state_cnt_open,
-       .read = seq_read,
-       .llseek = seq_lseek,
-       .release = single_release,
-       .owner = THIS_MODULE,
-};
-
-static int ux500_regulator_status_print(struct seq_file *s, void *p)
+static int ux500_regulator_status_show(struct seq_file *s, void *p)
 {
        int i;
 
 
        return 0;
 }
-
-static int ux500_regulator_status_open(struct inode *inode, struct file *file)
-{
-       return single_open(file, ux500_regulator_status_print,
-               inode->i_private);
-}
-
-static const struct file_operations ux500_regulator_status_fops = {
-       .open = ux500_regulator_status_open,
-       .read = seq_read,
-       .llseek = seq_lseek,
-       .release = single_release,
-       .owner = THIS_MODULE,
-};
+DEFINE_SHOW_ATTRIBUTE(ux500_regulator_status);
 
 int __attribute__((weak)) dbx500_regulator_testcase(
        struct dbx500_regulator_info *regulator_info,