From patchwork Mon Apr 21 15:35:52 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stratos Karafotis X-Patchwork-Id: 4040911 Return-Path: X-Original-To: patchwork-davinci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D62629F387 for ; Wed, 23 Apr 2014 13:10:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 24828201F7 for ; Wed, 23 Apr 2014 13:10:24 +0000 (UTC) Received: from bear.ext.ti.com (bear.ext.ti.com [192.94.94.41]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 39E48201EC for ; Wed, 23 Apr 2014 13:10:23 +0000 (UTC) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id s3ND9KCj023144; Wed, 23 Apr 2014 08:09:20 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id s3ND9CxN000679; Wed, 23 Apr 2014 08:09:20 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.174.1; Wed, 23 Apr 2014 08:09:14 -0500 Received: from linux.omap.com (dlelxs01.itg.ti.com [157.170.227.31]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id s3ND9Dtk018358; Wed, 23 Apr 2014 08:09:13 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 61E2C8062F; Wed, 23 Apr 2014 08:09:12 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflxv17.itg.ti.com (dflxv17.itg.ti.com [128.247.5.93]) by linux.omap.com (Postfix) with ESMTP id E28FC80626 for ; Mon, 21 Apr 2014 10:36:00 -0500 (CDT) Received: from red.ext.ti.com (red.ext.ti.com [192.94.93.37]) by dflxv17.itg.ti.com (8.14.3/8.13.8) with ESMTP id s3LFa0eK000976 for ; Mon, 21 Apr 2014 10:36:00 -0500 Received: from mail6.bemta12.messagelabs.com (mail6.bemta12.messagelabs.com [216.82.250.247]) by red.ext.ti.com (8.13.7/8.13.7) with ESMTP id s3LFZwSn003680 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 21 Apr 2014 10:36:00 -0500 Received: from [216.82.250.83:51541] by server-5.bemta-12.messagelabs.com id 0C/61-18132-EDA35535; Mon, 21 Apr 2014 15:35:58 +0000 X-Env-Sender: stratosk@semaphore.gr X-Msg-Ref: server-7.tower-120.messagelabs.com!1398094556!7755048!1 X-Originating-IP: [78.46.194.137] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 6.11.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 14402 invoked from network); 21 Apr 2014 15:35:57 -0000 Received: from sema.semaphore.gr (HELO sema.semaphore.gr) (78.46.194.137) by server-7.tower-120.messagelabs.com with DHE-RSA-AES256-SHA encrypted SMTP; 21 Apr 2014 15:35:57 -0000 Received: from albert.lan (ppp079166063152.access.hol.gr [79.166.63.152]) (using TLSv1 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: stratosk) by sema.semaphore.gr (Postfix) with ESMTPSA id 6CD978272B; Mon, 21 Apr 2014 17:35:50 +0200 (CEST) Message-ID: <53553AD8.5080901@semaphore.gr> Date: Mon, 21 Apr 2014 18:35:52 +0300 From: Stratos Karafotis User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: Sekhar Nori , Kevin Hilman , Russell King Subject: [PATCH v3 3/8] ARM: davinci: da850: Use cpufreq_for_each_entry macro for iteration X-Mailman-Approved-At: Wed, 23 Apr 2014 08:09:09 -0500 CC: Viresh Kumar , , "Rafael J. Wysocki" , LKML , "linux-arm-kernel@lists.infradead.org" X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: Errors-To: davinci-linux-open-source-bounces@linux.davincidsp.com X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 The cpufreq core now supports the cpufreq_for_each_entry macro helper for iteration over the cpufreq_frequency_table, so use it. It should have no functional changes. Signed-off-by: Stratos Karafotis --- Changes v2 -> v3 - Added 'ARM' prefix in the subject as Sekhar Nori suggested. arch/arm/mach-davinci/da850.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c index 85399c9..45ce065 100644 --- a/arch/arm/mach-davinci/da850.c +++ b/arch/arm/mach-davinci/da850.c @@ -1092,20 +1092,21 @@ int da850_register_cpufreq(char *async_clk) static int da850_round_armrate(struct clk *clk, unsigned long rate) { - int i, ret = 0, diff; + int ret = 0, diff; unsigned int best = (unsigned int) -1; struct cpufreq_frequency_table *table = cpufreq_info.freq_table; + struct cpufreq_frequency_table *pos; rate /= 1000; /* convert to kHz */ - for (i = 0; table[i].frequency != CPUFREQ_TABLE_END; i++) { - diff = table[i].frequency - rate; + cpufreq_for_each_entry(pos, table) { + diff = pos->frequency - rate; if (diff < 0) diff = -diff; if (diff < best) { best = diff; - ret = table[i].frequency; + ret = pos->frequency; } }