From patchwork Thu Sep 2 10:16:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 505733 Delivered-To: patches@linaro.org Received: by 2002:a02:8629:0:0:0:0:0 with SMTP id e38csp1078660jai; Thu, 2 Sep 2021 03:16:41 -0700 (PDT) X-Received: by 2002:a05:651c:4c7:: with SMTP id e7mr1880390lji.438.1630577801112; Thu, 02 Sep 2021 03:16:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630577801; cv=none; d=google.com; s=arc-20160816; b=RhO14mTI7CC0FrXb+oOiZaqsywQzsAqrYgEoFVma8EAiLOd81piT4mHarFcpmWy0wa STrprRwGP/CF6MMVtK5O9ArdT5I0xwh+IkDjQ1QsnfxHYloj7IEX8Iox4LYPlIDgNGM5 W2sh/HNaIN+nTSkTcG7aceCCJtrpq40T93Rs7iMlq5tBMnvQnyDxdbIGgNfLZEsKhqA4 MuqX5hakeOqc3zYw35YcfOfWhWFK1TdIcLTwbcGIfftT8eZHoWalMzCPmnLqQP41obFg oKI21i7Qxhu8fGflFxD0zsnW/U7eEaoj09WG7EEPXUtHsVah6g45ekhM2bt+9/lLyWpe AuTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=XZIDc5dNGmZMEuNI+q0RXZg7TDaDyQay2EJwpX2HagA=; b=y7xqWqiz4FSGy3TSoOX3zM8brirIx6GJt9aMJXdhfQ8TTfajK9j5A5YsHVlWqn/JSv m9/EGt2DHWFI8qL+DF1oAhVvkJAp1ruBKT5onxsl6wQtLU6dnJEHZ/Ij2d1FSxolPXDN 0+nyI0Wa138IPH4DAa+Bj1hOlj+ihfQimRs7kqe8OTFiOqACAHhkrh7Umj0IrMgs4IE2 MK6vg0c6wt9sod3fyhiFT7iveAVbARnF7ixxQPB0qBg8aUD0Ffkau/5Z9j5gG5Gqy0+h xzQO44zXo/pIPn5coT11QFmZQ4Zmi+opt+Gva9Q3Vav3Q5Pan6JAwfCaT3aFxnGx7ste zA7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tJEyqv27; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.41 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id v19sor745089ljg.25.2021.09.02.03.16.40 for (Google Transport Security); Thu, 02 Sep 2021 03:16:41 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tJEyqv27; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.41 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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=XZIDc5dNGmZMEuNI+q0RXZg7TDaDyQay2EJwpX2HagA=; b=tJEyqv27c0M36cBiuxle+CZcejlnP42BqHYMsy3HH6riiEJsG+YpXDhRCks2ozu/0a YuXG3Fxzldz55lhNT71K7+qRshz8IyqqVyz2HmYf9jTDKw0jCy3PgRM96IBxbT8uJCDb FQVEoXVjv2YkFdPzs8JyfoTvs9cqJ3lQ7T21yNoEulElXLMqg5O1cNT1JvuikDEN+XGW hmX8t8qOEAbSrLsXUqtGNgo0+zISQLbbiCO2S5f/X3qavwykZZwIrxOhKUcfqe0n/Ljl YUMPiD+oIuf656o4snFxWRQSvao9oyutvr3Jb/HwWKASY4i/vU8L9O3bhDBhVe6+oxeF IdBg== 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=XZIDc5dNGmZMEuNI+q0RXZg7TDaDyQay2EJwpX2HagA=; b=ufn9yKnmPpCliZXKBhcVYKKJ58UD5/MYRjb1QtkYH6A4uXWeyIKQ8xQz7Gyc0/ewCA R7qo4tk97kpPd4XMJs3fFrEPyQrWrxBFXUJ6Qxk3vpw08aEKOrmj8iFkhfsnYUyM9dJM xv1oRhM4xwh8GAr109JZT52XCUmqW9ZVXoUY7nYq7TIBeG/7pCERatr4hwbwv0PIjNLf LtpgtKIbap+mCvSLwlcgDRd+vSI8M08I3M2FrWAlGUYUE4VyKz3T206rj/rzO6i9LGqI P10cvDFIUS49d6gDV4aZpsHLDO68M3U7npDcYbJlGatdP7AI02NVwDXsgBtRByMD0sAh smEg== X-Gm-Message-State: AOAM5313E/W2bDgBgxqVRiIe5bw9rhwFSTi3ViI/PwNmnXi5gI33x47M LFPDRRgeVAUf1sRAOYMziz8BbtVU X-Google-Smtp-Source: ABdhPJzNXuvX9XDTeaJ02yQt2BdTC2X0ZlUZgbJYnh+m6n9auTpgMAN6FyCEd7d8q4RZ8DQBiAQ5Aw== X-Received: by 2002:a2e:b53a:: with SMTP id z26mr1803113ljm.95.1630577800779; Thu, 02 Sep 2021 03:16:40 -0700 (PDT) Return-Path: Received: from localhost.localdomain (h-155-4-129-146.NA.cust.bahnhof.se. [155.4.129.146]) by smtp.gmail.com with ESMTPSA id s4sm155897lfd.53.2021.09.02.03.16.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Sep 2021 03:16:39 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , Viresh Kumar , Dmitry Osipenko , linux-pm@vger.kernel.org Cc: Dmitry Baryshkov , Jonathan Hunter , Thierry Reding , Rajendra Nayak , Stephan Gerhold , Bjorn Andersson , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Ulf Hansson Subject: [PATCH 2/3] PM: domains: Restructure some code in __genpd_dev_pm_attach() Date: Thu, 2 Sep 2021 12:16:33 +0200 Message-Id: <20210902101634.827187-3-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210902101634.827187-1-ulf.hansson@linaro.org> References: <20210902101634.827187-1-ulf.hansson@linaro.org> MIME-Version: 1.0 To slightly improve readability of the code, but also to prepare for a subsequent change on top, let's move the code that calls of_get_required_opp_performance_state() into a new separate function. Signed-off-by: Ulf Hansson --- drivers/base/power/domain.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) -- 2.25.1 diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 278e040f607f..800adf831cae 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -2640,6 +2640,17 @@ static void genpd_dev_pm_sync(struct device *dev) genpd_queue_power_off_work(pd); } +static int genpd_get_default_performance_state(struct device *dev, + unsigned int index) +{ + int pstate = of_get_required_opp_performance_state(dev->of_node, index); + + if (pstate == -ENODEV || pstate == -EOPNOTSUPP) + return 0; + + return pstate; +} + static int __genpd_dev_pm_attach(struct device *dev, struct device *base_dev, unsigned int index, bool power_on) { @@ -2690,8 +2701,8 @@ static int __genpd_dev_pm_attach(struct device *dev, struct device *base_dev, } /* Set the default performance state */ - pstate = of_get_required_opp_performance_state(dev->of_node, index); - if (pstate < 0 && pstate != -ENODEV && pstate != -EOPNOTSUPP) { + pstate = genpd_get_default_performance_state(dev, index); + if (pstate < 0) { ret = pstate; goto err; } else if (pstate > 0) {