From: Gautham R Shenoy Date: Wed, 27 Jan 2016 06:32:26 +0000 (+0530) Subject: cpufreq: Use list_is_last() to check last entry of the policy list X-Git-Tag: v4.14-rc1~3904^2^3~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2dadfd7564ef28391609c7ef896fd85218799012;p=platform%2Fkernel%2Flinux-rpi.git cpufreq: Use list_is_last() to check last entry of the policy list Currently next_policy() explicitly checks if a policy is the last policy in the cpufreq_policy_list. Use the standard list_is_last primitive instead. Signed-off-by: Gautham R. Shenoy Acked-by: Viresh Kumar Signed-off-by: Rafael J. Wysocki --- diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index c35e7da..e979ec7 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -48,11 +48,11 @@ static struct cpufreq_policy *next_policy(struct cpufreq_policy *policy, bool active) { do { - policy = list_next_entry(policy, policy_list); - /* No more policies in the list */ - if (&policy->policy_list == &cpufreq_policy_list) + if (list_is_last(&policy->policy_list, &cpufreq_policy_list)) return NULL; + + policy = list_next_entry(policy, policy_list); } while (!suitable_policy(policy, active)); return policy;