Skip to content

Commit

Permalink
PM / devfreq: exynos5: Use devm_devfreq_* function using device resou…
Browse files Browse the repository at this point in the history
…rce 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>
  • Loading branch information
chanwoochoi authored and myungjoo committed May 24, 2014
1 parent c1b13d4 commit 2456963
Showing 1 changed file with 8 additions and 21 deletions.
29 changes: 8 additions & 21 deletions drivers/devfreq/exynos/exynos5_bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,21 +163,12 @@ static int exynos5_int_get_dev_status(struct device *dev,

return 0;
}
static void exynos5_int_exit(struct device *dev)
{
struct platform_device *pdev = container_of(dev, struct platform_device,
dev);
struct busfreq_data_int *data = platform_get_drvdata(pdev);

devfreq_unregister_opp_notifier(dev, data->devfreq);
}

static struct devfreq_dev_profile exynos5_devfreq_int_profile = {
.initial_freq = 160000,
.polling_ms = 100,
.target = exynos5_busfreq_int_target,
.get_dev_status = exynos5_int_get_dev_status,
.exit = exynos5_int_exit,
};

static int exynos5250_init_int_tables(struct busfreq_data_int *data)
Expand Down Expand Up @@ -343,30 +334,27 @@ static int exynos5_busfreq_int_probe(struct platform_device *pdev)

busfreq_mon_reset(ppmu_data);

data->devfreq = devfreq_add_device(dev, &exynos5_devfreq_int_profile,
data->devfreq = devm_devfreq_add_device(dev, &exynos5_devfreq_int_profile,
"simple_ondemand", NULL);
if (IS_ERR(data->devfreq))
return PTR_ERR(data->devfreq);

if (IS_ERR(data->devfreq)) {
err = PTR_ERR(data->devfreq);
goto err_devfreq_add;
err = devm_devfreq_register_opp_notifier(dev, data->devfreq);
if (err < 0) {
dev_err(dev, "Failed to register opp notifier\n");
return err;
}

devfreq_register_opp_notifier(dev, data->devfreq);

err = register_pm_notifier(&data->pm_notifier);
if (err) {
dev_err(dev, "Failed to setup pm notifier\n");
goto err_devfreq_add;
return err;
}

/* TODO: Add a new QOS class for int/mif bus */
pm_qos_add_request(&data->int_req, PM_QOS_NETWORK_THROUGHPUT, -1);

return 0;

err_devfreq_add:
devfreq_remove_device(data->devfreq);
return err;
}

static int exynos5_busfreq_int_remove(struct platform_device *pdev)
Expand All @@ -375,7 +363,6 @@ static int exynos5_busfreq_int_remove(struct platform_device *pdev)

pm_qos_remove_request(&data->int_req);
unregister_pm_notifier(&data->pm_notifier);
devfreq_remove_device(data->devfreq);

return 0;
}
Expand Down

0 comments on commit 2456963

Please sign in to comment.