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: 588992 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);