From patchwork Thu Jul 7 10:03:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abel Vesa X-Patchwork-Id: 12909296 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 5EB10C433EF for ; Thu, 7 Jul 2022 10:03:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235090AbiGGKDp (ORCPT ); Thu, 7 Jul 2022 06:03:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234994AbiGGKDo (ORCPT ); Thu, 7 Jul 2022 06:03:44 -0400 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A597C2C12F for ; Thu, 7 Jul 2022 03:03:41 -0700 (PDT) Received: by mail-wm1-x332.google.com with SMTP id r11-20020a1c440b000000b003a2d053adcbso314131wma.4 for ; Thu, 07 Jul 2022 03:03:41 -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:mime-version :content-transfer-encoding; bh=+l1iL0NEuXMTD9v+9+cJIdeSZBJgkzTvXEeRZPmJDmc=; b=ILohkxWDl/nTQzvdTCs8NkfmN8dgIhtrnAZn0crydzEMid/17eesAXMw1lryR8vUNg dHI1vhLtMVAOnjEYS66sw8Gup4ggYg+CUi5ki4AFxTQ6PiYwpCAAsVzUbXDLHUYIUELv MjNC3X6CyG8utflI11bDVMLJEKs7VPYAX3qji72TYPzL/dVnMe2nGVE+csd/enpKur7I ANBa3Zt68bafqepLiOEsDK1FDotparNMJWyMg4jd3SwvnhdZhdMu1z49pR+JqBtso11p JNndb2Cy1VMsZqu4m4q3+ojhf/3eu/CHbfeTw+Zw4c2NpERB0s5ihjz0LO0HlBmufvY0 jqtg== 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:mime-version :content-transfer-encoding; bh=+l1iL0NEuXMTD9v+9+cJIdeSZBJgkzTvXEeRZPmJDmc=; b=J6PFT8JFx0BVUoyvGidp/buGSu8y4vXOIyegKW97F/Y1cuX8k1I0tfjQ61yTrTdkCs Gqisf+DfIGMw59bctSNF0e93XszvGUfvY4Na1yCdaGux2K94XwR5aIkFeH0tjsyBNmCk /vwvKBi6HQzqNlsLadM1rXe9uMf8P83JKqYyw7gMvXlmcB69QpAYXLzHE0J1z69hrkw6 vG3S8p/yN0LoHxd17VP1CtsuP7aCdkOu/NjnH4zoKdcERXXkUTQrh77P2Hd395gctEEi SvTrj96z9SfAgwhLo8YIf9wevB/DqayuHHmiUrEsGdFhuKjIBMVPq6V2PF+jU/Y87swf nAeQ== X-Gm-Message-State: AJIora+OeDV48RV+EZNxu4E4XUUlq8aPKkR9WpjEUZESv6lP2Ymj2hsh Jiau/R+S9A/9NH1davbCZUhzzQ== X-Google-Smtp-Source: AGRyM1vwP+rjkJ16/oi7CdPdPHtzE/ugfCPc/WqLwUxB+Yb4OogyiysKjo2MWcBXiuhJp86oGRPH5Q== X-Received: by 2002:a05:600c:40d7:b0:3a2:d438:4e33 with SMTP id m23-20020a05600c40d700b003a2d4384e33mr113235wmh.33.1657188220194; Thu, 07 Jul 2022 03:03:40 -0700 (PDT) Received: from localhost.localdomain ([94.52.112.99]) by smtp.gmail.com with ESMTPSA id h14-20020a5d548e000000b0021d7ad6b9fdsm4612034wrv.57.2022.07.07.03.03.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jul 2022 03:03:39 -0700 (PDT) From: Abel Vesa To: Mike Turquette , Stephen Boyd Cc: linux-clk@vger.kernel.org, Linux Kernel Mailing List , linux-arm-msm@vger.kernel.org, Abel Vesa Subject: [RFC PATCH 1/4] clk: Use clk_core_unlink_consumer on __clk_put Date: Thu, 7 Jul 2022 13:03:06 +0300 Message-Id: <20220707100309.1357663-1-abel.vesa@linaro.org> X-Mailer: git-send-email 2.34.3 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org For consistency, use clk_core_unlink_consumer rather then hlist_del directly, on __clk_put. Prepare lock is already acquired at that point. Signed-off-by: Abel Vesa --- drivers/clk/clk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 7fc191c15507..e1d8245866b1 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -4347,7 +4347,7 @@ void __clk_put(struct clk *clk) clk->exclusive_count = 0; } - hlist_del(&clk->clks_node); + clk_core_unlink_consumer(clk); if (clk->min_rate > clk->core->req_rate || clk->max_rate < clk->core->req_rate) clk_core_set_rate_nolock(clk->core, clk->core->req_rate); From patchwork Thu Jul 7 10:03:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abel Vesa X-Patchwork-Id: 12909295 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 013D3CCA480 for ; Thu, 7 Jul 2022 10:03:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235159AbiGGKDq (ORCPT ); Thu, 7 Jul 2022 06:03:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234925AbiGGKDp (ORCPT ); Thu, 7 Jul 2022 06:03:45 -0400 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2845A31369 for ; Thu, 7 Jul 2022 03:03:43 -0700 (PDT) Received: by mail-wm1-x336.google.com with SMTP id n185so10313112wmn.4 for ; Thu, 07 Jul 2022 03:03:43 -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=lyjBxTca7YaObwbb4+mBlqGjkBNtiN/iQI75P0dOoGs=; b=ApylUshkdPMBxowBWdA11FXwyilkLHFoxw2TpZNdWVe7J5wK5WsuGuLdOmNX9zTzk2 B3wObarbyP8uqKLaucFKPH78aop8aE2blu7qAJxjpQV5nQzDxGkC1l+zG1hr57kOGvSH KgIss4NahKugLPEinebU9ajU/LHaVcvDyCz6Z39lpqL29COOaADmWKuLQbdTKSJqi6kP xAXlqSE1KkqV65uWgS3vpW/BlnJWVs4SEftY6DMHJooeFm6vanfThWukfrTHd/9tAGJ8 ZyrjZZbQK11/AxnT17r7KeJLminrUJ2pwTXpmV+7H0bqbmeBHrfZWOcF3ulMGARIhSvh EO+A== 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=lyjBxTca7YaObwbb4+mBlqGjkBNtiN/iQI75P0dOoGs=; b=aD8wwz7IXlmuglvMhmp1HO0eNV5irZ+0w+JLCHx5aDBPs9xQr+a3jPnkNIdJykg1tm HPhItt5nNG++6+jdyCL3Opqf/VJTOGdj6CTMZY0zknOKvk8qFKFEWePwXmaXBtRnOMaz y8BwpxPnYyrOa3VRxkAXhQoLyRvZxEwfVZmecBU+bmI7wqoeEKyXLY8d6Mlh+QuO5NDQ VE6NTaqnvttHBiYehqkgs2VcIuw+ObLTwtGgeBd0m6sV6lhIygNx6dgQIV75PvGg7Q6R zxGTrXFz2aErYp+6eRy5mrOukfxxoJ30RtK6XSAJm4J2guQiy/Ygeq7pLn/SMeFSQ0b5 oUCQ== X-Gm-Message-State: AJIora8q2PXy2u7CyyPuNXlAVBJXD9B8itQ859LCpD2aWN3d1ntk04zc YIxfeGCHjhSHbADte+cRGb+msw== X-Google-Smtp-Source: AGRyM1u9J+vSFg1DqYI+JSf7PHyh8N0GS+NGvJr8GthhXh2mHVh2UqUCCYZ4YWoXz6FbhRB0mk59Xg== X-Received: by 2002:a1c:e902:0:b0:3a0:2d95:49d4 with SMTP id q2-20020a1ce902000000b003a02d9549d4mr3555661wmc.189.1657188221377; Thu, 07 Jul 2022 03:03:41 -0700 (PDT) Received: from localhost.localdomain ([94.52.112.99]) by smtp.gmail.com with ESMTPSA id h14-20020a5d548e000000b0021d7ad6b9fdsm4612034wrv.57.2022.07.07.03.03.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jul 2022 03:03:40 -0700 (PDT) From: Abel Vesa To: Mike Turquette , Stephen Boyd Cc: linux-clk@vger.kernel.org, Linux Kernel Mailing List , linux-arm-msm@vger.kernel.org, Abel Vesa Subject: [RFC PATCH 2/4] clk: Add consumers count to core Date: Thu, 7 Jul 2022 13:03:07 +0300 Message-Id: <20220707100309.1357663-2-abel.vesa@linaro.org> X-Mailer: git-send-email 2.34.3 In-Reply-To: <20220707100309.1357663-1-abel.vesa@linaro.org> References: <20220707100309.1357663-1-abel.vesa@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Keep a count of all consumers per clock. One usage of could be to make core decisions (like disabling unused clocks) based on the number of consumers a clock has. Signed-off-by: Abel Vesa --- drivers/clk/clk.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index e1d8245866b1..9b54afd2fee8 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -72,6 +72,7 @@ struct clk_core { unsigned long flags; bool orphan; bool rpm_enabled; + unsigned int consumers_count; unsigned int enable_count; unsigned int prepare_count; unsigned int protect_count; @@ -3682,6 +3683,9 @@ static int __clk_core_init(struct clk_core *core) core->hw->core = NULL; } + if (!ret) + core->consumers_count = 0; + clk_prepare_unlock(); if (!ret) @@ -3699,6 +3703,7 @@ static void clk_core_link_consumer(struct clk_core *core, struct clk *clk) { clk_prepare_lock(); hlist_add_head(&clk->clks_node, &core->clks); + clk->core->consumers_count++; clk_prepare_unlock(); } @@ -3710,6 +3715,7 @@ static void clk_core_unlink_consumer(struct clk *clk) { lockdep_assert_held(&prepare_lock); hlist_del(&clk->clks_node); + clk->core->consumers_count--; } /** From patchwork Thu Jul 7 10:03:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abel Vesa X-Patchwork-Id: 12909298 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 AFC48CCA485 for ; Thu, 7 Jul 2022 10:03:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234991AbiGGKDs (ORCPT ); Thu, 7 Jul 2022 06:03:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235151AbiGGKDp (ORCPT ); Thu, 7 Jul 2022 06:03:45 -0400 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D70631923 for ; Thu, 7 Jul 2022 03:03:44 -0700 (PDT) Received: by mail-wm1-x330.google.com with SMTP id p4so1022302wms.0 for ; Thu, 07 Jul 2022 03:03:44 -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=ObHspT7PR13k/kGtFBiKTXV8HqbeVaIVVpnAi8PJftA=; b=GWZdkkrngxKv3835VFOOsLNeXYo8jmqMtWNAQnzvrZCrwFx5yifVdE+11NrZqzhcaD sipKBjoB2en+6upT6pL826qJX1xhCBSOoGusgSjlNcEvhNnMCrouEqECTyXEsDLmi5/s Z2nPfc6qNoUecPf2APngELGEFsIMd/gU1XdsjnFgmgZuFLQw1BaqogvfbhNaUBs79IlG sixx1kepX4WCDuccLT15Gr2rzyliVLLy3o/aELBHVXpNYdMkGwboTxUBoh/LRHpRlDjP 7yuo4QfeBWahN3ptBWyMZONEbjxkbq/44bNxeTnZA7FDzDthzINWV258dKIbgoy6swgo Vx5g== 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=ObHspT7PR13k/kGtFBiKTXV8HqbeVaIVVpnAi8PJftA=; b=w+uh0EB3iQ+70CrJKFYkOHBvpCLNzPWuZhcC+GSs2aTugS1OQ7ZNCEkfCzvuGbf7qB OBsifnpcv6xrzeG6YVsJVQitSSAPJJBjZCx+g4tboWd4i4IHbbYuaTyMgFjzwu8u/dR8 n+wNsfAlmQWmNQY7ZzqCgzqI25CIRBgJbIhlI12EJvc41MXxzn+E+sGfIz/WhGV/+eKv Uul5/Eyd/vz23+Bnjs88QMpLF6CyjX/hVkIWVDy5jp9hvfkFFXnXVKug3oGIcifL+8Lw 46XSHjC+fZNHEKMWd7nW6GdwYOWJKTj+HMRDMUDJKZz0AT8hLWQHB+paEtaNMyLjy3Wh 6qZg== X-Gm-Message-State: AJIora+w1jkU8VFxEtgjhryggF1OttFclkA05Yshcr0bZwRhIjGwFkl1 7DvZ6Hxmi+9/ziekZ/0WtIZz/A== X-Google-Smtp-Source: AGRyM1uGAAsPYsQWd2DaNk7kz2NhOZm9UNH91D25W0wEU2lB8IRcrOL+RJDUgzo05SB2rwlxtgrmgw== X-Received: by 2002:a05:600c:4e51:b0:3a0:4e8d:1e44 with SMTP id e17-20020a05600c4e5100b003a04e8d1e44mr3581402wmq.105.1657188222631; Thu, 07 Jul 2022 03:03:42 -0700 (PDT) Received: from localhost.localdomain ([94.52.112.99]) by smtp.gmail.com with ESMTPSA id h14-20020a5d548e000000b0021d7ad6b9fdsm4612034wrv.57.2022.07.07.03.03.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jul 2022 03:03:42 -0700 (PDT) From: Abel Vesa To: Mike Turquette , Stephen Boyd Cc: linux-clk@vger.kernel.org, Linux Kernel Mailing List , linux-arm-msm@vger.kernel.org, Abel Vesa Subject: [RFC PATCH 3/4] clk: Add consumers count information to debugfs Date: Thu, 7 Jul 2022 13:03:08 +0300 Message-Id: <20220707100309.1357663-3-abel.vesa@linaro.org> X-Mailer: git-send-email 2.34.3 In-Reply-To: <20220707100309.1357663-1-abel.vesa@linaro.org> References: <20220707100309.1357663-1-abel.vesa@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Lets add consumers count information to debugfs. It could be useful for identifying which clocks do not have a consumer but are enabled at boot and should be disabled since they are unused. Also you could tell which clocks are marked as critical since they do not have consumers, but their enable_count is non-zero. Signed-off-by: Abel Vesa --- drivers/clk/clk.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 9b54afd2fee8..e412e83a6e28 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -2955,9 +2955,9 @@ static void clk_summary_show_one(struct seq_file *s, struct clk_core *c, { int phase; - seq_printf(s, "%*s%-*s %7d %8d %8d %11lu %10lu ", + seq_printf(s, "%*s%-*s %7d %7d %8d %8d %11lu %10lu ", level * 3 + 1, "", - 30 - level * 3, c->name, + 30 - level * 3, c->name, c->consumers_count, c->enable_count, c->prepare_count, c->protect_count, clk_core_get_rate_recalc(c), clk_core_get_accuracy_recalc(c)); @@ -2996,9 +2996,9 @@ static int clk_summary_show(struct seq_file *s, void *data) struct clk_core *c; struct hlist_head **lists = (struct hlist_head **)s->private; - seq_puts(s, " enable prepare protect duty hardware\n"); - seq_puts(s, " clock count count count rate accuracy phase cycle enable\n"); - seq_puts(s, "-------------------------------------------------------------------------------------------------------\n"); + seq_puts(s, " counsumers enable prepare protect duty hardware\n"); + seq_puts(s, " clock count count count count rate accuracy phase cycle enable\n"); + seq_puts(s, "-------------------------------------------------------------------------------------------------------------------\n"); clk_prepare_lock(); @@ -3021,6 +3021,7 @@ static void clk_dump_one(struct seq_file *s, struct clk_core *c, int level) /* This should be JSON format, i.e. elements separated with a comma */ seq_printf(s, "\"%s\": { ", c->name); + seq_printf(s, "\"consumers_count\": %d,", c->consumers_count); seq_printf(s, "\"enable_count\": %d,", c->enable_count); seq_printf(s, "\"prepare_count\": %d,", c->prepare_count); seq_printf(s, "\"protect_count\": %d,", c->protect_count); @@ -3330,6 +3331,7 @@ static void clk_debug_create_one(struct clk_core *core, struct dentry *pdentry) debugfs_create_u32("clk_phase", 0444, root, &core->phase); debugfs_create_file("clk_flags", 0444, root, core, &clk_flags_fops); debugfs_create_u32("clk_prepare_count", 0444, root, &core->prepare_count); + debugfs_create_u32("clk_consumers_count", 0444, root, &core->consumers_count); debugfs_create_u32("clk_enable_count", 0444, root, &core->enable_count); debugfs_create_u32("clk_protect_count", 0444, root, &core->protect_count); debugfs_create_u32("clk_notifier_count", 0444, root, &core->notifier_count); From patchwork Thu Jul 7 10:03:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abel Vesa X-Patchwork-Id: 12909297 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 41AEACCA482 for ; Thu, 7 Jul 2022 10:03:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235182AbiGGKDr (ORCPT ); Thu, 7 Jul 2022 06:03:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235168AbiGGKDq (ORCPT ); Thu, 7 Jul 2022 06:03:46 -0400 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 412303192D for ; Thu, 7 Jul 2022 03:03:45 -0700 (PDT) Received: by mail-wr1-x42f.google.com with SMTP id v16so14125651wrd.13 for ; Thu, 07 Jul 2022 03:03:45 -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=t0vZOGzWGZ/XO6zAE9EANkv0Ksk8cGK1twtf6zicImM=; b=kznfz8BZq2mc6CDFmmSESwHqfYtxDnIQcY3udHhOo5r4x7ew35us/9p0iWIfwJwKfv FKHSR/kazvJsEtK+ZxxdYyMBQqKz01aiywfvbDtuh8S+551PWf0sNMw1N/eJlVlMQnG8 fn4YijInV79eZvhrTHH/o5crrzrgk1ZLXFWYrPBG+CL5RVRzGGuSfg14/FCbLRZec7dn tYlkSqbyKi6AP+4xr49K/LTyy04hmcDDt6kkkEJFXGy3IdiY/XdW5p1zDgtp8PdwSdGI gTqR/jNliQ1gf99f8/j6WzlNeqPjuYXoxuuAGyNRX7RqmHVpv8gh7eO5UoZytJtNttrq prag== 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=t0vZOGzWGZ/XO6zAE9EANkv0Ksk8cGK1twtf6zicImM=; b=xy+OzgJK6CH6HsI+JC7ZdClxuq07ykEDhnS8A++2M2T2U+H2dfIt8sTUtmC/2dBpZj K+UoLP2jGS1oq0jDKkDmReT1bnBjCNU2thbWA81RaSFYi+hsFHDfF/0biUOH1YMWT5eW h5eASgia6hgaot2IYGrKWg77wr7DLQBIEoQn8jdydgf0ZfM3ISey4yDu8+T6M9GoX/rr kI01DO8/jpsMgU1UVxTYSIcpZXaJqmI850jsK3yhKg38rKxyWJPGDMSyuoQntE3Xp3E/ cOLBSHT5C2eqgFyqhspiQ4p4P5Qmwm87AmlP20PSvUweAXnh+FF4/FlTrvQ/B+dU+EMN Cvhg== X-Gm-Message-State: AJIora8FfYI+zxXjULtQx0hf+FrDXkJi+HxKpQ0HO6QfWMyy7FFZUmai I578VTlNQfsnGq48JRDdWynRyQ== X-Google-Smtp-Source: AGRyM1shZYWd4bEBmVlz7fWpCBjNR12KwTWTJeKuIpR9ErTrkaVkZ5U1PJdsIhR7FR75vPQYLUsd3Q== X-Received: by 2002:a5d:6d06:0:b0:21b:c433:d1f6 with SMTP id e6-20020a5d6d06000000b0021bc433d1f6mr42623372wrq.717.1657188223813; Thu, 07 Jul 2022 03:03:43 -0700 (PDT) Received: from localhost.localdomain ([94.52.112.99]) by smtp.gmail.com with ESMTPSA id h14-20020a5d548e000000b0021d7ad6b9fdsm4612034wrv.57.2022.07.07.03.03.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jul 2022 03:03:43 -0700 (PDT) From: Abel Vesa To: Mike Turquette , Stephen Boyd Cc: linux-clk@vger.kernel.org, Linux Kernel Mailing List , linux-arm-msm@vger.kernel.org, Abel Vesa Subject: [RFC PATCH 4/4] clk: Skip disabling clocks if they have consumers Date: Thu, 7 Jul 2022 13:03:09 +0300 Message-Id: <20220707100309.1357663-4-abel.vesa@linaro.org> X-Mailer: git-send-email 2.34.3 In-Reply-To: <20220707100309.1357663-1-abel.vesa@linaro.org> References: <20220707100309.1357663-1-abel.vesa@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org If a clock has already consumers, it should be considered as used. So clk_disable_unused should leave it as is. Signed-off-by: Abel Vesa --- drivers/clk/clk.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index e412e83a6e28..6cce31ea4f72 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -1228,6 +1228,9 @@ static void __init clk_unprepare_unused_subtree(struct clk_core *core) hlist_for_each_entry(child, &core->children, child_node) clk_unprepare_unused_subtree(child); + if (core->consumers_count) + return; + if (core->prepare_count) return; @@ -1259,6 +1262,9 @@ static void __init clk_disable_unused_subtree(struct clk_core *core) hlist_for_each_entry(child, &core->children, child_node) clk_disable_unused_subtree(child); + if (core->consumers_count) + return; + if (core->flags & CLK_OPS_PARENT_ENABLE) clk_core_prepare_enable(core->parent);