From patchwork Tue Jul 23 14:46:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 13740160 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0CEF2C3DA63 for ; Tue, 23 Jul 2024 14:48:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=1r6mQjxdA5Ycu1o4JlXvEuFhP6RdDyjqQdXSFbqbnuk=; b=Jt/6zzjPyJuySceF1Rusi1SKD0 nM7gAT1C7IR6029LGgPjiXrpInNief0DmlcBav4ygDHQL5Srpwt77eEJmEjXmHWJqg7QtaUF4d71N sVlbHoPm8tVZ+njzES6pUzEsvkqX1HV6DJgoA9cHK9poaJdaUobT3Ukh1dFQoNiYjYT1K88mNyzdk IyghrVCINheB41ODvxvU+oeJO3LzbVc2gVloBhKAWqsNtYDXO0fULNeFrCIToEmEYeqPoeAO3HFIU HszAM+mE342BERjk0YyD+x5sh8rjyIKNkT8ShcYL5nDMvzjIFqD16F3fY7n5ncf93csAOKtzatXn7 dxaKvyuA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sWGoT-0000000CmPh-0rMf; Tue, 23 Jul 2024 14:48:25 +0000 Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sWGml-0000000ClsB-0wEI for linux-arm-kernel@lists.infradead.org; Tue, 23 Jul 2024 14:46:40 +0000 Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-52efc89dbedso3103670e87.3 for ; Tue, 23 Jul 2024 07:46:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721745998; x=1722350798; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1r6mQjxdA5Ycu1o4JlXvEuFhP6RdDyjqQdXSFbqbnuk=; b=Z/J30OW7yBlczvojFSfLOFUiXd/ZmTt01tYh7/2HYln8vqOuY2XQek13lepDYcON+a DfQk3mn2UJS2wk1fPjs/9Yml8Mmon+Li10q8mZuwXDyb8GL+XVAMXHMmk/yvNPUEJxlx Kg3QBtvA7HMj0ssClk4hcpdzeXK2Dp/QevUQC9DC1DErlY70QJdQdmKTSmtIqVU1ofYw 20nmAMemvPfK2rVcvXBJGauinDIyiBatzaXUdcqFOH/uchrqs3oE3eAsol3dDlPgMblx oLw2AgljqudM+IRQklCCIl1vBeyT6LMvzgVU5hgz1hSOg+Otm+GMlWGwTHJG4JwkC1eC k1DQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721745998; x=1722350798; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1r6mQjxdA5Ycu1o4JlXvEuFhP6RdDyjqQdXSFbqbnuk=; b=V0sZlLJczYOOh2Um6d/0FuuaFTD6rotRpPsvDmWfhgG0ScC0XKtp70NMKq2UAr6SSo aRkZN5gz6ct4mI+2cF2ZFcgrg81ZhbnOdJ/iBPmINLXWbK2KxnByjOUVd3ZXcPPFtBRy VaQ2zN8/v+qwUNkxk6jQw9HPU6pKYXFfMJbs6Gi1r45jQjySyH7eZvFrL/T53YYv4G0t pBYgeRTuJ60C9+Jrt1hn9D/tYggUHb1Zisa9fXscAhRnfSJV9qicXts4LyPLCkxXIYAM uuX33ByGOySJ+kRshh9skbfllh5Ir8/vQNz1i7hmFq0fQsHIKjgR9MbnRrCTNXBQ5FvO 8pzg== X-Forwarded-Encrypted: i=1; AJvYcCW561mKHbrNeREtghxO5kXym44Hxe4FEgoScpJj5j0/ZlzaNjQmCmI+c/3XNoRWLphsgUg6moLKhcR0u3+F3r9xq098ioZA/hqnBGvqN2sci9E8R0A= X-Gm-Message-State: AOJu0YwVEP3m4MNGaNhfR9onyaMb18STpNBjjpllh0fp6B9v2rTwPkQ2 8HZA5DVS7FpdVoMc6awB+JD6eUJsrmssysC73SlRA1cnkPZ/EjI4SkJfMQdPWB0= X-Google-Smtp-Source: AGHT+IF4JXt63g3aJOtD34L0D3D22CnPoBsXJUr8hYUB/3dr0SeT1SQm94wxj0Gjpxn1WXB5Y5YwJw== X-Received: by 2002:a05:6512:1048:b0:52f:c3c9:1691 with SMTP id 2adb3069b0e04-52fc404d27bmr2282609e87.32.1721745997599; Tue, 23 Jul 2024 07:46:37 -0700 (PDT) Received: from uffe-tuxpro14.. (h-178-174-189-39.A498.priv.bahnhof.se. [178.174.189.39]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52f0415eb08sm774540e87.9.2024.07.23.07.46.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jul 2024 07:46:37 -0700 (PDT) From: Ulf Hansson To: Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Bjorn Andersson , Konrad Dybcio , Bryan O'Donoghue , Thierry Reding , Mikko Perttunen , Jonathan Hunter , Ulf Hansson , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/4] OPP: Drop redundant _opp_attach|detach_genpd() Date: Tue, 23 Jul 2024 16:46:10 +0200 Message-Id: <20240723144610.564273-5-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240723144610.564273-1-ulf.hansson@linaro.org> References: <20240723144610.564273-1-ulf.hansson@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240723_074639_473399_E555EF2C X-CRM114-Status: GOOD ( 25.39 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org There no longer any users of _opp_attach|detach_genpd(), hence let's drop it along with the corresponding exported functions. Signed-off-by: Ulf Hansson --- drivers/opp/core.c | 96 +----------------------------------------- drivers/opp/opp.h | 3 +- include/linux/pm_opp.h | 38 +---------------- 3 files changed, 3 insertions(+), 134 deletions(-) diff --git a/drivers/opp/core.c b/drivers/opp/core.c index cad7e84c9ad3..66cac7a1d9db 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -2360,86 +2360,6 @@ static void _opp_put_config_regulators_helper(struct opp_table *opp_table) opp_table->config_regulators = NULL; } -static void _opp_detach_genpd(struct opp_table *opp_table) -{ - int index; - - for (index = 0; index < opp_table->required_opp_count; index++) { - if (!opp_table->required_devs[index]) - continue; - - dev_pm_domain_detach(opp_table->required_devs[index], false); - } -} - -/* - * Multiple generic power domains for a device are supported with the help of - * virtual genpd devices, which are created for each consumer device - genpd - * pair. These are the device structures which are attached to the power domain - * and are required by the OPP core to set the performance state of the genpd. - * The same API also works for the case where single genpd is available and so - * we don't need to support that separately. - * - * This helper will normally be called by the consumer driver of the device - * "dev", as only that has details of the genpd names. - * - * This helper needs to be called once with a list of all genpd to attach. - * Otherwise the original device structure will be used instead by the OPP core. - * - * The order of entries in the names array must match the order in which - * "required-opps" are added in DT. - */ -static int _opp_attach_genpd(struct opp_table *opp_table, struct device *dev, - const char * const *names, struct device ***virt_devs) -{ - struct device *virt_dev; - int index = 0, ret = -EINVAL; - const char * const *name = names; - - if (!opp_table->required_devs) { - dev_err(dev, "Required OPPs not available, can't attach genpd\n"); - return -EINVAL; - } - - /* Genpd core takes care of propagation to parent genpd */ - if (opp_table->is_genpd) { - dev_err(dev, "%s: Operation not supported for genpds\n", __func__); - return -EOPNOTSUPP; - } - - /* Checking only the first one is enough ? */ - if (opp_table->required_devs[0]) - return 0; - - while (*name) { - if (index >= opp_table->required_opp_count) { - dev_err(dev, "Index can't be greater than required-opp-count - 1, %s (%d : %d)\n", - *name, opp_table->required_opp_count, index); - goto err; - } - - virt_dev = dev_pm_domain_attach_by_name(dev, *name); - if (IS_ERR_OR_NULL(virt_dev)) { - ret = virt_dev ? PTR_ERR(virt_dev) : -ENODEV; - dev_err(dev, "Couldn't attach to pm_domain: %d\n", ret); - goto err; - } - - index++; - name++; - } - - if (virt_devs) - *virt_devs = opp_table->required_devs; - - return 0; - -err: - _opp_detach_genpd(opp_table); - return ret; - -} - static int _opp_set_required_dev(struct opp_table *opp_table, struct device *dev, struct device *required_dev, @@ -2516,9 +2436,6 @@ static void _opp_clear_config(struct opp_config_data *data) { if (data->flags & OPP_CONFIG_REQUIRED_DEV) _opp_put_required_dev(data->opp_table, data->index); - else if (data->flags & OPP_CONFIG_GENPD) - _opp_detach_genpd(data->opp_table); - if (data->flags & OPP_CONFIG_REGULATOR) _opp_put_regulators(data->opp_table); if (data->flags & OPP_CONFIG_SUPPORTED_HW) @@ -2630,18 +2547,7 @@ int dev_pm_opp_set_config(struct device *dev, struct dev_pm_opp_config *config) data->flags |= OPP_CONFIG_REGULATOR; } - /* Attach genpds */ - if (config->genpd_names) { - if (config->required_dev) - goto err; - - ret = _opp_attach_genpd(opp_table, dev, config->genpd_names, - config->virt_devs); - if (ret) - goto err; - - data->flags |= OPP_CONFIG_GENPD; - } else if (config->required_dev && config->required_opp_table) { + if (config->required_dev && config->required_opp_table) { ret = _opp_set_required_dev(opp_table, dev, config->required_dev, config->required_opp_table); diff --git a/drivers/opp/opp.h b/drivers/opp/opp.h index 5b5a4bd89c9e..318a4ecbabf1 100644 --- a/drivers/opp/opp.h +++ b/drivers/opp/opp.h @@ -34,8 +34,7 @@ extern struct list_head opp_tables; #define OPP_CONFIG_REGULATOR_HELPER BIT(2) #define OPP_CONFIG_PROP_NAME BIT(3) #define OPP_CONFIG_SUPPORTED_HW BIT(4) -#define OPP_CONFIG_GENPD BIT(5) -#define OPP_CONFIG_REQUIRED_DEV BIT(6) +#define OPP_CONFIG_REQUIRED_DEV BIT(5) /** * struct opp_config_data - data for set config operations diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index 5fade5c4de40..451a7465a605 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -62,11 +62,7 @@ typedef int (*config_clks_t)(struct device *dev, struct opp_table *opp_table, * @supported_hw: Array of hierarchy of versions to match. * @supported_hw_count: Number of elements in the array. * @regulator_names: Array of pointers to the names of the regulator, NULL terminated. - * @genpd_names: Null terminated array of pointers containing names of genpd to - * attach. Mutually exclusive with required_dev. - * @virt_devs: Pointer to return the array of genpd virtual devices. Mutually - * exclusive with required_dev. - * @required_dev: Required OPP device. Mutually exclusive with genpd_names/virt_devs. + * @required_dev: Required OPP device. * @required_opp_table: The corresponding required OPP table for @required_dev. * * This structure contains platform specific OPP configurations for the device. @@ -80,8 +76,6 @@ struct dev_pm_opp_config { const unsigned int *supported_hw; unsigned int supported_hw_count; const char * const *regulator_names; - const char * const *genpd_names; - struct device ***virt_devs; struct device *required_dev; struct opp_table *required_opp_table; }; @@ -677,36 +671,6 @@ static inline void dev_pm_opp_put_config_regulators(int token) dev_pm_opp_clear_config(token); } -/* genpd helpers */ -static inline int dev_pm_opp_attach_genpd(struct device *dev, - const char * const *names, - struct device ***virt_devs) -{ - struct dev_pm_opp_config config = { - .genpd_names = names, - .virt_devs = virt_devs, - }; - - return dev_pm_opp_set_config(dev, &config); -} - -static inline void dev_pm_opp_detach_genpd(int token) -{ - dev_pm_opp_clear_config(token); -} - -static inline int devm_pm_opp_attach_genpd(struct device *dev, - const char * const *names, - struct device ***virt_devs) -{ - struct dev_pm_opp_config config = { - .genpd_names = names, - .virt_devs = virt_devs, - }; - - return devm_pm_opp_set_config(dev, &config); -} - /* prop-name helpers */ static inline int dev_pm_opp_set_prop_name(struct device *dev, const char *name) {