aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeliang Tang <geliangtang@163.com>2016-04-04 22:38:06 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2016-04-08 19:27:54 -0400
commitd2499d05f0f286a754c26e2bda62210d6a65a774 (patch)
tree8c359527e71709cf98ca1028451f9241758236d5
parent22590efb98ae0c84f798a9938c0b6d97bc89adf5 (diff)
cpufreq: mt8173: use list_for_each_entry*()
Use list_for_each_entry*() instead of list_for_each*() to simplify the code. Signed-off-by: Geliang Tang <geliangtang@163.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/cpufreq/mt8173-cpufreq.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/drivers/cpufreq/mt8173-cpufreq.c b/drivers/cpufreq/mt8173-cpufreq.c
index 2058e6d292ce..6f602c7a71bd 100644
--- a/drivers/cpufreq/mt8173-cpufreq.c
+++ b/drivers/cpufreq/mt8173-cpufreq.c
@@ -59,11 +59,8 @@ static LIST_HEAD(dvfs_info_list);
59static struct mtk_cpu_dvfs_info *mtk_cpu_dvfs_info_lookup(int cpu) 59static struct mtk_cpu_dvfs_info *mtk_cpu_dvfs_info_lookup(int cpu)
60{ 60{
61 struct mtk_cpu_dvfs_info *info; 61 struct mtk_cpu_dvfs_info *info;
62 struct list_head *list;
63
64 list_for_each(list, &dvfs_info_list) {
65 info = list_entry(list, struct mtk_cpu_dvfs_info, list_head);
66 62
63 list_for_each_entry(info, &dvfs_info_list, list_head) {
67 if (cpumask_test_cpu(cpu, &info->cpus)) 64 if (cpumask_test_cpu(cpu, &info->cpus))
68 return info; 65 return info;
69 } 66 }
@@ -524,8 +521,7 @@ static struct cpufreq_driver mt8173_cpufreq_driver = {
524 521
525static int mt8173_cpufreq_probe(struct platform_device *pdev) 522static int mt8173_cpufreq_probe(struct platform_device *pdev)
526{ 523{
527 struct mtk_cpu_dvfs_info *info; 524 struct mtk_cpu_dvfs_info *info, *tmp;
528 struct list_head *list, *tmp;
529 int cpu, ret; 525 int cpu, ret;
530 526
531 for_each_possible_cpu(cpu) { 527 for_each_possible_cpu(cpu) {
@@ -559,11 +555,9 @@ static int mt8173_cpufreq_probe(struct platform_device *pdev)
559 return 0; 555 return 0;
560 556
561release_dvfs_info_list: 557release_dvfs_info_list:
562 list_for_each_safe(list, tmp, &dvfs_info_list) { 558 list_for_each_entry_safe(info, tmp, &dvfs_info_list, list_head) {
563 info = list_entry(list, struct mtk_cpu_dvfs_info, list_head);
564
565 mtk_cpu_dvfs_info_release(info); 559 mtk_cpu_dvfs_info_release(info);
566 list_del(list); 560 list_del(&info->list_head);
567 } 561 }
568 562
569 return ret; 563 return ret;