From patchwork Mon Apr 21 23:02:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stratos Karafotis X-Patchwork-Id: 4027561 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.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 73F039F387 for ; Mon, 21 Apr 2014 23:03:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A3C8C201BA for ; Mon, 21 Apr 2014 23:03:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CF94520357 for ; Mon, 21 Apr 2014 23:03:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755330AbaDUXCn (ORCPT ); Mon, 21 Apr 2014 19:02:43 -0400 Received: from sema.semaphore.gr ([78.46.194.137]:48667 "EHLO sema.semaphore.gr" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1754743AbaDUXCk (ORCPT ); Mon, 21 Apr 2014 19:02:40 -0400 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 DFD7E82733; Tue, 22 Apr 2014 01:02:34 +0200 (CEST) Message-ID: <5355A38D.8090503@semaphore.gr> Date: Tue, 22 Apr 2014 02:02:37 +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: Simon Horman , Magnus Damm CC: "Rafael J. Wysocki" , Viresh Kumar , linux-sh@vger.kernel.org, LKML , "linux-pm@vger.kernel.org" Subject: [PATCH v4 8/8] sh: clk: Use cpufreq_for_each_valid_entry macro for iteration References: <534DB238.5030201@semaphore.gr> In-Reply-To: <534DB238.5030201@semaphore.gr> X-Forwarded-Message-Id: <534DB238.5030201@semaphore.gr> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-7.5 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 The cpufreq core now supports the cpufreq_for_each_valid_entry macro helper for iteration over the cpufreq_frequency_table, so use it. It should have no functional changes. Signed-off-by: Stratos Karafotis --- drivers/sh/clk/core.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/drivers/sh/clk/core.c b/drivers/sh/clk/core.c index 7472785..be56b22 100644 --- a/drivers/sh/clk/core.c +++ b/drivers/sh/clk/core.c @@ -196,17 +196,11 @@ int clk_rate_table_find(struct clk *clk, struct cpufreq_frequency_table *freq_table, unsigned long rate) { - int i; - - for (i = 0; freq_table[i].frequency != CPUFREQ_TABLE_END; i++) { - unsigned long freq = freq_table[i].frequency; + struct cpufreq_frequency_table *pos; - if (freq == CPUFREQ_ENTRY_INVALID) - continue; - - if (freq == rate) - return i; - } + cpufreq_for_each_valid_entry(pos, freq_table) + if (pos->frequency == rate) + return pos - freq_table; return -ENOENT; } @@ -575,11 +569,7 @@ long clk_round_parent(struct clk *clk, unsigned long target, return abs(target - *best_freq); } - for (freq = parent->freq_table; freq->frequency != CPUFREQ_TABLE_END; - freq++) { - if (freq->frequency == CPUFREQ_ENTRY_INVALID) - continue; - + cpufreq_for_each_valid_entry(freq, parent->freq_table) { if (unlikely(freq->frequency / target <= div_min - 1)) { unsigned long freq_max;