From patchwork Tue Aug 13 13:32:34 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 2843686 Return-Path: X-Original-To: patchwork-linux-arm@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 16A3F9F271 for ; Tue, 13 Aug 2013 13:39:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DE17520506 for ; Tue, 13 Aug 2013 13:38:59 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E259720507 for ; Tue, 13 Aug 2013 13:38:50 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V9Enj-0000fJ-BB; Tue, 13 Aug 2013 13:38:20 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1V9EnT-0008JP-IO; Tue, 13 Aug 2013 13:38:03 +0000 Received: from mail-pd0-f172.google.com ([209.85.192.172]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V9Elb-0007yS-Rn for linux-arm-kernel@lists.infradead.org; Tue, 13 Aug 2013 13:36:09 +0000 Received: by mail-pd0-f172.google.com with SMTP id z10so4890226pdj.31 for ; Tue, 13 Aug 2013 06:35:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=skLj+73iZ8gU0Ig6bA5A0zYjEmtBHW7vkD8wzg17nqw=; b=nsMfaeJHO3QXelpEN70r2bF7i5mipgI7O7ewX2efNSQVJb06vDf3j1dTGOkcc9Wsny G/M+pZYnGtSCPG94wqmy2j/QTZxJIBhzIP9wHxJkjNnwm5ana0qwnuaqJ5Qco02M4idi ry+Cq8K0E/BKKDODCZqTw8+AYmp9eXprvkfC5TQfgdGC0aoJGCg0GM2S37mpchm7oNag gsMRBXK+BZXibvcYC+8YXswK8Za55BkJyQl+PmI+WD89HATV1It3QBa0/acpZuN1A/xJ NLelCd42K68TQvSA9WcLCzP81DGjfJldRxm3yE/DaT7Q7q+aEOloEqUYqk9XN/YIVXyv zJUw== X-Gm-Message-State: ALoCoQkciyPCxwcyTcxKXlVDitx0vtD/vN/TXMlOZG0blMk8aAPk69WLLFBg36z901wC1f/VLD51 X-Received: by 10.66.37.43 with SMTP id v11mr4637520paj.108.1376400946569; Tue, 13 Aug 2013 06:35:46 -0700 (PDT) Received: from localhost ([122.172.193.46]) by mx.google.com with ESMTPSA id a5sm44025926pbw.4.2013.08.13.06.35.42 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 13 Aug 2013 06:35:45 -0700 (PDT) From: Viresh Kumar To: rjw@sisk.pl Subject: [PATCH V2 21/35] cpufreq: p4: Covert to light weight ->target_index() routine Date: Tue, 13 Aug 2013 19:02:34 +0530 Message-Id: X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130813_093608_045683_62D0FDC3 X-CRM114-Status: GOOD ( 11.21 ) X-Spam-Score: -1.9 (-) Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, Viresh Kumar , patches@linaro.org, linux-kernel@vger.kernel.org, cpufreq@vger.kernel.org, "David S. Miller" , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 This patch converts existing .target() to newly defined light weight .target_index() routine for this driver. CPUFreq core will call cpufreq_frequency_table_target() before calling this routine and will pass index to it. Cc: David S. Miller Signed-off-by: Viresh Kumar --- drivers/cpufreq/p4-clockmod.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/drivers/cpufreq/p4-clockmod.c b/drivers/cpufreq/p4-clockmod.c index 4fe6d4c..5a6263e 100644 --- a/drivers/cpufreq/p4-clockmod.c +++ b/drivers/cpufreq/p4-clockmod.c @@ -105,23 +105,13 @@ static struct cpufreq_frequency_table p4clockmod_table[] = { }; -static int cpufreq_p4_target(struct cpufreq_policy *policy, - unsigned int target_freq, - unsigned int relation) +static int cpufreq_p4_target(struct cpufreq_policy *policy, unsigned int index) { - unsigned int newstate = DC_RESV; struct cpufreq_freqs freqs; int i; - if (cpufreq_frequency_table_target(policy, &p4clockmod_table[0], - target_freq, relation, &newstate)) - return -EINVAL; - freqs.old = cpufreq_p4_get(policy->cpu); - freqs.new = stock_freq * p4clockmod_table[newstate].driver_data / 8; - - if (freqs.new == freqs.old) - return 0; + freqs.new = stock_freq * p4clockmod_table[index].driver_data / 8; /* notifiers */ cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); @@ -131,7 +121,7 @@ static int cpufreq_p4_target(struct cpufreq_policy *policy, * Developer's Manual, Volume 3 */ for_each_cpu(i, policy->cpus) - cpufreq_p4_setdc(i, p4clockmod_table[newstate].driver_data); + cpufreq_p4_setdc(i, p4clockmod_table[index].driver_data); /* notifiers */ cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); @@ -256,7 +246,7 @@ static unsigned int cpufreq_p4_get(unsigned int cpu) static struct cpufreq_driver p4clockmod_driver = { .verify = cpufreq_generic_frequency_table_verify, - .target = cpufreq_p4_target, + .target_index = cpufreq_p4_target, .init = cpufreq_p4_cpu_init, .exit = cpufreq_generic_exit, .get = cpufreq_p4_get,