Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp963280ioo; Thu, 26 May 2022 20:44:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyhmwT3tJdY6IQuM6C1SEEHXOJ5AA5ODFlNhVuBaQCLxectYu4VHWEdvE6I5hvSJumwYC63 X-Received: by 2002:a17:907:78cb:b0:6fe:9ca3:2a9b with SMTP id kv11-20020a17090778cb00b006fe9ca32a9bmr35460053ejc.727.1653623041736; Thu, 26 May 2022 20:44:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653623041; cv=none; d=google.com; s=arc-20160816; b=dGlPyFg9BkMfDN8w1OhWu1t59V7JbF6/LZtn8sREay5KhEC/gH/aItBJLUvgO1dCz0 kvL18XaCUw+xB84RDUGM9lN4n4QhCI8/pde0CznuQ5jlm42Vmp84nhYQ3vY/GawpDx1j Z0NQHXFvfgyfkiLmbjCKCEyOlMeLcxu9WuuQjO1f2P9kSIYKUOGrXlxgfbjqtQMV1trQ 55Ac4zateB6o73WFp/TbyHKzmQRqWY9Wok5od5TugjkjRpstPlcC44K3Yk+RDzgRNovO 3+R4qRVJrN1eTneRS5igxSyDKt4I6QqjxSzECDQqv7w1GmHwsj8hEzxw3ziuSErSAsdm E/vQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=aBl1CC0647PH0W5NTycQQML4b7lHvkQNUHifdM1GDAY=; b=BcPjKWxlhnOeVdX6bDSU8htJPB5jngrMeP1v9ye+g7EgHRVEA+NoznKts7hYvbNq4x IdR4JbLaAxZx2YDRbZlIl2lI7dCJERI0ZG5pSp8qYB8AiuIV8u5/GkzH5pKSsG3npVWw tyvfbuNV8awhIC8r8aPc5+UEU8FQUTisSi87Kka6NXil5rQiASbyjdn/fNEm8TPzbzTN dS1ltFqATHbqzESuOzC1avAp38CYKm7xCNGzgHRtBeHSIezHpzAlFkKVDYz6jEugx8rg KZYJTz8gtwxFTv3vOPtq5viZ7AmYJXiJA27MrmIK8M2wnKNxmZinvd/nyGd2rD/go5ap cqOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XU6kHOyV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m18-20020a056402511200b0042aece2ebf2si4060582edd.276.2022.05.26.20.43.33; Thu, 26 May 2022 20:44:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XU6kHOyV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346381AbiEZLqr (ORCPT + 99 others); Thu, 26 May 2022 07:46:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347403AbiEZLo5 (ORCPT ); Thu, 26 May 2022 07:44:57 -0400 Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66B8AD6834 for ; Thu, 26 May 2022 04:44:48 -0700 (PDT) Received: by mail-pl1-x62f.google.com with SMTP id n18so1228603plg.5 for ; Thu, 26 May 2022 04:44:48 -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=aBl1CC0647PH0W5NTycQQML4b7lHvkQNUHifdM1GDAY=; b=XU6kHOyVAe6IVpqMU7mG7mrqIele38tK/JE36YPUd6201Yvo2CZj62/LV3oLeN+lyO TodZyd/JTrQHXAUhZuHFofbvf9oXBuJQMQxS1BBCR3N9TEQL6FJ00w42/etUQfdvWIk1 NcP6llHTwf0aceT5mdHaijXhyAIQq92uTXX6LlJRliMPc3BwFfdqXxqWBfXm10d45wsG lTEhCwCsMk2e6bCOndjaujvO9dZzzkevXZkke3SC5JIubIhlLpO/iyFPrf1NHverHb0a Qd0UyugsV2QfUrpqNVFJj1cfHiwZ0bl6ImlqwC4KWyVi1E9c+l92441XrvCsnDnaEhEO N/WQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=aBl1CC0647PH0W5NTycQQML4b7lHvkQNUHifdM1GDAY=; b=V5L3hbElbyE1EyhUW4NQlHWaplfRRlhJd46lUs/aYkHdGoov1siq2x6/bu2iLn5dX4 4rDSGIYRszTtbirGYygyxnp02onBcZublGRkr30lM6e0Mu3Rh2l/DVUe0/U9iUB3ycHp Oo1It80a5M2in1vrfMfCLLxUKxhY2jPfPlp54V6FhXn9jYE2hqGgtYjGKLzHrPr4x6gI 9r7dj+NE86Kg1/KPE04ClNR2RWQvMxqxLIXnJcBCwoS8dXr/xEjW9d/sv7rLu2QNB9z+ +r24ZlAJibRcwKU5+v43AatYYxuXq+urkXWgv/XyYDJcMmsS140SdUFZERaRmxsbNj8/ E5NQ== X-Gm-Message-State: AOAM531h/zeB4HG+ptA5EPWglKBRrMyN5QOZZGnqMq6Mosh4vmvY/v2Y ugDAPHupzvAbtl4dazJ3H1eUKA== X-Received: by 2002:a17:902:9b94:b0:161:5a74:aa6c with SMTP id y20-20020a1709029b9400b001615a74aa6cmr36906593plp.108.1653565488042; Thu, 26 May 2022 04:44:48 -0700 (PDT) Received: from localhost ([122.162.234.2]) by smtp.gmail.com with ESMTPSA id br19-20020a17090b0f1300b001d954837197sm3420044pjb.22.2022.05.26.04.44.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 May 2022 04:44:47 -0700 (PDT) From: Viresh Kumar To: Viresh Kumar , Nishanth Menon , Stephen Boyd , "Rafael J. Wysocki" Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Rafael Wysocki , Krzysztof Kozlowski , linux-kernel@vger.kernel.org Subject: [PATCH 26/31] OPP: Remove dev_pm_opp_set_supported_hw() and friends Date: Thu, 26 May 2022 17:12:25 +0530 Message-Id: X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now that everyone has migrated to dev_pm_opp_set_config(), remove the public interface for dev_pm_opp_set_supported_hw() and friends. Signed-off-by: Viresh Kumar --- drivers/opp/core.c | 88 +++++++++++------------------------------- include/linux/pm_opp.h | 19 --------- 2 files changed, 22 insertions(+), 85 deletions(-) diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 9297b5e944f7..07cb8ff33a6d 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -1948,7 +1948,7 @@ int _opp_add_v1(struct opp_table *opp_table, struct device *dev, } /** - * dev_pm_opp_set_supported_hw() - Set supported platforms + * _opp_set_supported_hw() - Set supported platforms * @dev: Device for which supported-hw has to be set. * @versions: Array of hierarchy of versions to match. * @count: Number of elements in the array. @@ -1958,84 +1958,39 @@ int _opp_add_v1(struct opp_table *opp_table, struct device *dev, * OPPs, which are available for those versions, based on its 'opp-supported-hw' * property. */ -struct opp_table *dev_pm_opp_set_supported_hw(struct device *dev, - const u32 *versions, unsigned int count) +static int _opp_set_supported_hw(struct opp_table *opp_table, + const u32 *versions, unsigned int count) { - struct opp_table *opp_table; - - opp_table = _add_opp_table(dev, false); - if (IS_ERR(opp_table)) - return opp_table; - - /* Make sure there are no concurrent readers while updating opp_table */ - WARN_ON(!list_empty(&opp_table->opp_list)); - /* Another CPU that shares the OPP table has set the property ? */ if (opp_table->supported_hw) - return opp_table; + return 0; opp_table->supported_hw = kmemdup(versions, count * sizeof(*versions), GFP_KERNEL); - if (!opp_table->supported_hw) { - dev_pm_opp_put_opp_table(opp_table); - return ERR_PTR(-ENOMEM); - } + if (!opp_table->supported_hw) + return -ENOMEM; opp_table->supported_hw_count = count; - return opp_table; + return 0; } -EXPORT_SYMBOL_GPL(dev_pm_opp_set_supported_hw); /** - * dev_pm_opp_put_supported_hw() - Releases resources blocked for supported hw - * @opp_table: OPP table returned by dev_pm_opp_set_supported_hw(). + * _opp_put_supported_hw() - Releases resources blocked for supported hw + * @opp_table: OPP table returned by _opp_set_supported_hw(). * * This is required only for the V2 bindings, and is called for a matching - * dev_pm_opp_set_supported_hw(). Until this is called, the opp_table structure + * _opp_set_supported_hw(). Until this is called, the opp_table structure * will not be freed. */ -void dev_pm_opp_put_supported_hw(struct opp_table *opp_table) -{ - if (unlikely(!opp_table)) - return; - - kfree(opp_table->supported_hw); - opp_table->supported_hw = NULL; - opp_table->supported_hw_count = 0; - - dev_pm_opp_put_opp_table(opp_table); -} -EXPORT_SYMBOL_GPL(dev_pm_opp_put_supported_hw); - -static void devm_pm_opp_supported_hw_release(void *data) -{ - dev_pm_opp_put_supported_hw(data); -} - -/** - * devm_pm_opp_set_supported_hw() - Set supported platforms - * @dev: Device for which supported-hw has to be set. - * @versions: Array of hierarchy of versions to match. - * @count: Number of elements in the array. - * - * This is a resource-managed variant of dev_pm_opp_set_supported_hw(). - * - * Return: 0 on success and errorno otherwise. - */ -int devm_pm_opp_set_supported_hw(struct device *dev, const u32 *versions, - unsigned int count) +static void _opp_put_supported_hw(struct opp_table *opp_table) { - struct opp_table *opp_table; - - opp_table = dev_pm_opp_set_supported_hw(dev, versions, count); - if (IS_ERR(opp_table)) - return PTR_ERR(opp_table); - - return devm_add_action_or_reset(dev, devm_pm_opp_supported_hw_release, - opp_table); + if (opp_table->supported_hw) { + kfree(opp_table->supported_hw); + opp_table->supported_hw = NULL; + opp_table->supported_hw_count = 0; + } } -EXPORT_SYMBOL_GPL(devm_pm_opp_set_supported_hw); /** * dev_pm_opp_set_prop_name() - Set prop-extn name @@ -2615,10 +2570,12 @@ struct opp_table *dev_pm_opp_set_config(struct device *dev, // Configure supported hardware if (config->supported_hw) { - ret = dev_pm_opp_set_supported_hw(dev, config->supported_hw, - config->supported_hw_count); - if (IS_ERR(ret)) + err = _opp_set_supported_hw(opp_table, config->supported_hw, + config->supported_hw_count); + if (err) { + ret = ERR_PTR(err); goto err; + } } // Configure supplies @@ -2668,8 +2625,7 @@ void dev_pm_opp_clear_config(struct opp_table *opp_table) _opp_put_regulators(opp_table); - if (opp_table->supported_hw) - dev_pm_opp_put_supported_hw(opp_table); + _opp_put_supported_hw(opp_table); if (opp_table->set_opp) dev_pm_opp_unregister_set_opp_helper(opp_table); diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index 11896ebe1fb1..b80982e5a067 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -184,9 +184,6 @@ struct opp_table *dev_pm_opp_set_config(struct device *dev, struct dev_pm_opp_co int devm_pm_opp_set_config(struct device *dev, struct dev_pm_opp_config *config); void dev_pm_opp_clear_config(struct opp_table *opp_table); -struct opp_table *dev_pm_opp_set_supported_hw(struct device *dev, const u32 *versions, unsigned int count); -void dev_pm_opp_put_supported_hw(struct opp_table *opp_table); -int devm_pm_opp_set_supported_hw(struct device *dev, const u32 *versions, unsigned int count); struct opp_table *dev_pm_opp_set_prop_name(struct device *dev, const char *name); void dev_pm_opp_put_prop_name(struct opp_table *opp_table); struct opp_table *dev_pm_opp_set_clkname(struct device *dev, const char *name); @@ -369,22 +366,6 @@ static inline int dev_pm_opp_unregister_notifier(struct device *dev, struct noti return -EOPNOTSUPP; } -static inline struct opp_table *dev_pm_opp_set_supported_hw(struct device *dev, - const u32 *versions, - unsigned int count) -{ - return ERR_PTR(-EOPNOTSUPP); -} - -static inline void dev_pm_opp_put_supported_hw(struct opp_table *opp_table) {} - -static inline int devm_pm_opp_set_supported_hw(struct device *dev, - const u32 *versions, - unsigned int count) -{ - return -EOPNOTSUPP; -} - static inline struct opp_table *dev_pm_opp_register_set_opp_helper(struct device *dev, int (*set_opp)(struct dev_pm_set_opp_data *data)) { -- 2.31.1.272.g89b43f80a514