From patchwork Fri May 25 20:30:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Kaehlcke X-Patchwork-Id: 10428481 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 86B90601D5 for ; Fri, 25 May 2018 20:33:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 79AEE2970F for ; Fri, 25 May 2018 20:33:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6E4FA29766; Fri, 25 May 2018 20:33:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1FB7C2970F for ; Fri, 25 May 2018 20:33:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030288AbeEYUda (ORCPT ); Fri, 25 May 2018 16:33:30 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:45403 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S968402AbeEYUbV (ORCPT ); Fri, 25 May 2018 16:31:21 -0400 Received: by mail-pf0-f196.google.com with SMTP id c10-v6so3079694pfi.12 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=nZIL8SMiXaOIYDttTokgpZsgMZV6ZIl0VLEaWwPrMHINQBXTXQDYK/Aw1plFz7xko3 CwbvlpYx5Kn9h+pOBJkAigPOVcRi+rMLAgAUeOhyy8og94bAkeEjHeZWhWgylNiOhX4G Ij/7NmaQW6AVjdOypcGa1OU64JBL4pLNQtGPgiIrZRMPl6uDWuPZpodCG/pESJwyDBzU 9SAO1nq58SdRPIgeFQ5fnrlZeId+RhoS0PnztO9YtkltzNydt3sPoVadZqlLqUE/mQTV xLVeV4fz4bzXlq9Lhd2L9qu5L6cwlbSYvmy08fonMdAn+kwaDnOVcCW/f5Sa8qtuktO0 m3yw== X-Gm-Message-State: ALKqPwefNWd2KHAYeN583YxPNMr1FE7qBFWr3EMeOc8E0QwfF4OeutGn 49VMhjDbzByWApsOi0dLPk88og== X-Google-Smtp-Source: AB8JxZpMfx0sLQBcnk6YWE/T8fb+mPoki7zIgqJOp+sqNV8cXAX5CJ0PfFMRbU7fAp5N7C792LtahA== 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-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Acked-by: MyungJoo Ham Reviewed-by: Chanwoo Choi --- 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; }