From patchwork Fri Oct 18 13:59:25 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 21133 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f198.google.com (mail-ie0-f198.google.com [209.85.223.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 23205202FF for ; Fri, 18 Oct 2013 14:00:26 +0000 (UTC) Received: by mail-ie0-f198.google.com with SMTP id tp5sf10254169ieb.1 for ; Fri, 18 Oct 2013 07:00:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; 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=RLHfoUd7vSgPfqAYIX1xod87/oqiQzxk0O56Gg7S1Fs=; b=IXVu4RprzTTMEJDQMkuhjimNgXE8DxRKr6tkQsUzSQzuJf27U5xY4uYMK/NF68EYMj rCacHwr0L/y+g9K0XfTIF7f8klKG3PGWZDQ2SEmqWhNcNbqGECVOb/fX39VyKLGZVxDn 6pyJlk74vlQ6hknriK63Qm7BuGzl85GLDfk9yy0g5EvcCdX3524Qo0Z1G2oe4wawbTyf SBOjnGoDwCz0drCQW3cXt2YX46YfWel3nYeC7WGFcBSWNkxvjiJ68qP3lIN9/TSLhuaE HPjcDT8Y5YCN996EQpTmvX6kqPb7Ff77drwJwWPRU9a50YpO6j9UenwAqlz+dU909yq3 YfLA== X-Received: by 10.42.37.143 with SMTP id y15mr1053686icd.26.1382104825166; Fri, 18 Oct 2013 07:00:25 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.82.229 with SMTP id l5ls1310970qey.11.gmail; Fri, 18 Oct 2013 07:00:25 -0700 (PDT) X-Received: by 10.52.187.138 with SMTP id fs10mr1794454vdc.10.1382104825040; Fri, 18 Oct 2013 07:00:25 -0700 (PDT) Received: from mail-vb0-f54.google.com (mail-vb0-f54.google.com [209.85.212.54]) by mx.google.com with ESMTPS id sv5si333582veb.51.2013.10.18.07.00.25 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 18 Oct 2013 07:00:25 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.54 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.54; Received: by mail-vb0-f54.google.com with SMTP id q14so1946641vbe.27 for ; Fri, 18 Oct 2013 07:00:25 -0700 (PDT) X-Gm-Message-State: ALoCoQn0RlfNBR+Eb6XZ4YQMcx3+XJIY9cr4C848PIM9qXhODP0cNlmhC84vir3xNpKN3++qg/HT X-Received: by 10.58.38.200 with SMTP id i8mr2175701vek.6.1382104824948; Fri, 18 Oct 2013 07:00:24 -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 u4csp37874vcz; Fri, 18 Oct 2013 07:00:24 -0700 (PDT) X-Received: by 10.66.158.196 with SMTP id ww4mr3674646pab.57.1382104824053; Fri, 18 Oct 2013 07:00:24 -0700 (PDT) Received: from mail-pb0-f51.google.com (mail-pb0-f51.google.com [209.85.160.51]) by mx.google.com with ESMTPS id l8si991017pbi.151.2013.10.18.07.00.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 18 Oct 2013 07:00:24 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.160.51 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.160.51; Received: by mail-pb0-f51.google.com with SMTP id jt11so3897742pbb.10 for ; Fri, 18 Oct 2013 07:00:23 -0700 (PDT) X-Received: by 10.66.188.203 with SMTP id gc11mr3573043pac.63.1382104823584; Fri, 18 Oct 2013 07:00:23 -0700 (PDT) Received: from localhost ([120.56.197.189]) by mx.google.com with ESMTPSA id a6sm2625175pbr.17.2013.10.18.07.00.19 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 18 Oct 2013 07:00:22 -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, Viresh Kumar Subject: [PATCH V2 Resend 02/34] cpufreq: acpi: Convert to light weight ->target_index() routine Date: Fri, 18 Oct 2013 19:29:25 +0530 Message-Id: <3eee307f3c61594beeaa016828b3a01dba4406be.1382104515.git.viresh.kumar@linaro.org> 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.212.54 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 a1717d7..889cec0 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); @@ -923,7 +914,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,