[FIX] Energy: debugfs init order 93/42593/3
authorAlexander Aksenov <a.aksenov@samsung.com>
Tue, 30 Jun 2015 11:03:41 +0000 (14:03 +0300)
committerDmitry Kovalenko <d.kovalenko@samsung.com>
Thu, 2 Jul 2015 10:01:12 +0000 (03:01 -0700)
Change-Id: I4bd20279239f9787a70d3c13534f0fd301cf705c
Signed-off-by: Alexander Aksenov <a.aksenov@samsung.com>
energy/debugfs_energy.c
energy/energy.c
energy/lcd/lcd_base.c

index bd425f6..146ae14 100644 (file)
@@ -32,6 +32,7 @@
 #include "debugfs_energy.h"
 #include "rational_debugfs.h"
 #include "lcd/lcd_debugfs.h"
+#include "lcd/lcd_base.h"
 
 
 /* CPU running */
@@ -244,6 +245,9 @@ struct dentry *get_energy_dir(void)
  */
 void exit_debugfs_energy(void)
 {
+       lcd_exit();
+       exit_lcd_debugfs();
+
        if (energy_dir)
                debugfs_remove_recursive(energy_dir);
 
@@ -274,6 +278,16 @@ int init_debugfs_energy(void)
                        goto fail;
        }
 
+       if (init_lcd_debugfs(energy_dir))
+               goto fail;
+
+       /* Actually, the only goal of lcd_init() is to register lcd screen's
+          debugfs, so it is called here. */
+       if (lcd_init()) {
+               exit_lcd_debugfs();
+               goto fail;
+       }
+
        return 0;
 
 fail:
index af06b20..3192f19 100644 (file)
@@ -685,16 +685,10 @@ int energy_init(void)
        int ret;
 
        ret = init_feature();
-       if (ret) {
-               printk(KERN_INFO "Cannot init feature\n");
-               return ret;
-       }
-
-       ret = lcd_init();
        if (ret)
-               printk(KERN_INFO "Cannot init LCD, ret=%d\n", ret);
+               printk(KERN_INFO "Cannot init feature\n");
 
-       return 0;
+       return ret;
 }
 
 /**
@@ -704,7 +698,6 @@ int energy_init(void)
  */
 void energy_uninit(void)
 {
-       lcd_exit();
        uninit_feature();
 
        if (energy_enable)
index 5b53b6a..627ccb2 100644 (file)
@@ -377,7 +377,6 @@ static void do_lcd_exit(void)
 void lcd_exit(void)
 {
        do_lcd_exit();
-       exit_lcd_debugfs();
 }
 
 static int do_lcd_init(void)
@@ -420,23 +419,10 @@ static int do_lcd_init(void)
 int lcd_init(void)
 {
        int ret;
-       struct dentry *energy_dir;
-
-       energy_dir = get_energy_dir();
-       if (energy_dir == NULL) {
-               printk(KERN_INFO "Cannot energy_dir\n");
-               return -ENOENT;
-       }
-
-       ret = init_lcd_debugfs(energy_dir);
-       if (ret)
-               return ret;
 
        ret = do_lcd_init();
-       if (ret) {
+       if (ret)
                printk(KERN_INFO "LCD is not supported\n");
-               exit_lcd_debugfs();
-       }
 
        return ret;
 }