summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorTomeu Vizoso <tomeu.vizoso@collabora.com>2015-03-30 17:33:23 +0200
committerMyungJoo Ham <myungjoo.ham@samsung.com>2015-03-31 13:17:15 +0900
commit358b615f5812e28dd763d2aa1297563927a2f89d (patch)
tree198dc4fd8f53d4fe7ea821c15152b0963655167c /drivers
parent34ed504008b2d8d3578191424fc5cddcb76d69f5 (diff)
downloadlinux-358b615f5812e28dd763d2aa1297563927a2f89d.tar.bz2
PM / devfreq: tegra: Register governor on module init
So this driver builds as a module. Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com> Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/devfreq/tegra-devfreq.c37
1 files changed, 30 insertions, 7 deletions
diff --git a/drivers/devfreq/tegra-devfreq.c b/drivers/devfreq/tegra-devfreq.c
index 8e633a6d775d..13a1a6e8108c 100644
--- a/drivers/devfreq/tegra-devfreq.c
+++ b/drivers/devfreq/tegra-devfreq.c
@@ -606,12 +606,6 @@ static struct devfreq_governor tegra_devfreq_governor = {
.event_handler = tegra_governor_event_handler,
};
-static int __init tegra_governor_init(void)
-{
- return devfreq_add_governor(&tegra_devfreq_governor);
-}
-subsys_initcall(tegra_governor_init);
-
static int tegra_devfreq_probe(struct platform_device *pdev)
{
struct tegra_devfreq *tegra;
@@ -755,7 +749,36 @@ static struct platform_driver tegra_devfreq_driver = {
.of_match_table = tegra_devfreq_of_match,
},
};
-module_platform_driver(tegra_devfreq_driver);
+
+static int __init tegra_devfreq_init(void)
+{
+ int ret = 0;
+
+ ret = devfreq_add_governor(&tegra_devfreq_governor);
+ if (ret) {
+ pr_err("%s: failed to add governor: %d\n", __func__, ret);
+ return ret;
+ }
+
+ ret = platform_driver_register(&tegra_devfreq_driver);
+ if (ret)
+ devfreq_remove_governor(&tegra_devfreq_governor);
+
+ return ret;
+}
+module_init(tegra_devfreq_init)
+
+static void __exit tegra_devfreq_exit(void)
+{
+ int ret = 0;
+
+ platform_driver_unregister(&tegra_devfreq_driver);
+
+ ret = devfreq_remove_governor(&tegra_devfreq_governor);
+ if (ret)
+ pr_err("%s: failed to remove governor: %d\n", __func__, ret);
+}
+module_exit(tegra_devfreq_exit)
MODULE_LICENSE("GPL v2");
MODULE_DESCRIPTION("Tegra devfreq driver");