From 417dc4bb6b8daa6f87d42bc8ffcefe871f7282bc Mon Sep 17 00:00:00 2001 From: Paul Gortmaker Date: Sun, 26 Jun 2016 03:43:47 +0900 Subject: PM / devfreq: make devfreq explicitly non-modular The Kconfig currently controlling compilation of this code is: menuconfig PM_DEVFREQ bool "Generic Dynamic Voltage and Frequency Scaling (DVFS) support" ...meaning that it currently is not being built as a module by anyone. Lets remove the modular code that is essentially orphaned, so that when reading the driver there is no doubt it is builtin-only. This code wasn't using module_init, so we don't need to be concerned with altering the initcall level here. We also delete the MODULE_LICENSE tag etc. since all that information is already contained at the top of the file in the comments. We don't replace module.h with init.h since the file already has that. But we do add export.h since this file does export some symbols. Signed-off-by: Paul Gortmaker Reviewed-by: Chanwoo Choi Signed-off-by: MyungJoo Ham diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index e92418f..3cc558d 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include #include #include @@ -1199,13 +1199,6 @@ static int __init devfreq_init(void) } subsys_initcall(devfreq_init); -static void __exit devfreq_exit(void) -{ - class_destroy(devfreq_class); - destroy_workqueue(devfreq_wq); -} -module_exit(devfreq_exit); - /* * The followings are helper functions for devfreq user device drivers with * OPP framework. @@ -1471,7 +1464,3 @@ void devm_devfreq_unregister_notifier(struct device *dev, devm_devfreq_dev_match, devfreq)); } EXPORT_SYMBOL(devm_devfreq_unregister_notifier); - -MODULE_AUTHOR("MyungJoo Ham "); -MODULE_DESCRIPTION("devfreq class support"); -MODULE_LICENSE("GPL"); -- cgit v0.10.2 From e32363bc53d429488f304fe975e530b0b175dc33 Mon Sep 17 00:00:00 2001 From: Paul Gortmaker Date: Sun, 26 Jun 2016 03:43:48 +0900 Subject: PM / devfreq: make devfreq-event explicitly non-modular The Kconfig currently controlling compilation of this code is: menuconfig PM_DEVFREQ_EVENT bool "DEVFREQ-Event device Support" ...meaning that it currently is not being built as a module by anyone. Lets remove the modular code that is essentially orphaned, so that when reading the driver there is no doubt it is builtin-only. This code wasn't using module_init, so we don't need to be concerned with altering the initcall level here. We don't replace module.h with init.h since the file already has that. But we do add export.h since this file does export some symbols. We also delete the MODULE_LICENSE tag etc. since all that information is already contained at the top of the file in the comments. Signed-off-by: Paul Gortmaker Acked-by: Chanwoo Choi Signed-off-by: MyungJoo Ham diff --git a/drivers/devfreq/devfreq-event.c b/drivers/devfreq/devfreq-event.c index 39b048e..9aea2c7 100644 --- a/drivers/devfreq/devfreq-event.c +++ b/drivers/devfreq/devfreq-event.c @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include #include #include @@ -481,13 +481,3 @@ static int __init devfreq_event_init(void) return 0; } subsys_initcall(devfreq_event_init); - -static void __exit devfreq_event_exit(void) -{ - class_destroy(devfreq_event_class); -} -module_exit(devfreq_event_exit); - -MODULE_AUTHOR("Chanwoo Choi "); -MODULE_DESCRIPTION("DEVFREQ-Event class support"); -MODULE_LICENSE("GPL"); -- cgit v0.10.2 From 5b3c316cbce306a337fce20f3e07ca5e77d6656b Mon Sep 17 00:00:00 2001 From: Paul Gortmaker Date: Sun, 26 Jun 2016 03:43:49 +0900 Subject: PM / devfreq: make exynos-bus ARM_EXYNOS_BUS_DEVFREQ tristate The Kconfig currently controlling compilation of this code is: devfreq/Kconfig:config ARM_EXYNOS_BUS_DEVFREQ devfreq/Kconfig: bool "ARM EXYNOS Generic Memory Bus DEVFREQ Driver" ...meaning that it currently is not being built as a module by anyone. Rather than rip out the existing modular code, Chanwoo indicated that he'd rather see the driver offered as tristate. I don't have the hardware for runtime validation, so this change is only validated for compile and modpost. Signed-off-by: Paul Gortmaker Acked-by: Chanwoo Choi Signed-off-by: MyungJoo Ham diff --git a/drivers/devfreq/Kconfig b/drivers/devfreq/Kconfig index 78dac0e..a5be56e 100644 --- a/drivers/devfreq/Kconfig +++ b/drivers/devfreq/Kconfig @@ -75,7 +75,7 @@ config DEVFREQ_GOV_PASSIVE comment "DEVFREQ Drivers" config ARM_EXYNOS_BUS_DEVFREQ - bool "ARM EXYNOS Generic Memory Bus DEVFREQ Driver" + tristate "ARM EXYNOS Generic Memory Bus DEVFREQ Driver" depends on ARCH_EXYNOS select DEVFREQ_GOV_SIMPLE_ONDEMAND select DEVFREQ_GOV_PASSIVE -- cgit v0.10.2 From 64cb7f67529292e3c7a00a852d12b769a192ffec Mon Sep 17 00:00:00 2001 From: Paul Gortmaker Date: Sat, 25 Jun 2016 14:43:50 -0400 Subject: PM / devfreq: make event/exynos-nocp DEVFREQ_EVENT_EXYNOS_NOCP tristate The Kconfig currently controlling compilation of this code is: event/Kconfig:config DEVFREQ_EVENT_EXYNOS_NOCP event/Kconfig: bool "EXYNOS NoC (Network On Chip) Probe DEVFREQ event Driver" ...meaning that it currently is not being built as a module by anyone. Rather than rip out the existing modular code, Chanwoo indicated that he'd rather see the driver offered as tristate. I don't have the hardware for runtime validation, so this change is only validated for compile and modpost. Signed-off-by: Paul Gortmaker Acked-by: Chanwoo Choi Signed-off-by: MyungJoo Ham diff --git a/drivers/devfreq/event/Kconfig b/drivers/devfreq/event/Kconfig index 1e8b4f4..96ea29d 100644 --- a/drivers/devfreq/event/Kconfig +++ b/drivers/devfreq/event/Kconfig @@ -14,7 +14,7 @@ menuconfig PM_DEVFREQ_EVENT if PM_DEVFREQ_EVENT config DEVFREQ_EVENT_EXYNOS_NOCP - bool "EXYNOS NoC (Network On Chip) Probe DEVFREQ event Driver" + tristate "EXYNOS NoC (Network On Chip) Probe DEVFREQ event Driver" depends on ARCH_EXYNOS select PM_OPP help -- cgit v0.10.2 From a63eb1a6aba46677602756167cdc981d2fa2ef62 Mon Sep 17 00:00:00 2001 From: Paul Gortmaker Date: Sun, 26 Jun 2016 03:43:51 +0900 Subject: PM / devfreq: make event/exynos-ppmu DEVFREQ_EVENT_EXYNOS_PPMU tristate The Kconfig currently controlling compilation of this code is: config DEVFREQ_EVENT_EXYNOS_PPMU bool "EXYNOS PPMU (Platform Performance Monitoring Unit) DEVFREQ event Driver" ...meaning that it currently is not being built as a module by anyone. Rather than rip out the existing modular code, Chanwoo indicated that he'd rather see the driver offered as tristate. I don't have the hardware for runtime validation, so this change is only validated for compile and modpost. Signed-off-by: Paul Gortmaker Acked-by: Chanwoo Choi Signed-off-by: MyungJoo Ham diff --git a/drivers/devfreq/event/Kconfig b/drivers/devfreq/event/Kconfig index 96ea29d..eb6f74a 100644 --- a/drivers/devfreq/event/Kconfig +++ b/drivers/devfreq/event/Kconfig @@ -22,7 +22,7 @@ config DEVFREQ_EVENT_EXYNOS_NOCP (Network on Chip) Probe counters to measure the bandwidth of AXI bus. config DEVFREQ_EVENT_EXYNOS_PPMU - bool "EXYNOS PPMU (Platform Performance Monitoring Unit) DEVFREQ event Driver" + tristate "EXYNOS PPMU (Platform Performance Monitoring Unit) DEVFREQ event Driver" depends on ARCH_EXYNOS select PM_OPP help -- cgit v0.10.2 From c07e074b7cae0eff47453f96438c9a867aa6f82e Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Tue, 28 Jun 2016 13:21:09 +0200 Subject: PM / devfreq: exynos: fix error path in exynos_bus_probe() In case of exynos_bus_parse_of() failure the code shouldn't try to remove the OPP table and disable+unprepare bus->clk as it has been already handled in exynos_bus_parse_of(). Signed-off-by: Bartlomiej Zolnierkiewicz Acked-by: Chanwoo Choi Signed-off-by: MyungJoo Ham diff --git a/drivers/devfreq/exynos-bus.c b/drivers/devfreq/exynos-bus.c index 2363d0a..e946f8f 100644 --- a/drivers/devfreq/exynos-bus.c +++ b/drivers/devfreq/exynos-bus.c @@ -407,7 +407,7 @@ static int exynos_bus_probe(struct platform_device *pdev) /* Parse the device-tree to get the resource information */ ret = exynos_bus_parse_of(np, bus); if (ret < 0) - goto err; + return ret; profile = devm_kzalloc(dev, sizeof(*profile), GFP_KERNEL); if (!profile) { -- cgit v0.10.2 From 99e65ae09a1c853fe36a89d9333fdcbff07de327 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Tue, 28 Jun 2016 20:21:08 +0900 Subject: PM / devfreq: exynos-ppmu: fix error path in exynos_ppmu_probe() iounmap() needs to be called in case of memory allocation (for devfreq-event devices) failure. Fix it. Signed-off-by: Bartlomiej Zolnierkiewicz Acked-by: Chanwoo Choi Signed-off-by: MyungJoo Ham diff --git a/drivers/devfreq/event/exynos-ppmu.c b/drivers/devfreq/event/exynos-ppmu.c index f312485..845bf25 100644 --- a/drivers/devfreq/event/exynos-ppmu.c +++ b/drivers/devfreq/event/exynos-ppmu.c @@ -482,7 +482,8 @@ static int exynos_ppmu_probe(struct platform_device *pdev) if (!info->edev) { dev_err(&pdev->dev, "failed to allocate memory devfreq-event devices\n"); - return -ENOMEM; + ret = -ENOMEM; + goto err; } edev = info->edev; platform_set_drvdata(pdev, info); -- cgit v0.10.2 From 3427c6f0b6f5643543f9b6c55f80bee83c0d5ff3 Mon Sep 17 00:00:00 2001 From: Peter Chen Date: Fri, 1 Jul 2016 17:42:00 +0800 Subject: PM / devfreq: add missing of_node_put after calling of_parse_phandle of_node_put needs to be called when the device node which is got from of_parse_phandle has finished using. Cc: MyungJoo Ham Cc: Kyungmin Park Signed-off-by: Peter Chen Signed-off-by: MyungJoo Ham diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index 3cc558d..478006b 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -707,10 +707,12 @@ struct devfreq *devfreq_get_devfreq_by_phandle(struct device *dev, int index) if (devfreq->dev.parent && devfreq->dev.parent->of_node == node) { mutex_unlock(&devfreq_list_lock); + of_node_put(node); return devfreq; } } mutex_unlock(&devfreq_list_lock); + of_node_put(node); return ERR_PTR(-EPROBE_DEFER); } -- cgit v0.10.2 From d8150d14e9bc44ba55c707cc67f4fa66d65cfdef Mon Sep 17 00:00:00 2001 From: Peter Chen Date: Fri, 1 Jul 2016 17:42:01 +0800 Subject: PM / devfreq: exynos-bus: add missing of_node_put after calling of_parse_phandle of_node_put needs to be called when the device node which is got from of_parse_phandle has finished using. [Commit updated to fix an error by MyungJoo] Cc: Chanwoo Choi Cc: MyungJoo Ham Cc: Kyungmin Park Cc: Kukjin Kim Cc: Krzysztof Kozlowski Signed-off-by: Peter Chen Acked-by: Chanwoo Choi Signed-off-by: MyungJoo Ham diff --git a/drivers/devfreq/exynos-bus.c b/drivers/devfreq/exynos-bus.c index e946f8f..29866f7 100644 --- a/drivers/devfreq/exynos-bus.c +++ b/drivers/devfreq/exynos-bus.c @@ -383,7 +383,7 @@ err_clk: static int exynos_bus_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; - struct device_node *np = dev->of_node; + struct device_node *np = dev->of_node, *node; struct devfreq_dev_profile *profile; struct devfreq_simple_ondemand_data *ondemand_data; struct devfreq_passive_data *passive_data; @@ -415,10 +415,13 @@ static int exynos_bus_probe(struct platform_device *pdev) goto err; } - if (of_parse_phandle(dev->of_node, "devfreq", 0)) + node = of_parse_phandle(dev->of_node, "devfreq", 0); + if (node) { + of_node_put(node); goto passive; - else + } else { ret = exynos_bus_parent_parse_of(np, bus); + } if (ret < 0) goto err; -- cgit v0.10.2