diff options
author | Chanwoo Choi <cw00.choi@samsung.com> | 2014-05-09 03:43:10 -0400 |
---|---|---|
committer | MyungJoo Ham <myungjoo.ham@samsung.com> | 2014-05-24 09:33:45 -0400 |
commit | c1b13d4e54d9777dc68c28503728ea63c6bfff37 (patch) | |
tree | 037e21db97e65841bc9f2ccf726e984a79875d18 /drivers/devfreq | |
parent | d5b040d0cab9cae1dc1ad61a07019062235f4878 (diff) |
PM / devfreq: exynos4: Use devm_devfreq_* function using device resource management
This patch uses devm_devfreq_add_device()/devm_devfreq_register_opp_notifier()
to control automatically the resource of devfreq.
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Cc: Kukjin Kim <kgene.kim@samsung.com>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-samsung-soc@vger.kernel.org
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Diffstat (limited to 'drivers/devfreq')
-rw-r--r-- | drivers/devfreq/exynos/exynos4_bus.c | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/drivers/devfreq/exynos/exynos4_bus.c b/drivers/devfreq/exynos/exynos4_bus.c index d257f1fcbaa9..bebb0a42b48e 100644 --- a/drivers/devfreq/exynos/exynos4_bus.c +++ b/drivers/devfreq/exynos/exynos4_bus.c | |||
@@ -979,7 +979,7 @@ static int exynos4_busfreq_probe(struct platform_device *pdev) | |||
979 | 979 | ||
980 | platform_set_drvdata(pdev, data); | 980 | platform_set_drvdata(pdev, data); |
981 | 981 | ||
982 | data->devfreq = devfreq_add_device(dev, &exynos4_devfreq_profile, | 982 | data->devfreq = devm_devfreq_add_device(dev, &exynos4_devfreq_profile, |
983 | "simple_ondemand", NULL); | 983 | "simple_ondemand", NULL); |
984 | if (IS_ERR(data->devfreq)) | 984 | if (IS_ERR(data->devfreq)) |
985 | return PTR_ERR(data->devfreq); | 985 | return PTR_ERR(data->devfreq); |
@@ -991,27 +991,20 @@ static int exynos4_busfreq_probe(struct platform_device *pdev) | |||
991 | busfreq_mon_reset(ppmu_data); | 991 | busfreq_mon_reset(ppmu_data); |
992 | 992 | ||
993 | /* Register opp_notifier for Exynos4 busfreq */ | 993 | /* Register opp_notifier for Exynos4 busfreq */ |
994 | err = devfreq_register_opp_notifier(dev, data->devfreq); | 994 | err = devm_devfreq_register_opp_notifier(dev, data->devfreq); |
995 | if (err < 0) { | 995 | if (err < 0) { |
996 | dev_err(dev, "Failed to register opp notifier\n"); | 996 | dev_err(dev, "Failed to register opp notifier\n"); |
997 | goto err_notifier_opp; | 997 | return err; |
998 | } | 998 | } |
999 | 999 | ||
1000 | /* Register pm_notifier for Exynos4 busfreq */ | 1000 | /* Register pm_notifier for Exynos4 busfreq */ |
1001 | err = register_pm_notifier(&data->pm_notifier); | 1001 | err = register_pm_notifier(&data->pm_notifier); |
1002 | if (err) { | 1002 | if (err) { |
1003 | dev_err(dev, "Failed to setup pm notifier\n"); | 1003 | dev_err(dev, "Failed to setup pm notifier\n"); |
1004 | goto err_notifier_pm; | 1004 | return err; |
1005 | } | 1005 | } |
1006 | 1006 | ||
1007 | return 0; | 1007 | return 0; |
1008 | |||
1009 | err_notifier_pm: | ||
1010 | devfreq_unregister_opp_notifier(dev, data->devfreq); | ||
1011 | err_notifier_opp: | ||
1012 | devfreq_remove_device(data->devfreq); | ||
1013 | |||
1014 | return err; | ||
1015 | } | 1008 | } |
1016 | 1009 | ||
1017 | static int exynos4_busfreq_remove(struct platform_device *pdev) | 1010 | static int exynos4_busfreq_remove(struct platform_device *pdev) |
@@ -1020,10 +1013,6 @@ static int exynos4_busfreq_remove(struct platform_device *pdev) | |||
1020 | 1013 | ||
1021 | /* Unregister all of notifier chain */ | 1014 | /* Unregister all of notifier chain */ |
1022 | unregister_pm_notifier(&data->pm_notifier); | 1015 | unregister_pm_notifier(&data->pm_notifier); |
1023 | devfreq_unregister_opp_notifier(data->dev, data->devfreq); | ||
1024 | |||
1025 | /* Remove devfreq instance */ | ||
1026 | devfreq_remove_device(data->devfreq); | ||
1027 | 1016 | ||
1028 | return 0; | 1017 | return 0; |
1029 | } | 1018 | } |