From patchwork Fri Sep 13 13:01: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: 20202 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vb0-f72.google.com (mail-vb0-f72.google.com [209.85.212.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id DD22F20358 for ; Fri, 13 Sep 2013 13:20:30 +0000 (UTC) Received: by mail-vb0-f72.google.com with SMTP id f12sf1201374vbg.7 for ; Fri, 13 Sep 2013 06:20:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version: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=J5m5nwj+h1W2yxN7OUsv7ZIKdzzSDSTpB1ELcN+NvrM=; b=i/MDOxrnyvIMAs+JTZT++PX5FWG0vzOoB3zYDXRhtc+HOp1dV7cU0bSVe5xvZd2tsK pPpqj6oQmO9X3rQhacNc1016WcVqmrvSkZC3df/iTlGjbOR4ztsSNbwSm2kMan5iCnsA I53O1Mq93oMeX1JmNfhwLoEYSaPOZ5DRtUXmzYuF8gCg0jLHHleV049xxjwG4VDDvR6J Jai6RqkuvfsVkrDPU3O0cD103e8GsYpdEJItrlTIxaXpKFLY+hQYLGZ/MmLF2keMFCva l2tz2FEliSkeMJd482Q9OdVJbIUtjHtx3v4d5SYVjXqzpijlzBd5AuNo004KEBbk56qG LmDw== X-Gm-Message-State: ALoCoQnosEaBb9aSVe1GPPBhKIsJkbbDoNjzT6j6HB8Yf5fDQAAviOEHcZYx80nL7SwVPGifHp66 X-Received: by 10.58.117.4 with SMTP id ka4mr793473veb.24.1379078430647; Fri, 13 Sep 2013 06:20:30 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.18.199 with SMTP id y7ls1183040qed.78.gmail; Fri, 13 Sep 2013 06:20:30 -0700 (PDT) X-Received: by 10.52.120.78 with SMTP id la14mr10315400vdb.9.1379078430421; Fri, 13 Sep 2013 06:20:30 -0700 (PDT) Received: from mail-vb0-f46.google.com (mail-vb0-f46.google.com [209.85.212.46]) by mx.google.com with ESMTPS id zw10si3122704vdb.18.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Sep 2013 06:20:30 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.46 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.46; Received: by mail-vb0-f46.google.com with SMTP id p13so883840vbe.19 for ; Fri, 13 Sep 2013 06:20:30 -0700 (PDT) X-Received: by 10.52.119.228 with SMTP id kx4mr10054685vdb.12.1379078430333; Fri, 13 Sep 2013 06:20:30 -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 u4csp80339vcz; Fri, 13 Sep 2013 06:20:29 -0700 (PDT) X-Received: by 10.68.241.6 with SMTP id we6mr2102429pbc.174.1379078429489; Fri, 13 Sep 2013 06:20:29 -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 se2si7441906pbc.196.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Sep 2013 06:20:29 -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 jt11so1222822pbb.24 for ; Fri, 13 Sep 2013 06:20:29 -0700 (PDT) X-Received: by 10.68.132.103 with SMTP id ot7mr13295617pbb.158.1379078429098; Fri, 13 Sep 2013 06:20:29 -0700 (PDT) Received: from localhost ([122.167.78.148]) by mx.google.com with ESMTPSA id u7sm11745412pbf.12.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 13 Sep 2013 06:20:28 -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 148/228] cpufreq: acpi: Convert to light weight ->target_index() routine Date: Fri, 13 Sep 2013 18:31:34 +0530 Message-Id: <40776b7be5e8ec5300b83298e0bf967bc3bf61a0.1379063063.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.46 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 372febf..7536e7d 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); @@ -918,7 +909,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,