Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp29270imm; Fri, 25 May 2018 13:34:32 -0700 (PDT) X-Google-Smtp-Source: AB8JxZo5sQTcxsOCqxHRggxToei4fMCoLUO975CED4W8KTkMIYJZjQdoxixsEswM1WpYk3G3Ward X-Received: by 2002:a65:420d:: with SMTP id c13-v6mr3055998pgq.400.1527280472704; Fri, 25 May 2018 13:34:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527280472; cv=none; d=google.com; s=arc-20160816; b=TfOOpkjqLUjj+2ni4hfJ2o6NmJqP+dE2gWMG5Tg5TqGCddsAFHD9eMJGi4x9CQUgt6 IJQ31Xtxj02mzgNJ0lbTMtS7AUoKsJae6bOUvTM6eqkd4mfBR2SFt5nfY3yOeSu1MbDT j7PHcmp+DG/daDcfE7z3VlRvFB/2akmh23W8bgaKQjf4Ly2P+YxnRK2C32kjcMNLW7Sv Jx9QnbheQE0a3OR00T4Klk0k6EKPZdEalaEc/gOmGVvkxF0Me1VdQBfMpbAFRJMWfY9g ycQVy2dgLeVYyRDINFNeCiiP6KdADYs1H6+pEsgy12+Q8EdQOgNPetgAuv/XzQ+avdbY 3ZeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=XtKEik+h2dqe0nJUJBDSFTEBT+UzUiuyNU0ZbbUIMh4=; b=mF0womwjnsWdd5GPr/XoeuW295M2kItBZYVDj9c2o25hqrDJ8Pc1Z9kSNMBQQoLv5e MCSAtXyLlk3Wk5hYU5wAQeBcRZ64AP1OvUq49awLaMyESs4/R1sjsKV5hHoKCOy5AXX+ FiZcHX2+Y+61QkfvPdNui1jIE18mNZzVqt74n0Qb/L9Cx38nVxlgwVupanVMf6QoUwKf nwq6zyaYm+zeBESco7bUn22EnlhGYA9zLCiI8CkfnNoWO8MbryzLDpLjz51btm4ch+gj YuwpdXHze3J6LHYrgHWcKWr9czzY2ODSwVDbDrOMidK6Kg54AdeN3R/0RULF4SzDZfMT j/0Q== ARC-Authentication-Results: i=1; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 43-v6si25239566plb.511.2018.05.25.13.34.17; Fri, 25 May 2018 13:34:32 -0700 (PDT) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030431AbeEYUdH (ORCPT + 99 others); Fri, 25 May 2018 16:33:07 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:37362 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S968404AbeEYUbV (ORCPT ); Fri, 25 May 2018 16:31:21 -0400 Received: by mail-pf0-f194.google.com with SMTP id e9-v6so3085553pfi.4 for ; Fri, 25 May 2018 13:31:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=XtKEik+h2dqe0nJUJBDSFTEBT+UzUiuyNU0ZbbUIMh4=; b=EUEaDbFUnSqI6VhC19gB7p8bn/QADJNjgy9d+T0VWs3cw0dnmbHKwL1nNQWl2Y+JRL by+VexN2SYBP8CWqxy1AOdZPAe5nF/DdRfYAyXrLh1Q+iSIwSc7ECU98tC3BLqti+d1i jGBjmrV/jq2f68jENPv2b2jVKqjwoNIAqovDYgqINdLUUXoYR4gtO90pBYcaabe6v6sY GrsHPDVnqsgaP2XKPtxCVvh71Q6avgox4h1QdenKftdTVXdH3xWU5LGZFxtE8CNb0RN8 GovGR/LAsvfY6g0Av3RDR9F5UQcLfV5kNTTB1fahsufBD+EjB4NkSamzBS2ekAP9M4gi jv2g== X-Gm-Message-State: ALKqPwdxYFjX4MuA6I476HPGmF17FeaHprVEUXNNqeNJRESqMcPw5xnj mr4ePM/OZBElXNd/JRd1FHfDzg== X-Received: by 2002:a62:e30f:: with SMTP id g15-v6mr4034919pfh.68.1527280280267; Fri, 25 May 2018 13:31:20 -0700 (PDT) Received: from mka.mtv.corp.google.com ([2620:0:1000:1501:8e2d:4727:1211:622]) by smtp.gmail.com with ESMTPSA id p1-v6sm42912360pfp.137.2018.05.25.13.31.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 May 2018 13:31:19 -0700 (PDT) From: Matthias Kaehlcke To: MyungJoo Ham Cc: Kyungmin Park , Chanwoo Choi , Arnd Bergmann , Greg Kroah-Hartman , Rob Herring , Mark Rutland , linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Brian Norris , Douglas Anderson , Matthias Kaehlcke Subject: [PATCH 04/11] PM / devfreq: Remove redundant frequency adjustment from governors Date: Fri, 25 May 2018 13:30:36 -0700 Message-Id: <20180525203043.249193-5-mka@chromium.org> X-Mailer: git-send-email 2.17.0.921.gf22659ad46-goog In-Reply-To: <20180525203043.249193-1-mka@chromium.org> References: <20180525203043.249193-1-mka@chromium.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The userspace and simpleondemand governor determine a target frequency and then adjust it according to the df->min/max_freq limits that might have been set by user space. This adjustment is redundant, it is done in update_devfreq() for any governor, right after returning from governor->get_target_freq(). Signed-off-by: Matthias Kaehlcke --- drivers/devfreq/governor_simpleondemand.c | 5 ----- drivers/devfreq/governor_userspace.c | 16 ++++------------ 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/drivers/devfreq/governor_simpleondemand.c b/drivers/devfreq/governor_simpleondemand.c index 278964783fa6..3da7554b4837 100644 --- a/drivers/devfreq/governor_simpleondemand.c +++ b/drivers/devfreq/governor_simpleondemand.c @@ -84,11 +84,6 @@ static int devfreq_simple_ondemand_func(struct devfreq *df, b = div_u64(b, (dfso_upthreshold - dfso_downdifferential / 2)); *freq = (unsigned long) b; - if (df->min_freq && *freq < df->min_freq) - *freq = df->min_freq; - if (df->max_freq && *freq > df->max_freq) - *freq = df->max_freq; - return 0; } diff --git a/drivers/devfreq/governor_userspace.c b/drivers/devfreq/governor_userspace.c index 080607c3f34d..378d84c011df 100644 --- a/drivers/devfreq/governor_userspace.c +++ b/drivers/devfreq/governor_userspace.c @@ -26,19 +26,11 @@ static int devfreq_userspace_func(struct devfreq *df, unsigned long *freq) { struct userspace_data *data = df->data; - if (data->valid) { - unsigned long adjusted_freq = data->user_frequency; - - if (df->max_freq && adjusted_freq > df->max_freq) - adjusted_freq = df->max_freq; - - if (df->min_freq && adjusted_freq < df->min_freq) - adjusted_freq = df->min_freq; - - *freq = adjusted_freq; - } else { + if (data->valid) + *freq = data->user_frequency; + else *freq = df->previous_freq; /* No user freq specified yet */ - } + return 0; } -- 2.17.0.921.gf22659ad46-goog