From patchwork Mon Aug 12 17:48:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 19042 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qe0-f72.google.com (mail-qe0-f72.google.com [209.85.128.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A09DE246B8 for ; Mon, 12 Aug 2013 17:57:31 +0000 (UTC) Received: by mail-qe0-f72.google.com with SMTP id a11sf8766260qen.3 for ; Mon, 12 Aug 2013 10:57:31 -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=i4Iu3cP9Q2GRsPUAOhN/v27GFQVDv48fGJzW+Agq6j8=; b=BBaxrj3TRlPlLt/v8SLsWmzfSTVceRHbd8B0dEdKax7wJuf2KAZyWjzaDbUUNHcHOc 7p7VExSG7RRmy6r+jweSspothCx5JYC4do+aofqATPipEyWG7GpkzaEgreiYC0CCMJnu O7aBBEpkTYfollhcXKHI3wJYKDeqJEzBq+rxhJkwDkQ7iFNE2ZUKGGQl0lA/CoqiE8ke qqlWURtVu3mokyPBgFfLixJpO5pFYZ5YaiFp7YAp8gRzJzTwHOYEg5pYWUFx4ML/96FO BepblAK4D4l7sTiunKdUwzndm7DaIWdEb/z+FN5HbWJfthhEBiODjlMWoovyr0VhLMcH jS+g== X-Received: by 10.236.78.198 with SMTP id g46mr60912yhe.56.1376329796305; Mon, 12 Aug 2013 10:49:56 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.71.83 with SMTP id s19ls1923784qeu.7.gmail; Mon, 12 Aug 2013 10:49:56 -0700 (PDT) X-Received: by 10.58.127.202 with SMTP id ni10mr145093veb.27.1376329796136; Mon, 12 Aug 2013 10:49:56 -0700 (PDT) Received: from mail-ve0-f181.google.com (mail-ve0-f181.google.com [209.85.128.181]) by mx.google.com with ESMTPS id zj7si8583688vdb.90.2013.08.12.10.49.56 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 12 Aug 2013 10:49:56 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.181 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.181; Received: by mail-ve0-f181.google.com with SMTP id jz10so5904127veb.12 for ; Mon, 12 Aug 2013 10:49:56 -0700 (PDT) X-Gm-Message-State: ALoCoQkXEKZPu/ZJQbxGTzELoXE7JI8eBZbc48NL5k8Iq1Hv4lg0hnolLnXxdEEz7QnOoHvL+uJl X-Received: by 10.58.76.130 with SMTP id k2mr147324vew.24.1376329796023; Mon, 12 Aug 2013 10:49:56 -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 u4csp108133vcz; Mon, 12 Aug 2013 10:49:55 -0700 (PDT) X-Received: by 10.68.20.200 with SMTP id p8mr228629pbe.122.1376329795064; Mon, 12 Aug 2013 10:49:55 -0700 (PDT) Received: from mail-pd0-f177.google.com (mail-pd0-f177.google.com [209.85.192.177]) by mx.google.com with ESMTPS id y8si23273275pax.325.2013.08.12.10.49.54 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 12 Aug 2013 10:49:55 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.192.177 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.192.177; Received: by mail-pd0-f177.google.com with SMTP id y10so3705097pdj.8 for ; Mon, 12 Aug 2013 10:49:54 -0700 (PDT) X-Received: by 10.68.252.106 with SMTP id zr10mr248227pbc.63.1376329794657; Mon, 12 Aug 2013 10:49:54 -0700 (PDT) Received: from localhost ([122.172.193.46]) by mx.google.com with ESMTPSA id sz6sm41384847pab.5.2013.08.12.10.49.51 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 12 Aug 2013 10:49:54 -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 03/31] cpufreq: acpi: Covert to light weight ->target() routine Date: Mon, 12 Aug 2013 23:18:39 +0530 Message-Id: <9f7e2f5a904df376b68bfde862394b29b30dc192.1376329128.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.128.181 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_old() to newly defined light weight .target() 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 c8fe868..dea4449 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_old = acpi_cpufreq_target, + .target = acpi_cpufreq_target, .bios_limit = acpi_processor_get_bios_limit, .init = acpi_cpufreq_cpu_init, .exit = acpi_cpufreq_cpu_exit,