From patchwork Fri Nov 28 09:44:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 41685 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1F996244C2 for ; Fri, 28 Nov 2014 09:45:51 +0000 (UTC) Received: by mail-lb0-f199.google.com with SMTP id u10sf3884623lbd.6 for ; Fri, 28 Nov 2014 01:45:50 -0800 (PST) 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 :sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=etAqQnqNZdF7VAOAf1abG4TQjJJhdzvjE0W3oosTl2Y=; b=FhVKp0v9SoWtVWLk694RJzKMSXgGvCdGylSHXCPJoBNid6eTHMJArkUYQjvszmQ8SB FXsYmcY68s7u9Xoqc3IiqgksI8UN0SGbwuiKCC+ee5Vdi+fUZg/9v7MiedH34nxYDWVG D789MGfZpBACbQ1FS/CuVle7Ew+3rlZk0IdnIq1v+OzSSzqT9eJCtoGUoQyph7UzwGs6 dWcwKfI8OWZHFx6fatUlNRoTrpQKJ+5HkuxgSSi4Pn3wDrMbm0lCf9XXRvGhrA4vS8xh fJjLboQarp3gAH34inkDN0pEdITndC9WWYl9S42zPJYaUXuFZL93PBrHwJ/Lm7PJqLJO E2Vg== X-Gm-Message-State: ALoCoQnff3VsuZG7/4VREhADK33pIiyqW4uB1RN0yUYwyDTg18WgHJIcnRPOrmwrx0Ff2l3j/OzD X-Received: by 10.112.138.234 with SMTP id qt10mr11981781lbb.4.1417167950133; Fri, 28 Nov 2014 01:45:50 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.6.72 with SMTP id y8ls630141lay.99.gmail; Fri, 28 Nov 2014 01:45:49 -0800 (PST) X-Received: by 10.112.144.228 with SMTP id sp4mr42089450lbb.58.1417167949890; Fri, 28 Nov 2014 01:45:49 -0800 (PST) Received: from mail-la0-f46.google.com (mail-la0-f46.google.com. [209.85.215.46]) by mx.google.com with ESMTPS id uc2si8298390lac.80.2014.11.28.01.45.49 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 28 Nov 2014 01:45:49 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) client-ip=209.85.215.46; Received: by mail-la0-f46.google.com with SMTP id q1so498710lam.33 for ; Fri, 28 Nov 2014 01:45:49 -0800 (PST) X-Received: by 10.112.62.166 with SMTP id z6mr41984202lbr.74.1417167949766; Fri, 28 Nov 2014 01:45:49 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.184.201 with SMTP id ew9csp60496lbc; Fri, 28 Nov 2014 01:45:48 -0800 (PST) X-Received: by 10.70.124.162 with SMTP id mj2mr71392478pdb.33.1417167947692; Fri, 28 Nov 2014 01:45:47 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id vj10si15336419pbc.138.2014.11.28.01.45.46 for ; Fri, 28 Nov 2014 01:45:47 -0800 (PST) Received-SPF: none (google.com: linux-pm-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751774AbaK1Jpq (ORCPT + 12 others); Fri, 28 Nov 2014 04:45:46 -0500 Received: from mail-pd0-f170.google.com ([209.85.192.170]:43741 "EHLO mail-pd0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751761AbaK1Jpp (ORCPT ); Fri, 28 Nov 2014 04:45:45 -0500 Received: by mail-pd0-f170.google.com with SMTP id fp1so6432625pdb.1 for ; Fri, 28 Nov 2014 01:45:45 -0800 (PST) X-Received: by 10.66.146.193 with SMTP id te1mr72789105pab.154.1417167945208; Fri, 28 Nov 2014 01:45:45 -0800 (PST) Received: from localhost ([122.167.111.40]) by mx.google.com with ESMTPSA id lr4sm9442907pab.42.2014.11.28.01.45.43 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 28 Nov 2014 01:45:44 -0800 (PST) From: Viresh Kumar To: linux-pm@vger.kernel.org, edubezval@gmail.com Cc: linaro-kernel@lists.linaro.org, rui.zhang@intel.com, Viresh Kumar Subject: [PATCH 18/26] cpu_cooling: Merge get_cpu_frequency() into cpufreq_set_cur_state() Date: Fri, 28 Nov 2014 15:14:12 +0530 Message-Id: <7b0ee76e42a06e915d4699b2ff83fdf12f7b1543.1417167599.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.0.3.693.g996b0fd In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , get_cpu_frequency() is used from only one place, i.e. cpufreq_set_cur_state(). And there is no need to have this extra level of function calls. Merge them. Signed-off-by: Viresh Kumar --- drivers/thermal/cpu_cooling.c | 31 ++++--------------------------- 1 file changed, 4 insertions(+), 27 deletions(-) diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index 9673b48..5815abf 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c @@ -195,30 +195,6 @@ unsigned long cpufreq_cooling_get_level(unsigned int cpu, unsigned int freq) EXPORT_SYMBOL_GPL(cpufreq_cooling_get_level); /** - * get_cpu_frequency - get the absolute value of frequency from level. - * @cpu: cpu for which frequency is fetched. - * @level: cooling level - * - * This function matches cooling level with frequency. Based on a cooling level - * of frequency, equals cooling state of cpu cooling device, it will return - * the corresponding frequency. - * e.g level=0 --> 1st MAX FREQ, level=1 ---> 2nd MAX FREQ, .... etc - * - * Return: 0 on error, the corresponding frequency otherwise. - */ -static unsigned int get_cpu_frequency(unsigned int cpu, unsigned long level) -{ - int ret = 0; - unsigned int freq; - - ret = get_property(cpu, level, &freq, GET_FREQ); - if (ret) - return 0; - - return freq; -} - -/** * cpufreq_thermal_notifier - notifier callback for cpufreq policy change. * @nb: struct notifier_block * with callback info. * @event: value showing cpufreq event for which this function invoked. @@ -321,14 +297,15 @@ static int cpufreq_set_cur_state(struct thermal_cooling_device *cdev, struct cpufreq_cooling_device *cpufreq_device = cdev->devdata; unsigned int cpu = cpumask_any(&cpufreq_device->allowed_cpus); unsigned int clip_freq; + int ret = 0; /* Check if the old cooling action is same as new cooling action */ if (cpufreq_device->cpufreq_state == state) return 0; - clip_freq = get_cpu_frequency(cpu, state); - if (!clip_freq) - return -EINVAL; + ret = get_property(cpu, state, &clip_freq, GET_FREQ); + if (ret) + return ret; cpufreq_device->cpufreq_state = state; cpufreq_device->cpufreq_val = clip_freq;