diff options
author | Chanwoo Choi <cw00.choi@samsung.com> | 2014-05-09 03:43:11 -0400 |
---|---|---|
committer | MyungJoo Ham <myungjoo.ham@samsung.com> | 2014-05-24 09:33:48 -0400 |
commit | 2456963c0b736f4111f9c4517ae12f63d332c312 (patch) | |
tree | 775794816b9be821f12781ce76a27a29a2926777 /drivers/devfreq/exynos/exynos5_bus.c | |
parent | c1b13d4e54d9777dc68c28503728ea63c6bfff37 (diff) |
PM / devfreq: exynos5: 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: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: Manish Badarkhe <badarkhe.manish@gmail.com>
Cc: Abhilash Kesavan <a.kesavan@samsung.com>
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/exynos/exynos5_bus.c')
-rw-r--r-- | drivers/devfreq/exynos/exynos5_bus.c | 29 |
1 files changed, 8 insertions, 21 deletions
diff --git a/drivers/devfreq/exynos/exynos5_bus.c b/drivers/devfreq/exynos/exynos5_bus.c index ab54a69d09b2..6cd0392e2798 100644 --- a/drivers/devfreq/exynos/exynos5_bus.c +++ b/drivers/devfreq/exynos/exynos5_bus.c | |||
@@ -163,21 +163,12 @@ static int exynos5_int_get_dev_status(struct device *dev, | |||
163 | 163 | ||
164 | return 0; | 164 | return 0; |
165 | } | 165 | } |
166 | static void exynos5_int_exit(struct device *dev) | ||
167 | { | ||
168 | struct platform_device *pdev = container_of(dev, struct platform_device, | ||
169 | dev); | ||
170 | struct busfreq_data_int *data = platform_get_drvdata(pdev); | ||
171 | |||
172 | devfreq_unregister_opp_notifier(dev, data->devfreq); | ||
173 | } | ||
174 | 166 | ||
175 | static struct devfreq_dev_profile exynos5_devfreq_int_profile = { | 167 | static struct devfreq_dev_profile exynos5_devfreq_int_profile = { |
176 | .initial_freq = 160000, | 168 | .initial_freq = 160000, |
177 | .polling_ms = 100, | 169 | .polling_ms = 100, |
178 | .target = exynos5_busfreq_int_target, | 170 | .target = exynos5_busfreq_int_target, |
179 | .get_dev_status = exynos5_int_get_dev_status, | 171 | .get_dev_status = exynos5_int_get_dev_status, |
180 | .exit = exynos5_int_exit, | ||
181 | }; | 172 | }; |
182 | 173 | ||
183 | static int exynos5250_init_int_tables(struct busfreq_data_int *data) | 174 | static int exynos5250_init_int_tables(struct busfreq_data_int *data) |
@@ -343,30 +334,27 @@ static int exynos5_busfreq_int_probe(struct platform_device *pdev) | |||
343 | 334 | ||
344 | busfreq_mon_reset(ppmu_data); | 335 | busfreq_mon_reset(ppmu_data); |
345 | 336 | ||
346 | data->devfreq = devfreq_add_device(dev, &exynos5_devfreq_int_profile, | 337 | data->devfreq = devm_devfreq_add_device(dev, &exynos5_devfreq_int_profile, |
347 | "simple_ondemand", NULL); | 338 | "simple_ondemand", NULL); |
339 | if (IS_ERR(data->devfreq)) | ||
340 | return PTR_ERR(data->devfreq); | ||
348 | 341 | ||
349 | if (IS_ERR(data->devfreq)) { | 342 | err = devm_devfreq_register_opp_notifier(dev, data->devfreq); |
350 | err = PTR_ERR(data->devfreq); | 343 | if (err < 0) { |
351 | goto err_devfreq_add; | 344 | dev_err(dev, "Failed to register opp notifier\n"); |
345 | return err; | ||
352 | } | 346 | } |
353 | 347 | ||
354 | devfreq_register_opp_notifier(dev, data->devfreq); | ||
355 | |||
356 | err = register_pm_notifier(&data->pm_notifier); | 348 | err = register_pm_notifier(&data->pm_notifier); |
357 | if (err) { | 349 | if (err) { |
358 | dev_err(dev, "Failed to setup pm notifier\n"); | 350 | dev_err(dev, "Failed to setup pm notifier\n"); |
359 | goto err_devfreq_add; | 351 | return err; |
360 | } | 352 | } |
361 | 353 | ||
362 | /* TODO: Add a new QOS class for int/mif bus */ | 354 | /* TODO: Add a new QOS class for int/mif bus */ |
363 | pm_qos_add_request(&data->int_req, PM_QOS_NETWORK_THROUGHPUT, -1); | 355 | pm_qos_add_request(&data->int_req, PM_QOS_NETWORK_THROUGHPUT, -1); |
364 | 356 | ||
365 | return 0; | 357 | return 0; |
366 | |||
367 | err_devfreq_add: | ||
368 | devfreq_remove_device(data->devfreq); | ||
369 | return err; | ||
370 | } | 358 | } |
371 | 359 | ||
372 | static int exynos5_busfreq_int_remove(struct platform_device *pdev) | 360 | static int exynos5_busfreq_int_remove(struct platform_device *pdev) |
@@ -375,7 +363,6 @@ static int exynos5_busfreq_int_remove(struct platform_device *pdev) | |||
375 | 363 | ||
376 | pm_qos_remove_request(&data->int_req); | 364 | pm_qos_remove_request(&data->int_req); |
377 | unregister_pm_notifier(&data->pm_notifier); | 365 | unregister_pm_notifier(&data->pm_notifier); |
378 | devfreq_remove_device(data->devfreq); | ||
379 | 366 | ||
380 | return 0; | 367 | return 0; |
381 | } | 368 | } |