From patchwork Tue Aug 13 13:32:16 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 2843724 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 9B13EBF546 for ; Tue, 13 Aug 2013 14:13:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 415492051A for ; Tue, 13 Aug 2013 14:13:57 +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 6E88620514 for ; Tue, 13 Aug 2013 14:13:52 +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 1V9Ejp-0005xN-On; Tue, 13 Aug 2013 13:34:18 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1V9EjW-0007g6-CN; Tue, 13 Aug 2013 13:33:58 +0000 Received: from mail-pa0-f50.google.com ([209.85.220.50]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V9EjQ-0007cI-31 for linux-arm-kernel@lists.infradead.org; Tue, 13 Aug 2013 13:33:54 +0000 Received: by mail-pa0-f50.google.com with SMTP id fb10so8927729pad.37 for ; Tue, 13 Aug 2013 06:33:30 -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=xn/Q1c7UhFQxrZFW2n3u+Xos0MPHSP6Ya5yM9Ct9UTo=; b=LnJve2spbagVJIxkCdQ81rEHIV8+O42GkgG06KDz6ZMdEKijbTYGjM6dBA+UjUke7d QpyFLv1ZHLZGqsi/UOkQUKGjX6/YBRBieM2LH8dkKZseDIcuNIj68VJJQupPNEUqMHBG XA598rre7KBwEgasaZyTtRBzdF3TtgeGNjCKC5WO/cWTOP3MZsyvM+I4+n82etAHfYqf BVcgk1d4q//Cy201+huWIErzVNconJGwJ+xbG9sB76HQn5X82Xb9QFAiWDAVhdP6p6/5 E3wpfJJ38RaABtNl+rPrkyWicjHrQk/PYddU85A6LLZg9e/5X2tVt2b7DBWK8/Kr35Lv lrFA== X-Gm-Message-State: ALoCoQkd9SE8xzewpSjN79iAaUhYFjAv7QjyYvSTNjbMyeQ/tIkh4olMYHykoc1xGtSzdG9WAix3 X-Received: by 10.68.106.36 with SMTP id gr4mr4691082pbb.0.1376400810556; Tue, 13 Aug 2013 06:33:30 -0700 (PDT) Received: from localhost ([122.172.193.46]) by mx.google.com with ESMTPSA id eq5sm43999365pbc.15.2013.08.13.06.33.26 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 13 Aug 2013 06:33:29 -0700 (PDT) From: Viresh Kumar To: rjw@sisk.pl Subject: [PATCH V2 03/35] cpufreq: acpi: Covert to light weight ->target_index() routine Date: Tue, 13 Aug 2013 19:02:16 +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_093352_297314_788F4696 X-CRM114-Status: GOOD ( 11.23 ) X-Spam-Score: -2.6 (--) 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, 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. Signed-off-by: Viresh Kumar --- drivers/cpufreq/acpi-cpufreq.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c index cd5badb..f69b4c8 100644 --- a/drivers/cpufreq/acpi-cpufreq.c +++ b/drivers/cpufreq/acpi-cpufreq.c @@ -424,17 +424,17 @@ static unsigned int check_freqs(const struct cpumask *mask, unsigned int freq, } static int acpi_cpufreq_target(struct cpufreq_policy *policy, - unsigned int target_freq, unsigned int relation) + unsigned int index) { struct acpi_cpufreq_data *data = per_cpu(acfreq_data, policy->cpu); struct acpi_processor_performance *perf; struct cpufreq_freqs freqs; struct drv_cmd cmd; - unsigned int next_state = 0; /* Index into freq_table */ unsigned int next_perf_state = 0; /* Index into perf table */ int result = 0; - pr_debug("acpi_cpufreq_target %d (%d)\n", target_freq, policy->cpu); + pr_debug("acpi_cpufreq_target %d (%d)\n", + data->freq_table[index].frequency, policy->cpu); if (unlikely(data == NULL || data->acpi_data == NULL || data->freq_table == NULL)) { @@ -442,16 +442,7 @@ static int acpi_cpufreq_target(struct cpufreq_policy *policy, } perf = data->acpi_data; - result = cpufreq_frequency_table_target(policy, - data->freq_table, - target_freq, - relation, &next_state); - if (unlikely(result)) { - result = -ENODEV; - goto out; - } - - next_perf_state = data->freq_table[next_state].driver_data; + next_perf_state = data->freq_table[index].driver_data; if (perf->state == next_perf_state) { if (unlikely(data->resume)) { pr_debug("Called after resume, resetting to P%d\n", @@ -493,7 +484,7 @@ static int acpi_cpufreq_target(struct cpufreq_policy *policy, cmd.mask = cpumask_of(policy->cpu); freqs.old = perf->states[perf->state].core_frequency * 1000; - freqs.new = data->freq_table[next_state].frequency; + freqs.new = data->freq_table[index].frequency; cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); drv_write(&cmd); @@ -919,7 +910,7 @@ static struct freq_attr *acpi_cpufreq_attr[] = { static struct cpufreq_driver acpi_cpufreq_driver = { .verify = cpufreq_generic_frequency_table_verify, - .target = acpi_cpufreq_target, + .target_index = acpi_cpufreq_target, .bios_limit = acpi_processor_get_bios_limit, .init = acpi_cpufreq_cpu_init, .exit = acpi_cpufreq_cpu_exit,