Signed-off-by: Thomas Renninger <[email protected]>

---
 config.c |   58 +++++++++++++++++++++++++++++-----------------------------
 1 file changed, 29 insertions(+), 29 deletions(-)

Index: powertop/config.c
===================================================================
--- powertop.orig/config.c
+++ powertop/config.c
@@ -36,6 +36,35 @@
 static char configlines[5000][100];
 static int configcount;
 
+/*
+ * Suggest the user to turn on/off a kernel config option.
+ * "comment" gets displayed if it's not already set to the right value 
+ */
+void suggest_kernel_config(char *string, int onoff, char *comment, int weight)
+{
+       int i;
+       char searchon[100];
+       char searchoff[100];
+       int found = 0;
+
+       read_kernel_config();
+
+       sprintf(searchon, "%s=", string);
+       sprintf(searchoff, "# %s is not set", string);
+
+       for (i = 0; i < configcount; i++) {
+               if (onoff && strstr(configlines[i], searchon))
+                       return;
+               if (onoff==0 && strstr(configlines[i], searchoff))
+                       return;
+               if (onoff==0 && strstr(configlines[i], searchon))
+                       found = 1;
+       }
+       if (onoff || found)
+               add_suggestion(comment, weight, 0, NULL, NULL);
+       fflush(stdout);
+}
+
 static void read_kernel_config(void)
 {
        FILE *file;
@@ -81,32 +110,3 @@ static void read_kernel_config(void)
        }
        fclose(file);
 }
-
-/*
- * Suggest the user to turn on/off a kernel config option.
- * "comment" gets displayed if it's not already set to the right value 
- */
-void suggest_kernel_config(char *string, int onoff, char *comment, int weight)
-{
-       int i;
-       char searchon[100];
-       char searchoff[100];
-       int found = 0;
-
-       read_kernel_config();
-
-       sprintf(searchon, "%s=", string);
-       sprintf(searchoff, "# %s is not set", string);
-
-       for (i = 0; i < configcount; i++) {
-               if (onoff && strstr(configlines[i], searchon))
-                       return;
-               if (onoff==0 && strstr(configlines[i], searchoff))
-                       return;
-               if (onoff==0 && strstr(configlines[i], searchon))
-                       found = 1;
-       }
-       if (onoff || found)
-               add_suggestion(comment, weight, 0, NULL, NULL);
-       fflush(stdout);
-}

_______________________________________________
Power mailing list
[email protected]
http://www.bughost.org/mailman/listinfo/power

Reply via email to