PM / devfreq: Define the constant governor name
authorChanwoo Choi <cw00.choi@samsung.com>
Mon, 23 Oct 2017 01:32:12 +0000 (10:32 +0900)
committerJunghoon Kim <jhoon20.kim@samsung.com>
Thu, 14 Feb 2019 05:56:41 +0000 (14:56 +0900)
Prior to that, the devfreq device uses the governor name when adding
the itself. In order to prevent the mistake used the wrong governor name,
this patch defines the governor name as a constant and then uses them
instead of using the string directly.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Cc: Kukjin Kim <kgene@kernel.org>
Cc: Krzysztof Kozlowski <krzk@kernel.org>
Cc: linux-samsung-soc@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
drivers/devfreq/exynos-bus.c
drivers/devfreq/governor_passive.c
drivers/devfreq/governor_performance.c
drivers/devfreq/governor_powersave.c
drivers/devfreq/governor_simpleondemand.c
drivers/devfreq/governor_userspace.c
drivers/devfreq/rk3399_dmc.c
include/linux/devfreq.h

index 49f6892..c25658b 100644 (file)
@@ -436,7 +436,8 @@ static int exynos_bus_probe(struct platform_device *pdev)
        ondemand_data->downdifferential = 5;
 
        /* Add devfreq device to monitor and handle the exynos bus */
-       bus->devfreq = devm_devfreq_add_device(dev, profile, "simple_ondemand",
+       bus->devfreq = devm_devfreq_add_device(dev, profile,
+                                               DEVFREQ_GOV_SIMPLE_ONDEMAND,
                                                ondemand_data);
        if (IS_ERR(bus->devfreq)) {
                dev_err(dev, "failed to add devfreq device\n");
@@ -488,7 +489,7 @@ passive:
        passive_data->parent = parent_devfreq;
 
        /* Add devfreq device for exynos bus with passive governor */
-       bus->devfreq = devm_devfreq_add_device(dev, profile, "passive",
+       bus->devfreq = devm_devfreq_add_device(dev, profile, DEVFREQ_GOV_PASSIVE,
                                                passive_data);
        if (IS_ERR(bus->devfreq)) {
                dev_err(dev,
index 673ad8c..3bc29ac 100644 (file)
@@ -183,7 +183,7 @@ static int devfreq_passive_event_handler(struct devfreq *devfreq,
 }
 
 static struct devfreq_governor devfreq_passive = {
-       .name = "passive",
+       .name = DEVFREQ_GOV_PASSIVE,
        .immutable = 1,
        .get_target_freq = devfreq_passive_get_target_freq,
        .event_handler = devfreq_passive_event_handler,
index c72f942..4d23ecf 100644 (file)
@@ -42,7 +42,7 @@ static int devfreq_performance_handler(struct devfreq *devfreq,
 }
 
 static struct devfreq_governor devfreq_performance = {
-       .name = "performance",
+       .name = DEVFREQ_GOV_PERFORMANCE,
        .get_target_freq = devfreq_performance_func,
        .event_handler = devfreq_performance_handler,
 };
index 0c6bed5..0c42f23 100644 (file)
@@ -39,7 +39,7 @@ static int devfreq_powersave_handler(struct devfreq *devfreq,
 }
 
 static struct devfreq_governor devfreq_powersave = {
-       .name = "powersave",
+       .name = DEVFREQ_GOV_POWERSAVE,
        .get_target_freq = devfreq_powersave_func,
        .event_handler = devfreq_powersave_handler,
 };
index ae72ba5..28e0f2d 100644 (file)
@@ -125,7 +125,7 @@ static int devfreq_simple_ondemand_handler(struct devfreq *devfreq,
 }
 
 static struct devfreq_governor devfreq_simple_ondemand = {
-       .name = "simple_ondemand",
+       .name = DEVFREQ_GOV_SIMPLE_ONDEMAND,
        .get_target_freq = devfreq_simple_ondemand_func,
        .event_handler = devfreq_simple_ondemand_handler,
 };
index 77028c2..080607c 100644 (file)
@@ -87,7 +87,7 @@ static struct attribute *dev_entries[] = {
        NULL,
 };
 static const struct attribute_group dev_attr_group = {
-       .name   = "userspace",
+       .name   = DEVFREQ_GOV_USERSPACE,
        .attrs  = dev_entries,
 };
 
index 1b89ebb..5dfbfa3 100644 (file)
@@ -431,7 +431,7 @@ static int rk3399_dmcfreq_probe(struct platform_device *pdev)
 
        data->devfreq = devm_devfreq_add_device(dev,
                                           &rk3399_devfreq_dmc_profile,
-                                          "simple_ondemand",
+                                          DEVFREQ_GOV_SIMPLE_ONDEMAND,
                                           &data->ondemand_data);
        if (IS_ERR(data->devfreq))
                return PTR_ERR(data->devfreq);
index 1952062..3aae5b3 100644 (file)
 
 #define DEVFREQ_NAME_LEN 16
 
+/* DEVFREQ governor name */
+#define DEVFREQ_GOV_SIMPLE_ONDEMAND    "simple_ondemand"
+#define DEVFREQ_GOV_PERFORMANCE                "performance"
+#define DEVFREQ_GOV_POWERSAVE          "powersave"
+#define DEVFREQ_GOV_USERSPACE          "userspace"
+#define DEVFREQ_GOV_PASSIVE            "passive"
+
 /* DEVFREQ notifier interface */
 #define DEVFREQ_TRANSITION_NOTIFIER    (0)