diff options
author | Sachin Kamat <sachin.kamat@linaro.org> | 2013-06-05 02:13:01 -0400 |
---|---|---|
committer | MyungJoo Ham <myungjoo.ham@samsung.com> | 2013-10-28 07:12:31 -0400 |
commit | 02844f747e72186f7d3f34d6f78de90cb8eb2139 (patch) | |
tree | 75d26230186b65a20da5c448b62d6aebfca9b2cf /drivers/devfreq | |
parent | 81c12a0a79575a22b64f050ea2e626f12d124841 (diff) |
PM / devfreq: Use devm_* APIs in exynos5_bus.c
devm_* APIs are device managed and make clean up and exit codes
simpler.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Diffstat (limited to 'drivers/devfreq')
-rw-r--r-- | drivers/devfreq/exynos/exynos5_bus.c | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/drivers/devfreq/exynos/exynos5_bus.c b/drivers/devfreq/exynos/exynos5_bus.c index 9a82419c29eb..102d1f0f261f 100644 --- a/drivers/devfreq/exynos/exynos5_bus.c +++ b/drivers/devfreq/exynos/exynos5_bus.c | |||
@@ -351,20 +351,18 @@ static int exynos5_busfreq_int_probe(struct platform_device *pdev) | |||
351 | 351 | ||
352 | err = exynos5250_init_int_tables(data); | 352 | err = exynos5250_init_int_tables(data); |
353 | if (err) | 353 | if (err) |
354 | goto err_regulator; | 354 | return err; |
355 | 355 | ||
356 | data->vdd_int = regulator_get(dev, "vdd_int"); | 356 | data->vdd_int = devm_regulator_get(dev, "vdd_int"); |
357 | if (IS_ERR(data->vdd_int)) { | 357 | if (IS_ERR(data->vdd_int)) { |
358 | dev_err(dev, "Cannot get the regulator \"vdd_int\"\n"); | 358 | dev_err(dev, "Cannot get the regulator \"vdd_int\"\n"); |
359 | err = PTR_ERR(data->vdd_int); | 359 | return PTR_ERR(data->vdd_int); |
360 | goto err_regulator; | ||
361 | } | 360 | } |
362 | 361 | ||
363 | data->int_clk = clk_get(dev, "int_clk"); | 362 | data->int_clk = devm_clk_get(dev, "int_clk"); |
364 | if (IS_ERR(data->int_clk)) { | 363 | if (IS_ERR(data->int_clk)) { |
365 | dev_err(dev, "Cannot get clock \"int_clk\"\n"); | 364 | dev_err(dev, "Cannot get clock \"int_clk\"\n"); |
366 | err = PTR_ERR(data->int_clk); | 365 | return PTR_ERR(data->int_clk); |
367 | goto err_clock; | ||
368 | } | 366 | } |
369 | 367 | ||
370 | rcu_read_lock(); | 368 | rcu_read_lock(); |
@@ -374,8 +372,7 @@ static int exynos5_busfreq_int_probe(struct platform_device *pdev) | |||
374 | rcu_read_unlock(); | 372 | rcu_read_unlock(); |
375 | dev_err(dev, "Invalid initial frequency %lu kHz.\n", | 373 | dev_err(dev, "Invalid initial frequency %lu kHz.\n", |
376 | exynos5_devfreq_int_profile.initial_freq); | 374 | exynos5_devfreq_int_profile.initial_freq); |
377 | err = PTR_ERR(opp); | 375 | return PTR_ERR(opp); |
378 | goto err_opp_add; | ||
379 | } | 376 | } |
380 | initial_freq = opp_get_freq(opp); | 377 | initial_freq = opp_get_freq(opp); |
381 | initial_volt = opp_get_voltage(opp); | 378 | initial_volt = opp_get_voltage(opp); |
@@ -385,12 +382,12 @@ static int exynos5_busfreq_int_probe(struct platform_device *pdev) | |||
385 | err = clk_set_rate(data->int_clk, initial_freq * 1000); | 382 | err = clk_set_rate(data->int_clk, initial_freq * 1000); |
386 | if (err) { | 383 | if (err) { |
387 | dev_err(dev, "Failed to set initial frequency\n"); | 384 | dev_err(dev, "Failed to set initial frequency\n"); |
388 | goto err_opp_add; | 385 | return err; |
389 | } | 386 | } |
390 | 387 | ||
391 | err = exynos5_int_setvolt(data, initial_volt); | 388 | err = exynos5_int_setvolt(data, initial_volt); |
392 | if (err) | 389 | if (err) |
393 | goto err_opp_add; | 390 | return err; |
394 | 391 | ||
395 | platform_set_drvdata(pdev, data); | 392 | platform_set_drvdata(pdev, data); |
396 | 393 | ||
@@ -419,11 +416,6 @@ static int exynos5_busfreq_int_probe(struct platform_device *pdev) | |||
419 | 416 | ||
420 | err_devfreq_add: | 417 | err_devfreq_add: |
421 | devfreq_remove_device(data->devfreq); | 418 | devfreq_remove_device(data->devfreq); |
422 | err_opp_add: | ||
423 | clk_put(data->int_clk); | ||
424 | err_clock: | ||
425 | regulator_put(data->vdd_int); | ||
426 | err_regulator: | ||
427 | return err; | 419 | return err; |
428 | } | 420 | } |
429 | 421 | ||
@@ -434,8 +426,6 @@ static int exynos5_busfreq_int_remove(struct platform_device *pdev) | |||
434 | pm_qos_remove_request(&data->int_req); | 426 | pm_qos_remove_request(&data->int_req); |
435 | unregister_pm_notifier(&data->pm_notifier); | 427 | unregister_pm_notifier(&data->pm_notifier); |
436 | devfreq_remove_device(data->devfreq); | 428 | devfreq_remove_device(data->devfreq); |
437 | regulator_put(data->vdd_int); | ||
438 | clk_put(data->int_clk); | ||
439 | 429 | ||
440 | return 0; | 430 | return 0; |
441 | } | 431 | } |