From patchwork Thu May 26 11:42:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 576408 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3E679C433EF for ; Thu, 26 May 2022 11:46:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344449AbiEZLqC (ORCPT ); Thu, 26 May 2022 07:46:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344666AbiEZLo6 (ORCPT ); Thu, 26 May 2022 07:44:58 -0400 Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 102BBD808F for ; Thu, 26 May 2022 04:44:52 -0700 (PDT) Received: by mail-pg1-x536.google.com with SMTP id c22so1176295pgu.2 for ; Thu, 26 May 2022 04:44:52 -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=gAxtECM05PzG/Tji4CAVaBCkNnxvwBxiF1rKgSbAS7k=; b=IjQikfoaO7L/MsZ9JQx/BST3wDHalycaIFjh7JZMnim1nvhyRMqMCOKENl+sdy0fo8 BRDbsF6yLDdx7IZid3mbTMxB8kRqmFW+vKiwa3Wm3uFWjiy3QURC7rfiP8+mhijN/gq0 iuDDSX544E5hxNx7Q6Pv3NVMWYX3IUExUwxmt9fd6fE9GmcZgIPZ9jV6dJzWcNir2ikH aut7Dgsm/FL3RPvEkZAY1GfJeT0Ury7eGcIGjh5zM345Zmzv0AwLL2FhWCHqobE3IBVj 8qcEtqVxELs0mm0xvc+rb6NvXy70Ox+4wZ1OJCG+a8Pp7otfDtjdyBi0Hs0TrDT7dBEV zYJA== 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=gAxtECM05PzG/Tji4CAVaBCkNnxvwBxiF1rKgSbAS7k=; b=7XtOUoU45uxJncGGwOUm2MJF7KgYFfRoXjEk0EAswizEUsvsAtuvuzwJYcVNROd6sh twYF2D0WkNNmCL2X+iGQxjh8oystwNq5nntmaR9cOuvpw667r4ZUarvN7whDbf+CLtEi NNAsFn2uZZVGRanD6fN9MrqIPN6HVz1sAqfLqEzLE4oKboebDAEq2C/0Ua24GFmcpkzZ tIHE2j5t/48Fhz3ooUS4I8UDlm0me/lyDA/+05WrlvAUdpP5QJPPcWPPGbfjHEPhbSeL L3Ef/EnOtoYTVs68/0Pws3T0UX1Ll4bYpkncVSChzZzb//OQ6XIP15baDWHGGd3S4tvz lN4w== X-Gm-Message-State: AOAM532CrOMMDppMG/rtJSx/CPXvI7ZUjq7bgBDs7BLCWDle7yWd3quH jmCBj+l03SfIdPdu3BP0MDmutw== X-Google-Smtp-Source: ABdhPJzWLutPUzX6PUXXIQ+ONdk7t8pldnwM+fEQ3bXC4gZ/bxFrAIy/sLqyWwcbQFrAIIOKbkgMeQ== X-Received: by 2002:a65:63c4:0:b0:3f6:3a63:3148 with SMTP id n4-20020a6563c4000000b003f63a633148mr30750750pgv.33.1653565491496; Thu, 26 May 2022 04:44:51 -0700 (PDT) Received: from localhost ([122.162.234.2]) by smtp.gmail.com with ESMTPSA id mm12-20020a17090b358c00b001cd4989ff62sm1270324pjb.41.2022.05.26.04.44.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 May 2022 04:44:51 -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 27/31] OPP: Remove dev_pm_opp_set_clkname() and friends Date: Thu, 26 May 2022 17:12:26 +0530 Message-Id: <8b51e3f21c469472f2dbe43fef8963b911fde135.1653564321.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Now that everyone has migrated to dev_pm_opp_set_config(), remove the public interface for dev_pm_opp_set_clkname() and friends. Signed-off-by: Viresh Kumar --- drivers/opp/core.c | 93 ++++++++++-------------------------------- include/linux/pm_opp.h | 15 ------- 2 files changed, 21 insertions(+), 87 deletions(-) diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 07cb8ff33a6d..c2590c0c05a0 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -2152,7 +2152,7 @@ static void _opp_put_regulators(struct opp_table *opp_table) } /** - * dev_pm_opp_set_clkname() - Set clk name for the device + * _opp_set_clkname() - Set clk name for the device * @dev: Device for which clk name is being set. * @name: Clk name. * @@ -2163,93 +2163,41 @@ static void _opp_put_regulators(struct opp_table *opp_table) * * This must be called before any OPPs are initialized for the device. */ -struct opp_table *dev_pm_opp_set_clkname(struct device *dev, const char *name) +static int _opp_set_clkname(struct opp_table *opp_table, struct device *dev, + const char *name) { - struct opp_table *opp_table; - int ret; - - opp_table = _add_opp_table(dev, false); - if (IS_ERR(opp_table)) - return opp_table; - - /* This should be called before OPPs are initialized */ - if (WARN_ON(!list_empty(&opp_table->opp_list))) { - ret = -EBUSY; - goto err; - } - /* Another CPU that shares the OPP table has set the clkname ? */ if (opp_table->clk_configured) - return opp_table; + return 0; /* clk shouldn't be initialized at this point */ - if (WARN_ON(opp_table->clk)) { - ret = -EBUSY; - goto err; - } + if (WARN_ON(opp_table->clk)) + return -EBUSY; /* Find clk for the device */ opp_table->clk = clk_get(dev, name); if (IS_ERR(opp_table->clk)) { - ret = dev_err_probe(dev, PTR_ERR(opp_table->clk), + return dev_err_probe(dev, PTR_ERR(opp_table->clk), "%s: Couldn't find clock\n", __func__); - goto err; } opp_table->clk_configured = true; - return opp_table; - -err: - dev_pm_opp_put_opp_table(opp_table); - - return ERR_PTR(ret); -} -EXPORT_SYMBOL_GPL(dev_pm_opp_set_clkname); - -/** - * dev_pm_opp_put_clkname() - Releases resources blocked for clk. - * @opp_table: OPP table returned from dev_pm_opp_set_clkname(). - */ -void dev_pm_opp_put_clkname(struct opp_table *opp_table) -{ - if (unlikely(!opp_table)) - return; - - clk_put(opp_table->clk); - opp_table->clk = ERR_PTR(-EINVAL); - opp_table->clk_configured = false; - - dev_pm_opp_put_opp_table(opp_table); -} -EXPORT_SYMBOL_GPL(dev_pm_opp_put_clkname); - -static void devm_pm_opp_clkname_release(void *data) -{ - dev_pm_opp_put_clkname(data); + return 0; } /** - * devm_pm_opp_set_clkname() - Set clk name for the device - * @dev: Device for which clk name is being set. - * @name: Clk name. - * - * This is a resource-managed variant of dev_pm_opp_set_clkname(). - * - * Return: 0 on success and errorno otherwise. + * _opp_put_clkname() - Releases resources blocked for clk. + * @opp_table: OPP table returned from _opp_set_clkname(). */ -int devm_pm_opp_set_clkname(struct device *dev, const char *name) +static void _opp_put_clkname(struct opp_table *opp_table) { - struct opp_table *opp_table; - - opp_table = dev_pm_opp_set_clkname(dev, name); - if (IS_ERR(opp_table)) - return PTR_ERR(opp_table); - - return devm_add_action_or_reset(dev, devm_pm_opp_clkname_release, - opp_table); + if (opp_table->clk_configured) { + clk_put(opp_table->clk); + opp_table->clk = ERR_PTR(-EINVAL); + opp_table->clk_configured = false; + } } -EXPORT_SYMBOL_GPL(devm_pm_opp_set_clkname); /** * dev_pm_opp_register_set_opp_helper() - Register custom set OPP helper @@ -2549,9 +2497,11 @@ struct opp_table *dev_pm_opp_set_config(struct device *dev, // Configure clock if (config->clk_name) { - ret = dev_pm_opp_set_clkname(dev, config->clk_name); - if (IS_ERR(ret)) + err = _opp_set_clkname(opp_table, dev, config->clk_name); + if (err) { + ret = ERR_PTR(err); goto err; + } } // Configure property names @@ -2633,8 +2583,7 @@ void dev_pm_opp_clear_config(struct opp_table *opp_table) if (opp_table->prop_name) dev_pm_opp_put_prop_name(opp_table); - if (opp_table->clk_configured) - dev_pm_opp_put_clkname(opp_table); + _opp_put_clkname(opp_table); dev_pm_opp_put_opp_table(opp_table); } diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index b80982e5a067..7afa8160590d 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -186,9 +186,6 @@ void dev_pm_opp_clear_config(struct opp_table *opp_table); 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); -void dev_pm_opp_put_clkname(struct opp_table *opp_table); -int devm_pm_opp_set_clkname(struct device *dev, const char *name); struct opp_table *dev_pm_opp_register_set_opp_helper(struct device *dev, int (*set_opp)(struct dev_pm_set_opp_data *data)); void dev_pm_opp_unregister_set_opp_helper(struct opp_table *opp_table); int devm_pm_opp_register_set_opp_helper(struct device *dev, int (*set_opp)(struct dev_pm_set_opp_data *data)); @@ -387,18 +384,6 @@ static inline struct opp_table *dev_pm_opp_set_prop_name(struct device *dev, con static inline void dev_pm_opp_put_prop_name(struct opp_table *opp_table) {} -static inline struct opp_table *dev_pm_opp_set_clkname(struct device *dev, const char *name) -{ - return ERR_PTR(-EOPNOTSUPP); -} - -static inline void dev_pm_opp_put_clkname(struct opp_table *opp_table) {} - -static inline int devm_pm_opp_set_clkname(struct device *dev, const char *name) -{ - return -EOPNOTSUPP; -} - static inline struct opp_table *dev_pm_opp_attach_genpd(struct device *dev, const char * const *names, struct device ***virt_devs) { return ERR_PTR(-EOPNOTSUPP);