pmqos: Fix bug of 'support' property of pass-pmqos.conf 75/133475/1
authorChanwoo Choi <cw00.choi@samsung.com>
Mon, 12 Jun 2017 10:28:43 +0000 (19:28 +0900)
committerChanwoo Choi <cw00.choi@samsung.com>
Mon, 12 Jun 2017 10:42:03 +0000 (19:42 +0900)
This patch fixes the bug related to 'support' property of pass-pmqos.conf.

PASS PMQoS has the pass-pmqos.conf which contains the supported scenario
name and the number of supported scenarios. Each scenario has the 'support'
property indicating whether scenario is supported or not on platform.

If the 'support' property value is changed from 'yes' to 'no',
PASS shows the following error log during the init step.
[error log]
 edbus-handler.c: register_method(713) > fail to add method (null)!
 edbus-handler.c: register_edbus_method(862) > fail to register /Org/Tizen/System/Pass/Pmqos method(-22)
 pmqos.c: pmqos_init_done(395) > fail to init edbus method from conf(-22)

Change-Id: Icbb0d29c941345f21c3bcc4ae513ff73095a3aff
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
src/pmqos/pmqos.c

index 26083ec..1869c00 100644 (file)
@@ -307,7 +307,7 @@ static int get_methods_from_conf(const char *path, struct edbus_method **edbus_m
 {
        struct edbus_method *methods;
        struct pmqos_scenario scenarios = {0,};
-       int i, ret;
+       int i, ret, count = 0;
 
        /* get pmqos table from conf */
        ret = pmqos_get_scenario(path, &scenarios);
@@ -334,20 +334,21 @@ static int get_methods_from_conf(const char *path, struct edbus_method **edbus_m
 
        /* set edbus_methods structure */
        for (i = 0; i < scenarios.num; ++i) {
-
                /* if this scenario does not support */
                if (!scenarios.list[i].support)
                        continue;
 
-               methods[i].member = scenarios.list[i].name;
-               methods[i].signature = "i";
-               methods[i].reply_signature = "i";
-               methods[i].func = dbus_pmqos_handler;
+               methods[count].member = scenarios.list[i].name;
+               methods[count].signature = "i";
+               methods[count].reply_signature = "i";
+               methods[count].func = dbus_pmqos_handler;
+               count++;
+
                _D("support [%s] scenario", scenarios.list[i].name);
        }
 
        *edbus_methods = methods;
-       ret = scenarios.num;
+       ret = count;
        pmqos_put_scenario(&scenarios);
 
        return ret;