Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Chanwoo Choi and committed by
MyungJoo Ham
2456963c c1b13d4e

+8 -21
+8 -21
drivers/devfreq/exynos/exynos5_bus.c
··· 163 163 164 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 167 static struct devfreq_dev_profile exynos5_devfreq_int_profile = { 176 168 .initial_freq = 160000, 177 169 .polling_ms = 100, 178 170 .target = exynos5_busfreq_int_target, 179 171 .get_dev_status = exynos5_int_get_dev_status, 180 - .exit = exynos5_int_exit, 181 172 }; 182 173 183 174 static int exynos5250_init_int_tables(struct busfreq_data_int *data) ··· 334 343 335 344 busfreq_mon_reset(ppmu_data); 336 345 337 - data->devfreq = devfreq_add_device(dev, &exynos5_devfreq_int_profile, 346 + data->devfreq = devm_devfreq_add_device(dev, &exynos5_devfreq_int_profile, 338 347 "simple_ondemand", NULL); 348 + if (IS_ERR(data->devfreq)) 349 + return PTR_ERR(data->devfreq); 339 350 340 - if (IS_ERR(data->devfreq)) { 341 - err = PTR_ERR(data->devfreq); 342 - goto err_devfreq_add; 351 + err = devm_devfreq_register_opp_notifier(dev, data->devfreq); 352 + if (err < 0) { 353 + dev_err(dev, "Failed to register opp notifier\n"); 354 + return err; 343 355 } 344 - 345 - devfreq_register_opp_notifier(dev, data->devfreq); 346 356 347 357 err = register_pm_notifier(&data->pm_notifier); 348 358 if (err) { 349 359 dev_err(dev, "Failed to setup pm notifier\n"); 350 - goto err_devfreq_add; 360 + return err; 351 361 } 352 362 353 363 /* TODO: Add a new QOS class for int/mif bus */ 354 364 pm_qos_add_request(&data->int_req, PM_QOS_NETWORK_THROUGHPUT, -1); 355 365 356 366 return 0; 357 - 358 - err_devfreq_add: 359 - devfreq_remove_device(data->devfreq); 360 - return err; 361 367 } 362 368 363 369 static int exynos5_busfreq_int_remove(struct platform_device *pdev) ··· 363 375 364 376 pm_qos_remove_request(&data->int_req); 365 377 unregister_pm_notifier(&data->pm_notifier); 366 - devfreq_remove_device(data->devfreq); 367 378 368 379 return 0; 369 380 }