From patchwork Fri May 15 07:57:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 212023 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.9 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 813D6C433E0 for ; Fri, 15 May 2020 07:57:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 58FDC20709 for ; Fri, 15 May 2020 07:57:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="WwdP3nRL" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726671AbgEOH5e (ORCPT ); Fri, 15 May 2020 03:57:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1727051AbgEOH5d (ORCPT ); Fri, 15 May 2020 03:57:33 -0400 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1122CC05BD09 for ; Fri, 15 May 2020 00:57:33 -0700 (PDT) Received: by mail-pf1-x444.google.com with SMTP id 23so596569pfy.8 for ; Fri, 15 May 2020 00:57:33 -0700 (PDT) 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 :mime-version:content-transfer-encoding; bh=elQ0qcrtLj23yRuHcP4iQkFYaetay/9RqnWGnNoLGo8=; b=WwdP3nRL+VfvcUuP38UNzmDQu7IFRdu3HRlZjjNcZ9XeAC41Z24rK7S+xCMY6M/zp/ P+bPXlMNQgGDGUTokMXEezvVrV3DVJ7nzCWrSbiocbQ5ZQzZz3MUZPcbaNoTLsaPcm3Y oZB+BPrUrc17AX80piWyR0PvhAjZo9ZHt2nBju5MtGRYPp35o/RxhA4z+Sxtb3p7GHC7 RVlDn2SYgjRAkCEcc/c5AAvIKvUZOinqSoIc0WZ7KyE4YitwSqYMBboSr+HvP4qS2Qps 5maBaW4el1fmqZWpnmc800sNx/jwkmpZQzRATwQo4IfufYj7I6IxJBHFZLfFbTJ4vVHE o6/g== 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:mime-version:content-transfer-encoding; bh=elQ0qcrtLj23yRuHcP4iQkFYaetay/9RqnWGnNoLGo8=; b=ML7ZNQwJMA11NRp/jYn6gupu8aEcBWwmVXLLc9EmqjU/AP5dwA82QPzfDARp2zIj36 91vNq9+YIbEVHdO6GdAtlj25HHYbT333O/RBsVItPa67TFT9x3ta/GT2Kc1TPvwuHcR4 rFrxedXEyAhW9dWBebVRP1TbyIWnV5bNy+SPQMaEtPh3dPBdwcBXoslm+xpLnwv/mRzQ udKuVq9Vw4ja0+0hklblmIQ6/WEHE95aUgAT05xJI39K/tlHt0DHx7Qz3TmyJ5PP5gPG gFBIpz0t2zpo51srR/N00HAVQctQwH2NOuP0pPMY5oScPccdQtqXegJ+03xc5Tc//hua b58w== X-Gm-Message-State: AOAM5303tmM62/wwJMJMkD40nqRRtr3IWou/TcvHbNG67lKnz3daiYez nQh80OvjgjnMqEM08+a1WLROyA== X-Google-Smtp-Source: ABdhPJyWr3A49hhwL3JHGHq0FLYsrWLPnDwiWdm26NyePL1P1skJcLSLHyvPUFgMboqamu2ra0psPw== X-Received: by 2002:a63:6447:: with SMTP id y68mr1874140pgb.395.1589529452585; Fri, 15 May 2020 00:57:32 -0700 (PDT) Received: from localhost ([122.167.130.103]) by smtp.gmail.com with ESMTPSA id x12sm1213258pfq.209.2020.05.15.00.57.31 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 May 2020 00:57:32 -0700 (PDT) From: Viresh Kumar To: k.konieczny@samsung.com, peron.clem@gmail.com, m.szyprowski@samsung.com, Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Rafael Wysocki , broonie@kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] opp: Reorder the code for !target_freq case Date: Fri, 15 May 2020 13:27:20 +0530 Message-Id: X-Mailer: git-send-email 2.25.0.rc1.19.g042ed3e048af In-Reply-To: References: MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Reorder the code a bit to make it more readable. Add additional comment as well. Signed-off-by: Viresh Kumar --- drivers/opp/core.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/opp/core.c b/drivers/opp/core.c index e4f01e7771a2..dda8164fad56 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -817,15 +817,20 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq) } if (unlikely(!target_freq)) { - if (opp_table->required_opp_tables) { - ret = _set_required_opps(dev, opp_table, NULL); - } else if (!_get_opp_count(opp_table)) { + /* + * Some drivers need to support cases where some platforms may + * have OPP table for the device, while others don't and + * opp_set_rate() just needs to behave like clk_set_rate(). + */ + if (!_get_opp_count(opp_table)) return 0; - } else { + + if (!opp_table->required_opp_tables) { dev_err(dev, "target frequency can't be 0\n"); ret = -EINVAL; } + ret = _set_required_opps(dev, opp_table, NULL); goto put_opp_table; }