From patchwork Wed Jan 27 06:32:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gautham R Shenoy X-Patchwork-Id: 8130691 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E524B9F818 for ; Wed, 27 Jan 2016 06:33:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0E272202F8 for ; Wed, 27 Jan 2016 06:33:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2B56420295 for ; Wed, 27 Jan 2016 06:33:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753678AbcA0GdA (ORCPT ); Wed, 27 Jan 2016 01:33:00 -0500 Received: from e33.co.us.ibm.com ([32.97.110.151]:42607 "EHLO e33.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753813AbcA0Gc7 (ORCPT ); Wed, 27 Jan 2016 01:32:59 -0500 Received: from localhost by e33.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 26 Jan 2016 23:32:58 -0700 Received: from d03dlp01.boulder.ibm.com (9.17.202.177) by e33.co.us.ibm.com (192.168.1.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 26 Jan 2016 23:32:49 -0700 X-IBM-Helo: d03dlp01.boulder.ibm.com X-IBM-MailFrom: ego@linux.vnet.ibm.com X-IBM-RcptTo: linux-kernel@vger.kernel.org;linux-pm@vger.kernel.org Received: from b03cxnp07029.gho.boulder.ibm.com (b03cxnp07029.gho.boulder.ibm.com [9.17.130.16]) by d03dlp01.boulder.ibm.com (Postfix) with ESMTP id 5EF561FF004B; Tue, 26 Jan 2016 23:20:59 -0700 (MST) Received: from d03av04.boulder.ibm.com (d03av04.boulder.ibm.com [9.17.195.170]) by b03cxnp07029.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u0R6Wnrv30867600; Tue, 26 Jan 2016 23:32:49 -0700 Received: from d03av04.boulder.ibm.com (loopback [127.0.0.1]) by d03av04.boulder.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u0R6WmoH032005; Tue, 26 Jan 2016 23:32:48 -0700 Received: from sofia.in.ibm.com (sofia.in.ibm.com [9.124.35.208]) by d03av04.boulder.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id u0R6WlaM031941; Tue, 26 Jan 2016 23:32:48 -0700 Received: from sofia.in.ibm.com (localhost.localdomain [127.0.0.1]) by sofia.in.ibm.com (Postfix) with ESMTP id 4C80BA1DDA; Wed, 27 Jan 2016 12:02:46 +0530 (IST) Received: (from ego@localhost) by sofia.in.ibm.com (8.14.8/8.14.8/Submit) id u0R6WhmO021906; Wed, 27 Jan 2016 12:02:43 +0530 From: "Gautham R. Shenoy" To: Viresh Kumar , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, "Rafael J. Wysocki" Cc: Shilpasri G Bhat , "Juri Lelli , "Gautham R. Shenoy" Subject: [PATCH RESEND] cpufreq: Use list_is_last() to check last entry of the policy list Date: Wed, 27 Jan 2016 12:02:26 +0530 Message-Id: <1453876346-21869-1-git-send-email-ego@linux.vnet.ibm.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1453715167-26165-1-git-send-email-ego@linux.vnet.ibm.com> References: <1453715167-26165-1-git-send-email-ego@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16012706-0009-0000-0000-000011C8F6CA Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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. Cc: Viresh Kumar Signed-off-by: Gautham R. Shenoy Acked-by: Viresh Kumar --- The earlier version one was based on an Juri's experimental branch. I have based this one on linux-pm.git linux-next branch. drivers/cpufreq/cpufreq.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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;