From patchwork Thu Dec 4 04:12:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 41903 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8464725E88 for ; Thu, 4 Dec 2014 04:14:03 +0000 (UTC) Received: by mail-lb0-f197.google.com with SMTP id n15sf10330004lbi.4 for ; Wed, 03 Dec 2014 20:14:02 -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=cDg/VfjV9Ih7LKTkuYo3UOsHnunHmsFOVnpczi+Mh4Q=; b=SRZVmtEbCWVK9mONdASwoY/MUoZKxaRZJD+XcrOh0T/tuUFyE2amsvlxMV+dxCNExN sLYpiW5KbkNhHaVqXZt2XV4vh1RsHyCC1gB8JEz6xVVzHsTvZgXeR0KQKdshqIN+m0Wi TMr+Uq4TbsYmLphvPTNBRJw0FG6f8e/HZXmhtd+7Veq4UmyOiTynO8wi6YwzIrXEpoWt fD1IIHnbC2cZrtsnl8D/fDbq+ypKOBvPVOvizlRTmE48faBMqBf6R6L59SpmibIKeXrz ijkbQPFoWJWjjc1giZU+xO2v4xpMmQw08b0pVNFUfG//3WJhezQlZjr61Kl4356gO0jq Buag== X-Gm-Message-State: ALoCoQmo3cfPUYGI0Kg9aSw8Jn5LPDc/nL+tREdC56h852w1xieN5Q2iPYKHxHbZdhcG3Kb4ZAJP X-Received: by 10.112.43.65 with SMTP id u1mr7922lbl.16.1417666442516; Wed, 03 Dec 2014 20:14:02 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.115.193 with SMTP id jq1ls227856lab.85.gmail; Wed, 03 Dec 2014 20:14:02 -0800 (PST) X-Received: by 10.152.10.40 with SMTP id f8mr7478845lab.52.1417666442012; Wed, 03 Dec 2014 20:14:02 -0800 (PST) Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com. [209.85.217.179]) by mx.google.com with ESMTPS id rd5si23114362lbb.73.2014.12.03.20.14.01 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 03 Dec 2014 20:14:01 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) client-ip=209.85.217.179; Received: by mail-lb0-f179.google.com with SMTP id z11so13300380lbi.10 for ; Wed, 03 Dec 2014 20:14:01 -0800 (PST) X-Received: by 10.152.3.67 with SMTP id a3mr7293310laa.56.1417666441930; Wed, 03 Dec 2014 20:14:01 -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 ew9csp781091lbc; Wed, 3 Dec 2014 20:14:01 -0800 (PST) X-Received: by 10.66.139.134 with SMTP id qy6mr14549889pab.128.1417666440210; Wed, 03 Dec 2014 20:14:00 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id df1si18139882pdb.237.2014.12.03.20.13.59 for ; Wed, 03 Dec 2014 20:14:00 -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 S1753018AbaLDEN7 (ORCPT + 12 others); Wed, 3 Dec 2014 23:13:59 -0500 Received: from mail-pa0-f43.google.com ([209.85.220.43]:47757 "EHLO mail-pa0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752582AbaLDEN6 (ORCPT ); Wed, 3 Dec 2014 23:13:58 -0500 Received: by mail-pa0-f43.google.com with SMTP id kx10so17218346pab.2 for ; Wed, 03 Dec 2014 20:13:58 -0800 (PST) X-Received: by 10.70.131.104 with SMTP id ol8mr14453600pdb.81.1417666438167; Wed, 03 Dec 2014 20:13:58 -0800 (PST) Received: from localhost ([122.166.92.172]) by mx.google.com with ESMTPSA id wo3sm24372679pbc.79.2014.12.03.20.13.57 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 03 Dec 2014 20:13:57 -0800 (PST) From: Viresh Kumar To: linux-pm@vger.kernel.org, edubezval@gmail.com Cc: linaro-kernel@lists.linaro.org, rui.zhang@intel.com, amit.daniel@samsung.com, javi.merino@arm.com, Viresh Kumar Subject: [PATCH V2 19/26] thermal: cpu_cooling: remove unnecessary wrapper get_cpu_frequency() Date: Thu, 4 Dec 2014 09:42:01 +0530 Message-Id: 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.217.179 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() isn't doing much by itself, just calling get_property(). And so this wrapper isn't required at all. Get rid of it. Signed-off-by: Viresh Kumar --- drivers/thermal/cpu_cooling.c | 40 +++++++++------------------------------- 1 file changed, 9 insertions(+), 31 deletions(-) diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index a3dd74f..2c4c485 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c @@ -230,30 +230,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. @@ -358,14 +334,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; /* 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; @@ -419,10 +396,11 @@ __cpufreq_cooling_register(struct device_node *np, if (!cpufreq_dev) return ERR_PTR(-ENOMEM); - cpufreq_dev->cpufreq_val = get_cpu_frequency(cpumask_any(clip_cpus), 0); - if (!cpufreq_dev->cpufreq_val) { - pr_err("%s: Failed to get frequency", __func__); - cool_dev = ERR_PTR(-EINVAL); + ret = get_property(cpumask_any(clip_cpus), 0, &cpufreq_dev->cpufreq_val, + GET_FREQ); + if (ret) { + pr_err("%s: Failed to get frequency: %d", __func__, ret); + cool_dev = ERR_PTR(ret); goto free_cdev; }