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: 19058 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vb0-f69.google.com (mail-vb0-f69.google.com [209.85.212.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 751F1246B8 for ; Tue, 13 Aug 2013 13:33:32 +0000 (UTC) Received: by mail-vb0-f69.google.com with SMTP id e13sf220386vbg.4 for ; Tue, 13 Aug 2013 06:33:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-gm-message-state:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:in-reply-to:references :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=xn/Q1c7UhFQxrZFW2n3u+Xos0MPHSP6Ya5yM9Ct9UTo=; b=TAT45WmVJC/pqd1DscN9w5XFgDYADvLNKdP6Mm9qCMEXH82wLeeUrNWCms7Zjtq5eJ fMiUuuvBQ914psO/CrEC+HGH6M+qQD0uXbx35H4d2tbxF/iv8LVTtVKT+juwU+XKU6NW JF70d7hOl2Ub+B0cw1zXYFrrlTkEJ/3hT+rH+IkEdO0N9n4FKsZa2VCw5mvmtTrVO929 ZAkuKn7fOk34qv5DNDnnmFRXgrgBQHC+aGydlRWPnkpAKT6CIbslo2c3cHw4JNx+y87s 3IkGIsqTqycAK2ogDfJ9VnvUZ7f/DlVovIFn5RAF/rs/dzM37I1i8l/JmgN2dPbTIPbh keSQ== X-Received: by 10.236.79.67 with SMTP id h43mr1633763yhe.46.1376400812062; Tue, 13 Aug 2013 06:33:32 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.106.197 with SMTP id gw5ls679332qeb.1.gmail; Tue, 13 Aug 2013 06:33:31 -0700 (PDT) X-Received: by 10.221.47.193 with SMTP id ut1mr4462429vcb.8.1376400811933; Tue, 13 Aug 2013 06:33:31 -0700 (PDT) Received: from mail-vc0-f172.google.com (mail-vc0-f172.google.com [209.85.220.172]) by mx.google.com with ESMTPS id h4si6206842vdw.97.2013.08.13.06.33.31 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 13 Aug 2013 06:33:31 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.172 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.172; Received: by mail-vc0-f172.google.com with SMTP id m17so3859220vca.31 for ; Tue, 13 Aug 2013 06:33:31 -0700 (PDT) X-Gm-Message-State: ALoCoQnTdwKjwQCqTMupjgg+G2bTQcN6innzNDyPJTk/jsHfGBDKdsjseyEZv7NqaEoU2iGEbtny X-Received: by 10.52.170.111 with SMTP id al15mr635489vdc.43.1376400811839; Tue, 13 Aug 2013 06:33:31 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp154115vcz; Tue, 13 Aug 2013 06:33:31 -0700 (PDT) X-Received: by 10.68.134.65 with SMTP id pi1mr4656965pbb.59.1376400810959; Tue, 13 Aug 2013 06:33:30 -0700 (PDT) Received: from mail-pd0-f172.google.com (mail-pd0-f172.google.com [209.85.192.172]) by mx.google.com with ESMTPS id hk5si4389608pac.299.2013.08.13.06.33.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 13 Aug 2013 06:33:30 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.192.172 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.192.172; Received: by mail-pd0-f172.google.com with SMTP id z10so4887567pdj.31 for ; Tue, 13 Aug 2013 06:33:30 -0700 (PDT) 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 Cc: linaro-kernel@lists.linaro.org, patches@linaro.org, cpufreq@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Viresh Kumar 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-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.172 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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,