From patchwork Thu Feb 11 12:01:16 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 61734 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp146330lbl; Thu, 11 Feb 2016 04:02:25 -0800 (PST) X-Received: by 10.66.233.197 with SMTP id ty5mr25025448pac.145.1455192145768; Thu, 11 Feb 2016 04:02:25 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d89si12277074pfj.146.2016.02.11.04.02.25; Thu, 11 Feb 2016 04:02:25 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dkim=pass header.i=@linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752656AbcBKMCF (ORCPT + 30 others); Thu, 11 Feb 2016 07:02:05 -0500 Received: from mail-pa0-f46.google.com ([209.85.220.46]:32970 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750800AbcBKMCB (ORCPT ); Thu, 11 Feb 2016 07:02:01 -0500 Received: by mail-pa0-f46.google.com with SMTP id fl4so16175757pad.0 for ; Thu, 11 Feb 2016 04:02:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=3RRMOGrAUSfa4LkeZvrrprFiWHHrjjl556C8Zwnv/ws=; b=Wi2XvpKqiJ/ZXX0PW935WR19MBZcjXtfBNw9tL96I+4NyIVVIob/PR816kRMNrrsQB +2ALsB38S02ZcIqXFGlomr/R449zOen7TdUmyEbwCfW7j2W27u0GGxmi9ag1oD92+h+3 hmLV0no4+j+/lNmg5UoeTUgxDFpZ+3Whakq/A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=3RRMOGrAUSfa4LkeZvrrprFiWHHrjjl556C8Zwnv/ws=; b=mbS5t5vcyrZWhGzm0o4PSgnendVre5GG4DjfLQIf9iQ7jEMowELcXMeQlUUBxfMmfE FwsdFi4eOVriMqq+mu+p0jQT6+v6/Ua0S4sFi0AiDvUevLDwRtbHVdT5/RMav+l/Gdvs CFnLkucLdbtsxJxcpXhhBNzIjqnu8Kpz7Lvtj6MfyB+Y5LLUI1fvYq8PNTfIJL/t0Xe0 +Z6qMKR7a2MLlUdoYfZCTsa8LOhqoVEE7kzfzbQrsovkCg/SFCjMbuER+Gogat9J7Sbn gZH1oxZjHfJbGOpEibf/EHlPq4DU9UD49OJMizt1hnyRHOfaYVfQ6WE9299Lq00NUP7Z 5OgQ== X-Gm-Message-State: AG10YOTz0oASzxgzDpN5/FypjuUBIgQdVy6sRpzc9AOa5dF/iZn9+hjXijrJzmcJXSFwV2fw X-Received: by 10.67.14.136 with SMTP id fg8mr66173268pad.105.1455192120955; Thu, 11 Feb 2016 04:02:00 -0800 (PST) Received: from localhost ([122.172.89.184]) by smtp.gmail.com with ESMTPSA id 87sm5560582pfq.93.2016.02.11.04.01.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Feb 2016 04:02:00 -0800 (PST) From: Viresh Kumar To: Rafael Wysocki , juri.lelli@arm.com Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, shilpa.bhat@linux.vnet.ibm.com, linux-kernel@vger.kernel.org, Viresh Kumar Subject: [PATCH V5 6/6] cpufreq: ondemand: Rearrange od_dbs_timer() to avoid updating delay Date: Thu, 11 Feb 2016 17:31:16 +0530 Message-Id: <6f5fb9de5d7e81fb9323b72352c16f658f03c351.1455191663.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.7.1.370.gb2aa7f8 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 'delay' is updated properly in all paths of the routine od_dbs_timer(), leaving just one. And can be 0 only in that case. Move the update to 'delay' as an else part of the if block. Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq_ondemand.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) -- 2.7.1.370.gb2aa7f8 diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c index 12213823cc93..0b79f1488be4 100644 --- a/drivers/cpufreq/cpufreq_ondemand.c +++ b/drivers/cpufreq/cpufreq_ondemand.c @@ -194,7 +194,7 @@ static unsigned int od_dbs_timer(struct cpufreq_policy *policy) struct policy_dbs_info *policy_dbs = policy->governor_data; struct dbs_data *dbs_data = policy_dbs->dbs_data; struct od_cpu_dbs_info_s *dbs_info = &per_cpu(od_cpu_dbs_info, policy->cpu); - int delay = 0, sample_type = dbs_info->sample_type; + int delay, sample_type = dbs_info->sample_type; /* Common NORMAL_SAMPLE setup */ dbs_info->sample_type = OD_NORMAL_SAMPLE; @@ -208,13 +208,12 @@ static unsigned int od_dbs_timer(struct cpufreq_policy *policy) /* Setup timer for SUB_SAMPLE */ dbs_info->sample_type = OD_SUB_SAMPLE; delay = dbs_info->freq_hi_jiffies; + } else { + delay = delay_for_sampling_rate(dbs_data->sampling_rate + * dbs_info->rate_mult); } } - if (!delay) - delay = delay_for_sampling_rate(dbs_data->sampling_rate - * dbs_info->rate_mult); - return delay; }