pass: cpuhp: Remove unneeded header file of CPUHP 30/169030/2
authorChanwoo Choi <cw00.choi@samsung.com>
Fri, 2 Feb 2018 01:34:22 +0000 (10:34 +0900)
committerChanwoo Choi <cw00.choi@samsung.com>
Fri, 2 Feb 2018 04:12:46 +0000 (13:12 +0900)
CPUHP's init/exit functions are only called in the PASS core (pass.c).
It means that these functions are not library. Remove header file
of CPUHP module and then uses the 'extern' to call CPUHP's init/exit functions.

Change-Id: I1756448ca086839a577fe9f3880fa95636818a09
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
src/pass/pass-gov.c
src/pass/pass-gov.h [deleted file]
src/pass/pass.c

index f9c7b715c796c9e93e6d085ee0c049556d47ed4d..d4e0b73609c16f43dff8f842e9f8368eadfff393 100644 (file)
 #include <pass/config-parser.h>
 
 #include "pass.h"
-#include "pass-gov.h"
 #include "pass-pmqos.h"
 #include "pass-hal.h"
 #include "pass-rescon.h"
 
+extern int pass_step_governor(struct pass_resource *res);
+extern int pass_radiation_governor(struct pass_resource *res);
+static int __pass_governor_update(struct pass_resource *, enum pass_state);
+
 #define PASS_DEFAULT_CPU_THRESHOLD             20
 #define PASS_DEFAULT_LEVEL_UP_THRESHOLD                30
 #define PASS_DEFAULT_LEVEL_DOWN_THRESHOLD      80
@@ -210,7 +213,7 @@ static gboolean pass_governor_timeout_cb(gpointer data)
                count = 0;
 
                _E("cannot read the 'pass_cpu_stats' sysfs entry");
-               pass_governor_update(res, PASS_OFF);
+               __pass_governor_update(res, PASS_OFF);
 
                return FALSE;
        }
@@ -228,7 +231,7 @@ static gboolean pass_governor_timeout_cb(gpointer data)
                pass_rescon_set_level(res, level);
        } else {
                _E("cannot call the governor function");
-               pass_governor_update(res, PASS_OFF);
+               __pass_governor_update(res, PASS_OFF);
                return FALSE;
        }
 
@@ -279,7 +282,7 @@ static void __pass_governor_start(struct pass_resource *res)
                                (gpointer)res);
                if (!cpuhp->gov_timeout_id) {
                        _E("cannot add core timer for governor");
-                       pass_governor_update(res, PASS_OFF);
+                       __pass_governor_update(res, PASS_OFF);
                        return;
                }
        } else {
@@ -340,7 +343,7 @@ static int __pass_governor_init(struct pass_resource *res)
 
        if (res->config_data.gov_timeout < 0) {
                _E("invalid timeout value [%d]!", res->config_data.gov_timeout);
-               pass_governor_update(res, PASS_OFF);
+               __pass_governor_update(res, PASS_OFF);
                return -EINVAL;
        }
 
@@ -348,7 +351,7 @@ static int __pass_governor_init(struct pass_resource *res)
        cpuhp->state = PASS_OFF;
 
        if (res->config_data.state == PASS_ON)
-               pass_governor_update(res, PASS_ON);
+               __pass_governor_update(res, PASS_ON);
 
        return 0;
 }
@@ -362,7 +365,7 @@ static int __pass_governor_exit(struct pass_resource *res)
         * Stop timer and
         * Restore the frequency and the number of online resources
         */
-       pass_governor_update(res, PASS_OFF);
+       __pass_governor_update(res, PASS_OFF);
 
        /* Free allocated memory */
        for (i = 0; i < cpuhp->num_pass_cpu_stats; i++) {
@@ -560,23 +563,3 @@ int pass_governor_exit(struct pass_resource *res)
 
        return cpuhp->governor->exit(res);
 }
-
-/*
- * pass_governor_update - Restart/Pause PASS governor
- * @res: the instance of struct pass_resource
- * @state: the state of governor
- */
-int pass_governor_update(struct pass_resource *res, enum pass_state state)
-{
-       struct pass_cpuhp *cpuhp;
-
-       if (!res)
-               return -EINVAL;
-
-       cpuhp = &res->cpuhp;
-
-       if (!cpuhp->governor || !cpuhp->governor->update)
-               return -EINVAL;
-
-       return cpuhp->governor->update(res, state);
-}
diff --git a/src/pass/pass-gov.h b/src/pass/pass-gov.h
deleted file mode 100644 (file)
index 5e4b4f0..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * PASS (Power Aware System Service) Governor
- *
- * Copyright (c) 2012 - 2018 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __PASS_GOV__
-#define __PASS_GOV__
-
-/* Init, exit and update the governor */
-int pass_governor_init(struct pass_resource *res);
-int pass_governor_exit(struct pass_resource *res);
-int pass_governor_update(struct pass_resource *res, enum pass_state state);
-
-/* Function for radiation and step governor */
-int pass_step_governor(struct pass_resource *res);
-int pass_radiation_governor(struct pass_resource *res);
-
-#endif /* __PASS_GOV__ */
index 692fad450701049c8413d600d4bc31dcb10d9ff0..e38f01951f74aa31fe297339a79a09a78c49bc05 100644 (file)
@@ -31,7 +31,6 @@
 #include "pass-parser.h"
 #include "pass-pmqos.h"
 #include "pass-hal.h"
-#include "pass-gov.h"
 
 #define DBUS_CORE_I_START_HANDLER              "handle_start"
 #define DBUS_CORE_I_STOP_HANDLER               "handle_stop"
@@ -41,6 +40,9 @@
 #define PASS_CONF_PATH                         "/etc/pass/pass.conf"
 #define PASS_DEFAULT_MIN_LEVEL                 0
 
+extern int pass_governor_init(struct pass_resource *res);
+extern int pass_governor_exit(struct pass_resource *res);
+
 static struct pass g_pass;
 static SystemPassCore *g_gdbus_instance = NULL;