Skip to content

Commit

Permalink
cpufreq: mt8173: use list_for_each_entry*()
Browse files Browse the repository at this point in the history
Use list_for_each_entry*() instead of list_for_each*() to simplify
the code.

Signed-off-by: Geliang Tang <[email protected]>
Acked-by: Viresh Kumar <[email protected]>
Signed-off-by: Rafael J. Wysocki <[email protected]>
  • Loading branch information
geliangtang authored and rafaeljw committed Apr 8, 2016
1 parent 22590ef commit d2499d0
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions drivers/cpufreq/mt8173-cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,8 @@ static LIST_HEAD(dvfs_info_list);
static struct mtk_cpu_dvfs_info *mtk_cpu_dvfs_info_lookup(int cpu)
{
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))
return info;
}
Expand Down Expand Up @@ -524,8 +521,7 @@ static struct cpufreq_driver mt8173_cpufreq_driver = {

static int mt8173_cpufreq_probe(struct platform_device *pdev)
{
struct mtk_cpu_dvfs_info *info;
struct list_head *list, *tmp;
struct mtk_cpu_dvfs_info *info, *tmp;
int cpu, ret;

for_each_possible_cpu(cpu) {
Expand Down Expand Up @@ -559,11 +555,9 @@ static int mt8173_cpufreq_probe(struct platform_device *pdev)
return 0;

release_dvfs_info_list:
list_for_each_safe(list, tmp, &dvfs_info_list) {
info = list_entry(list, struct mtk_cpu_dvfs_info, list_head);

list_for_each_entry_safe(info, tmp, &dvfs_info_list, list_head) {
mtk_cpu_dvfs_info_release(info);
list_del(list);
list_del(&info->list_head);
}

return ret;
Expand Down

0 comments on commit d2499d0

Please sign in to comment.