From patchwork Fri Sep 13 13:01:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 20192 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f198.google.com (mail-qc0-f198.google.com [209.85.216.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2978A20F2F for ; Fri, 13 Sep 2013 13:19:23 +0000 (UTC) Received: by mail-qc0-f198.google.com with SMTP id l13sf1201433qcy.5 for ; Fri, 13 Sep 2013 06:19:23 -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=degdC3Wk6um5GgbfJOkYh6cNlzRfG03rhfnXJ5fl+2U=; b=YGwxNFnpu4nrXBpE2zIT4rZK5DM/Dk88qmHCitgjwDzfKnTfdX+yPZ7keEUKMDhdcc edlX+yGXDuQzXw7HvIxDcG/RJ3qChj1A0rBgZCcK3BMCDVGFkKZ9+cTNprfhxtcKcfld 3ppVbRM0dbuxb3qUxle5uCVBs1n1R6+q5UP9bjCZDsAntsIcXQ5sqOWCDO1eecotIe0f 6z6UKsagrIJHb72GCEr0Wn8Aq+tzUf07rO6TOq7XdxW1EUNIpx/+9PIroIV+mJYhLkIR GOlCrsPqkDg0h8E3ujjur7wptUAzcXfXeiFVno2JpV649GUnax7TWB3Xj/0ElRLZ1Zo6 3puA== X-Gm-Message-State: ALoCoQmvQ4WNxxh7kBqe7WlyYrMHGQxz3VqCJ/DnVq+F4zXfHBPZtqBnvpeC+C6kX+SSIjBYmLat X-Received: by 10.236.110.168 with SMTP id u28mr4990277yhg.40.1379078362970; Fri, 13 Sep 2013 06:19:22 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.117.129 with SMTP id ke1ls1149086qeb.88.gmail; Fri, 13 Sep 2013 06:19:22 -0700 (PDT) X-Received: by 10.52.122.68 with SMTP id lq4mr10127289vdb.21.1379078362750; Fri, 13 Sep 2013 06:19:22 -0700 (PDT) Received: from mail-ve0-f178.google.com (mail-ve0-f178.google.com [209.85.128.178]) by mx.google.com with ESMTPS id tj6si3103778vcb.118.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Sep 2013 06:19:22 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.178 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.178; Received: by mail-ve0-f178.google.com with SMTP id jw12so934140veb.23 for ; Fri, 13 Sep 2013 06:19:22 -0700 (PDT) X-Received: by 10.58.75.131 with SMTP id c3mr8532802vew.12.1379078362636; Fri, 13 Sep 2013 06:19:22 -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 u4csp80263vcz; Fri, 13 Sep 2013 06:19:22 -0700 (PDT) X-Received: by 10.66.196.110 with SMTP id il14mr15418457pac.130.1379078361096; Fri, 13 Sep 2013 06:19:21 -0700 (PDT) Received: from mail-pa0-f54.google.com (mail-pa0-f54.google.com [209.85.220.54]) by mx.google.com with ESMTPS id is7si7463505pbc.89.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Sep 2013 06:19:21 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.54 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.220.54; Received: by mail-pa0-f54.google.com with SMTP id kx10so2525692pab.13 for ; Fri, 13 Sep 2013 06:19:20 -0700 (PDT) X-Received: by 10.68.191.72 with SMTP id gw8mr13593709pbc.92.1379078360598; Fri, 13 Sep 2013 06:19:20 -0700 (PDT) Received: from localhost ([122.167.78.148]) by mx.google.com with ESMTPSA id ct4sm11705344pbb.41.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 13 Sep 2013 06:19:19 -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 , Santosh Shilimkar Subject: [PATCH 138/228] cpufreq: omap: use cpufreq_generic_init() routine Date: Fri, 13 Sep 2013 18:31:24 +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.128.178 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: , Use generic cpufreq_generic_init() routine instead of replicating the same code here. This also rearranges the code a bit to make it more sensible. Also removes some unnecessary checks. Cc: Santosh Shilimkar Signed-off-by: Viresh Kumar --- drivers/cpufreq/omap-cpufreq.c | 41 +++++++++++------------------------------ 1 file changed, 11 insertions(+), 30 deletions(-) diff --git a/drivers/cpufreq/omap-cpufreq.c b/drivers/cpufreq/omap-cpufreq.c index a8c3f90..58b2200 100644 --- a/drivers/cpufreq/omap-cpufreq.c +++ b/drivers/cpufreq/omap-cpufreq.c @@ -160,50 +160,31 @@ static inline void freq_table_free(void) static int omap_cpu_init(struct cpufreq_policy *policy) { - int result = 0; + int result; mpu_clk = clk_get(NULL, "cpufreq_ck"); if (IS_ERR(mpu_clk)) return PTR_ERR(mpu_clk); - if (policy->cpu >= NR_CPUS) { - result = -EINVAL; - goto fail_ck; - } - - if (!freq_table) + if (!freq_table) { result = opp_init_cpufreq_table(mpu_dev, &freq_table); - - if (result) { - dev_err(mpu_dev, "%s: cpu%d: failed creating freq table[%d]\n", + if (result) { + dev_err(mpu_dev, + "%s: cpu%d: failed creating freq table[%d]\n", __func__, policy->cpu, result); - goto fail_ck; + goto fail; + } } atomic_inc_return(&freq_table_users); - result = cpufreq_table_validate_and_show(policy, freq_table); - if (result) - goto fail_table; - - /* - * On OMAP SMP configuartion, both processors share the voltage - * and clock. So both CPUs needs to be scaled together and hence - * needs software co-ordination. Use cpufreq affected_cpus - * interface to handle this scenario. Additional is_smp() check - * is to keep SMP_ON_UP build working. - */ - if (is_smp()) - cpumask_setall(policy->cpus); - /* FIXME: what's the actual transition time? */ - policy->cpuinfo.transition_latency = 300 * 1000; - - return 0; + result = cpufreq_generic_init(policy, freq_table, 300 * 1000); + if (!result) + return 0; -fail_table: freq_table_free(); -fail_ck: +fail: clk_put(mpu_clk); return result; }