Commit d2499d05 authored by Geliang Tang's avatar Geliang Tang Committed by Rafael J. Wysocki

cpufreq: mt8173: use list_for_each_entry*()

Use list_for_each_entry*() instead of list_for_each*() to simplify
the code.
Signed-off-by: default avatarGeliang Tang <geliangtang@163.com>
Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 22590efb
...@@ -59,11 +59,8 @@ static LIST_HEAD(dvfs_info_list); ...@@ -59,11 +59,8 @@ static LIST_HEAD(dvfs_info_list);
static struct mtk_cpu_dvfs_info *mtk_cpu_dvfs_info_lookup(int cpu) static struct mtk_cpu_dvfs_info *mtk_cpu_dvfs_info_lookup(int cpu)
{ {
struct mtk_cpu_dvfs_info *info; struct mtk_cpu_dvfs_info *info;
struct list_head *list;
list_for_each(list, &dvfs_info_list) {
info = list_entry(list, struct mtk_cpu_dvfs_info, list_head);
list_for_each_entry(info, &dvfs_info_list, list_head) {
if (cpumask_test_cpu(cpu, &info->cpus)) if (cpumask_test_cpu(cpu, &info->cpus))
return info; return info;
} }
...@@ -524,8 +521,7 @@ static struct cpufreq_driver mt8173_cpufreq_driver = { ...@@ -524,8 +521,7 @@ static struct cpufreq_driver mt8173_cpufreq_driver = {
static int mt8173_cpufreq_probe(struct platform_device *pdev) static int mt8173_cpufreq_probe(struct platform_device *pdev)
{ {
struct mtk_cpu_dvfs_info *info; struct mtk_cpu_dvfs_info *info, *tmp;
struct list_head *list, *tmp;
int cpu, ret; int cpu, ret;
for_each_possible_cpu(cpu) { for_each_possible_cpu(cpu) {
...@@ -559,11 +555,9 @@ static int mt8173_cpufreq_probe(struct platform_device *pdev) ...@@ -559,11 +555,9 @@ static int mt8173_cpufreq_probe(struct platform_device *pdev)
return 0; return 0;
release_dvfs_info_list: release_dvfs_info_list:
list_for_each_safe(list, tmp, &dvfs_info_list) { list_for_each_entry_safe(info, tmp, &dvfs_info_list, list_head) {
info = list_entry(list, struct mtk_cpu_dvfs_info, list_head);
mtk_cpu_dvfs_info_release(info); mtk_cpu_dvfs_info_release(info);
list_del(list); list_del(&info->list_head);
} }
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment