From patchwork Thu Jun 21 01:52:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Kaehlcke X-Patchwork-Id: 10478999 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 546226023A for ; Thu, 21 Jun 2018 01:55:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 44CB028A56 for ; Thu, 21 Jun 2018 01:55:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 396BB28A5E; Thu, 21 Jun 2018 01:55:58 +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=ham 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 D468528A56 for ; Thu, 21 Jun 2018 01:55:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754669AbeFUBzz (ORCPT ); Wed, 20 Jun 2018 21:55:55 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:36945 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754204AbeFUBwy (ORCPT ); Wed, 20 Jun 2018 21:52:54 -0400 Received: by mail-pf0-f195.google.com with SMTP id y5-v6so683992pfn.4 for ; Wed, 20 Jun 2018 18:52:54 -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=iP0aNpMNP5NFNiX8O+ENtHFFZp1nhrIXS/ECXHZDgak=; b=m+OE1HdM+Y7tNeeTO0SP/4I4zRZZyIyjoUlHgKKTYMmW7q0XVuerqnaRTt6Z2Dh3E6 p7dLaswV6i4qta7LwmplRCVw43BVKgZghS+Avo9xAwDufz3d4sHyZ6mYvaR3y2C67zxf QEtk9FMcEU1MgFSYfS+KK1guKD+1cAR5vMrNZMuduZ5B4NNee+z6lmhH67ZWxucDNu+1 OulXihZqsoRvNd5BkheZ8h/b5VmkwdOL6nhF84Pp94ZD0yuEukueNzC6WVUBxoQh0hVj K5kFHnoN5EOCRPLuvL1h3o2VBDCOKAfYo+4Otu84sxeRN2SwbXy6Opdqj/ynaRvtJC1W feQQ== X-Gm-Message-State: APt69E0tz4L3ETACYKoMdSDtpU/ugo+Zdn9Z7D323mUClfo5j/l/7Rn0 VG7e1R5HZPldvuU/nlTOZz87Ow== X-Google-Smtp-Source: ADUXVKLBq38NT4ZRCc1aRgRYsNJKMnM2JlMqf3VBfqmYseNEPxL7z1gLoKIkHEUTMrb7CgmkgCn9eg== X-Received: by 2002:a63:3759:: with SMTP id g25-v6mr21087268pgn.59.1529545973425; Wed, 20 Jun 2018 18:52:53 -0700 (PDT) Received: from mka.mtv.corp.google.com ([2620:0:1000:1501:8e2d:4727:1211:622]) by smtp.gmail.com with ESMTPSA id p12-v6sm6585877pfi.175.2018.06.20.18.52.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Jun 2018 18:52:52 -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 , Enric Balletbo i Serra , "Rafael J . Wysocki" , Viresh Kumar , Lee Jones , Benson Leung , Olof Johansson , Matthias Kaehlcke Subject: [PATCH v4 01/12] PM / devfreq: Init user limits from OPP limits, not viceversa Date: Wed, 20 Jun 2018 18:52:26 -0700 Message-Id: <20180621015237.100100-2-mka@chromium.org> X-Mailer: git-send-email 2.18.0.rc2.346.g013aa6912e-goog In-Reply-To: <20180621015237.100100-1-mka@chromium.org> References: <20180621015237.100100-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 Commit ab8f58ad72c4 ("PM / devfreq: Set min/max_freq when adding the devfreq device") introduced the initialization of the user limits min/max_freq from the lowest/highest available OPPs. Later commit f1d981eaecf8 ("PM / devfreq: Use the available min/max frequency") added scaling_min/max_freq, which actually represent the frequencies of the lowest/highest available OPP. scaling_min/ max_freq are initialized with the values from min/max_freq, which is totally correct in the context, but a bit awkward to read. Swap the initialization and assign scaling_min/max_freq with the OPP freqs and then the user limts min/max_freq with scaling_min/ max_freq. Needless to say that this change is a NOP, intended to improve readability. Signed-off-by: Matthias Kaehlcke Reviewed-by: Chanwoo Choi Reviewed-by: Brian Norris --- Changes in v4: - added 'Reviewed-by: Brian Norris ' tag Changes in v3: - none Changes in v2: - added 'Reviewed-by: Chanwoo Choi ' tag --- drivers/devfreq/devfreq.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index fe2af6aa88fc..0057ef5b0a98 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -604,21 +604,21 @@ struct devfreq *devfreq_add_device(struct device *dev, mutex_lock(&devfreq->lock); } - devfreq->min_freq = find_available_min_freq(devfreq); - if (!devfreq->min_freq) { + devfreq->scaling_min_freq = find_available_min_freq(devfreq); + if (!devfreq->scaling_min_freq) { mutex_unlock(&devfreq->lock); err = -EINVAL; goto err_dev; } - devfreq->scaling_min_freq = devfreq->min_freq; + devfreq->min_freq = devfreq->scaling_min_freq; - devfreq->max_freq = find_available_max_freq(devfreq); - if (!devfreq->max_freq) { + devfreq->scaling_max_freq = find_available_max_freq(devfreq); + if (!devfreq->scaling_max_freq) { mutex_unlock(&devfreq->lock); err = -EINVAL; goto err_dev; } - devfreq->scaling_max_freq = devfreq->max_freq; + devfreq->max_freq = devfreq->scaling_max_freq; dev_set_name(&devfreq->dev, "devfreq%d", atomic_inc_return(&devfreq_no));