From patchwork Mon Jan 25 09:46:07 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: 8105101 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C3C13BEEE5 for ; Mon, 25 Jan 2016 09:46:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 00A2F202E5 for ; Mon, 25 Jan 2016 09:46:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1F784202AE for ; Mon, 25 Jan 2016 09:46:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755253AbcAYJqa (ORCPT ); Mon, 25 Jan 2016 04:46:30 -0500 Received: from e38.co.us.ibm.com ([32.97.110.159]:51211 "EHLO e38.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756057AbcAYJq2 (ORCPT ); Mon, 25 Jan 2016 04:46:28 -0500 Received: from localhost by e38.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 25 Jan 2016 02:46:26 -0700 Received: from d03dlp02.boulder.ibm.com (9.17.202.178) by e38.co.us.ibm.com (192.168.1.138) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 25 Jan 2016 02:46:22 -0700 X-IBM-Helo: d03dlp02.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 b01cxnp23032.gho.pok.ibm.com (b01cxnp23032.gho.pok.ibm.com [9.57.198.27]) by d03dlp02.boulder.ibm.com (Postfix) with ESMTP id 4BEB23E4003E; Mon, 25 Jan 2016 02:46:22 -0700 (MST) Received: from d01av05.pok.ibm.com (d01av05.pok.ibm.com [9.56.224.195]) by b01cxnp23032.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u0P9kLq632243850; Mon, 25 Jan 2016 09:46:21 GMT Received: from d01av05.pok.ibm.com (localhost [127.0.0.1]) by d01av05.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u0P9fSrI022931; Mon, 25 Jan 2016 04:41:29 -0500 Received: from sofia.in.ibm.com (sofia.in.ibm.com [9.124.35.176]) by d01av05.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id u0P9fRJO022922; Mon, 25 Jan 2016 04:41:28 -0500 Received: from sofia.in.ibm.com (localhost.localdomain [127.0.0.1]) by sofia.in.ibm.com (Postfix) with ESMTP id 6F4BBA1C29; Mon, 25 Jan 2016 15:16:16 +0530 (IST) Received: (from ego@localhost) by sofia.in.ibm.com (8.14.8/8.14.8/Submit) id u0P9kDO0026202; Mon, 25 Jan 2016 15:16:13 +0530 From: "Gautham R. Shenoy" To: "Rafael J. Wysocki" , Viresh Kumar , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Shilpasri G Bhat , Juri Lelli , "Gautham R. Shenoy" Subject: [PATCH] cpufreq: Use list_is_last() to check last entry of the policy list Date: Mon, 25 Jan 2016 15:16:07 +0530 Message-Id: <1453715167-26165-1-git-send-email-ego@linux.vnet.ibm.com> X-Mailer: git-send-email 1.9.3 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16012509-0029-0000-0000-00000FE8C875 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 --- 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 78b1e2f..b3059a3 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -67,11 +67,11 @@ static struct cpufreq_policy *next_policy(struct cpufreq_policy *policy, { lockdep_assert_held(&cpufreq_driver_lock); 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;