Received: by 10.223.185.116 with SMTP id b49csp6725341wrg; Wed, 28 Feb 2018 14:29:43 -0800 (PST) X-Google-Smtp-Source: AG47ELtcLjm4xhh9xL9ZcaUV/L5tljuCN8V/I5skUkl3ZgkPLDgJ87LGGQ+ZpCB5E+LCWzUHeK1g X-Received: by 2002:a17:902:2cc1:: with SMTP id n59-v6mr6768679plb.215.1519856983720; Wed, 28 Feb 2018 14:29:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519856983; cv=none; d=google.com; s=arc-20160816; b=LiuXoAHx6KsJPEJa5k11TcAnfNjPHpKygDRf7PUpvzutGJ+oSbuqCfK8Uxwg95VMEx vGL74ilfQtu2Xqsmv+8HQkLPuKoyCcfeKEye8L8XHyuQADAUxzD93jUnObOtvP6InfZh ztjbCPv2YGj5zo0B2iijuglnAdCCgsi8IyqkE2jn225XQGwU6WxbGB4Eb5+8lOkTzU09 wiqTiaoeo8+vPFmZUTHn4a7s7e+DkrX8VavNh1f2iWI8nf6I8agfJNdFmZUYAGW+v0do 9jjAr1df88DLVN/VdK68186bvGE2vRIfoq6+Ya4e2L5CGXAzmiekntLA5JbXEvR/JxKh tBXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature:arc-authentication-results; bh=m3R7UpA99t73i3llaSAHpMMWZhB1ksQPNnpe1kateW8=; b=gpC9ARPZZqozmgSTPYM+S4MJbAEh651TKrDI8MqGoKv7Dd8gpQblA/aaM4Z/t0kGWb th6Y3tGZKqnM+/BYAyR+px6dtwm94tZD1pubKPUHi1DT5pDhWhmDkV6bDPgevxk7ieNN bbN6raukbixYSQJ46/RfOsCpDbRQ1VoIztDVa0QHg/Orf+H2+BQPYIP4Ktu5g/6z0wFm GhuUZQwvjGvy0IsBuBTqAuWFehbv2ZKqEy3sYGpc2vpIyNtllZa8LXm1hEQvpOuwqJU2 w+DHZSB9kZZaxv2FEoSGrpYlceYYWeVm2O14imjW1UVyGdKaQ+m3znzyL7/984uocS+1 gRIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xilinx.onmicrosoft.com header.s=selector1-xilinx-com header.b=3HYOeJul; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u68si1563722pgb.287.2018.02.28.14.29.29; Wed, 28 Feb 2018 14:29:43 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@xilinx.onmicrosoft.com header.s=selector1-xilinx-com header.b=3HYOeJul; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935397AbeB1W2H (ORCPT + 99 others); Wed, 28 Feb 2018 17:28:07 -0500 Received: from mail-cys01nam02on0069.outbound.protection.outlook.com ([104.47.37.69]:31699 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S935301AbeB1W2B (ORCPT ); Wed, 28 Feb 2018 17:28:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector1-xilinx-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=m3R7UpA99t73i3llaSAHpMMWZhB1ksQPNnpe1kateW8=; b=3HYOeJul4SoIU1LTfZO3IPJB/Bn+M9AUuYjkwPsPzpvbiFp92WDHNjF5FGGwuf5jhp8iDRmgcOM0RBT5Cc8KZVbmFIHaqfclXtnfgUIvHMoMEJcJ64M5CBX4L/felKa5+LSx4i1EefUCxji1U+weI5PyBjKMqdIj1H3xYJ7BsXg= Received: from SN4PR0201CA0005.namprd02.prod.outlook.com (2603:10b6:803:2b::15) by SN1PR02MB3821.namprd02.prod.outlook.com (2603:10b6:802:24::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.527.15; Wed, 28 Feb 2018 22:27:58 +0000 Received: from BL2NAM02FT059.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e46::201) by SN4PR0201CA0005.outlook.office365.com (2603:10b6:803:2b::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.527.15 via Frontend Transport; Wed, 28 Feb 2018 22:27:58 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.83 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.83; helo=xsj-pvapsmtpgw01; Received: from xsj-pvapsmtpgw01 (149.199.60.83) by BL2NAM02FT059.mail.protection.outlook.com (10.152.76.247) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.527.18 via Frontend Transport; Wed, 28 Feb 2018 22:27:58 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66] helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw01 with esmtp (Exim 4.63) (envelope-from ) id 1erACb-00055B-Lk; Wed, 28 Feb 2018 14:27:57 -0800 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1erACb-0003jY-K5; Wed, 28 Feb 2018 14:27:57 -0800 Received: from xsj-pvapsmtp01 (mailhub.xilinx.com [149.199.38.66]) by xsj-smtp-dlp2.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id w1SMRnO6010957; Wed, 28 Feb 2018 14:27:49 -0800 Received: from [172.19.2.91] (helo=xsjjollys50.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1erACS-0003hj-Ud; Wed, 28 Feb 2018 14:27:48 -0800 From: Jolly Shah To: , , , , , CC: , , , , Jolly Shah , Jolly Shah , Tejas Patel , Shubhrajyoti Datta Subject: [PATCH 1/3] drivers: clk: Add clk_get_children support Date: Wed, 28 Feb 2018 14:27:39 -0800 Message-ID: <1519856861-31384-2-git-send-email-jollys@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519856861-31384-1-git-send-email-jollys@xilinx.com> References: <1519856861-31384-1-git-send-email-jollys@xilinx.com> X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.2.0.1013-23620.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.83;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(39380400002)(346002)(396003)(39860400002)(376002)(2980300002)(438002)(189003)(199004)(36386004)(16586007)(186003)(9786002)(47776003)(5660300001)(81156014)(81166006)(106466001)(4326008)(8676002)(7696005)(106002)(36756003)(110136005)(54906003)(26005)(50226002)(77096007)(76176011)(107886003)(336011)(8936002)(316002)(63266004)(50466002)(48376002)(2201001)(2950100002)(478600001)(6666003)(72206003)(356003)(2906002)(305945005)(51416003)(107986001);DIR:OUT;SFP:1101;SCL:1;SRVR:SN1PR02MB3821;H:xsj-pvapsmtpgw01;FPR:;SPF:Pass;PTR:unknown-60-83.xilinx.com;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BL2NAM02FT059;1:wZ7CnQbukd2aGhrgRJLCn7WY1al9IBtpgNPf8Lr3r8YkWGFOnjThulbj2GW/ZxbGouZ9DN1ZHPBk3XYHg+G11oFgP+usZnBCtBOQ62MEROneMG06S1PDr85v0PbG/cXx MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 10c5c0da-854d-4143-0280-08d57efa850d X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(4608076)(2017052603307)(7153060);SRVR:SN1PR02MB3821; X-Microsoft-Exchange-Diagnostics: 1;SN1PR02MB3821;3:QJwWvlI50c8A9DtdS4vTOyXSU5Exm+XL9lePpMJTqI/pl5L6VQ+B6wP3/MjxAd1Z8bHYwuQjgXRM3cu8tr15oLGSxwyVhFBilGhpbllDdtNK/WTMPfT6532mOx9r5ufvc+NjCMdYTRUVJfRVnfkB6zRykMAxVS/VsTo2nrXyHAIaOh5hMXZSVEVKYAIZDaqNuGNWJRGKCgjDmzQK6onWymGIapJMO00rE1bAymJegLBPpf77jwtmJ1AhprWrHY6cZ6P2658LNdIAmtS/bgQv7c6aAiBdInhhvMpU52nkiEzjLtEh50viFyXIkYgmehzga2nkGYOg560IWRPiG4TgcqrMObq6ddJvRQ3H0bqtasQ=;25:41GK3q3W47pbOVEn/Gylh09KG+8opN7BJclr+2QDtohRkCepRgpknFJagXp3pu+WXXTXIjVJTlnPU3Dns1retew2Qah7Hkb7orIL727VpRKPiJEUQQAlqxNG0y9HpNA0fsCmewRPC5cLwmcdZbYFemqq7b07itEWgQUg7Po1efN87fcrg5mJGjJmgbCA9mN2PLyiNg5irMWtB2P41VGRT+CgsP63NUn2jmRTeT+iGeXVmKOvGy0cyklXAb68rKNqzU2TuG+h7UcHC2LvbU4lI4et1NwroKSeAf2x05bAo4DLMHw7p/HsJ82GkS0Qs7UwAjhxl3qXuJwFyGvF3SqMVA== X-MS-TrafficTypeDiagnostic: SN1PR02MB3821: X-Microsoft-Exchange-Diagnostics: 1;SN1PR02MB3821;31:3/+hCnr0cG8G6u/ALOF0fazpxNY4Pca3nZUYdXWM9njnpS+0jVd9c7BzFMK5rTeCj75/olvr0C9wZpgf3//ql5FUb/4bsh1fp5Cq9WRWvacIErC5MfGC7LktRp6SJJsqFFgC0Himj3090nFnHCu8T+fgabwBEL2RHXjLQycW6BpTkuKwAM+DZzb3XPX7C9dlyYh9nBSoSBMfE56GBRoPAHzjgUh7JMKBjbOxQOamTMk=;20:1oou2G20lxX7rl/U17qqCoX6Ut8TKoXPRkMoAi/K1OPPXTdPUMZEqFZytcjaJssq7Ul9zdqAecgy7Cm5+wiQQnvCvrV53eY12Z/ArYdAkM3zPaxW/YwUuQe4FEs+de0APGCqkRHDLIxg/KAqcWM5IaT6nsQl93cCiFDbcIqcbH+I96ET84Pv6zhpQ3HwLS8bXCZMzkUZWjJBY2TNM/rE02YfroxMcBw5hJZHH7jKh/4CA4CyLSKBi0MldwQU8e+ATXYvNaDbVC42rKOnq+mtQAL4PU4qDPZRQZcXkhQbFDNC+VMOJDNKdtGcwEKvOVX61iUOU0cnG2yfXLGU+yp6H1eU8u4bJXICp14KRZYHvt+6L1YF3D6PYoVIFVDigjwgJ3gqEAvva85uav8j8xInHH583CKWCktPmF1lAvNnyLdcosR6RQtkDFeGRECzSob633sfqY08LhtiQv0sz2TWRfFqnGfd40Z1S3eMLXdjoYCXpGyfrZDcvQPtmRi/Cc4w X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192813158149592); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040501)(2401047)(5005006)(8121501046)(3002001)(93006095)(93004095)(10201501046)(3231220)(944501161)(52105095)(6055026)(6041288)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123560045)(6072148)(201708071742011);SRVR:SN1PR02MB3821;BCL:0;PCL:0;RULEID:;SRVR:SN1PR02MB3821; X-Microsoft-Exchange-Diagnostics: 1;SN1PR02MB3821;4:foPf1fXPyS4XIWVUb+tP2ZFfkdUzY/L0yizq3swfofqKrWbKfDrqGFcKp4RwGt/zlkZ7BMEutYbCYRNbXjNWZgF0xS8DC1FBzTLg7KdTUCOJoivz6pp5U+T1F4cuXHMTHS83kJ5PVliFK4g45JEViop7Q6qCPe62nXOKkLGq1WDFOgARXpX+HhemOPXoi69I30+KD0RfnDSyIYvwpEcVQ4JnnOVcHYmOMGioR2CWaKylL5AeVEOSVll+nSq6JpXCjDsWZcaETlywTdd8HOvmocQPYR+VH6UI16LyB7GkgjIwBzIimMLNQLtrUzHsepSI X-Forefront-PRVS: 0597911EE1 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;SN1PR02MB3821;23:8Ov2J5GTdOReXhwNiOGyad4MJhSGP1ctTd/YyeFoE?= =?us-ascii?Q?VcCenKsyBfn3tMiTDY1j19CGKhvjLzpFhnqBMoNK4xq7OW8wRcX09lqozuLc?= =?us-ascii?Q?OXpQTwOrkwfbrFfkInZjOQO5/sf2pvZ4fYtVktm2dJqK9IrCFYy9ZmXrCD+a?= =?us-ascii?Q?Ram2mpBS6mEq/yp+hx7v7rbLN2Y1mjvhbVIa9nzSsZeY+6oYd7dyriA5UzeL?= =?us-ascii?Q?kDMXb6NM2+wAbEkA+WGSUexlyUOJhF1BAhuMDvy2xDwjpP/YErmMqCxNgWJi?= =?us-ascii?Q?Jk8W28TKH7Z8K/lR8N8OjSyqid6gFaI366T6B8k054MA3XL3LXZvHQeFLMrf?= =?us-ascii?Q?1jvu9gJFGMjTMNiXEZIKVpvv6OTzPWuV1grF1dkUbRivXB5WSSS2uNJ8MQIf?= =?us-ascii?Q?BBTY3x+t3T9aowOcZJhk2iXNFn4gW2yCtsjvH9rh3o2xDo2hu9rWgcur3974?= =?us-ascii?Q?LJ8io14ZSnMVKjVWh4xnbovYZm6yprNohTg/y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HKspm0jywHlIPYdaID3PnQdyY=;5:yP4xpGPXyYxtDMJN7m4JqxWMK3RxD5/0OzIts7S2SHWoSiUXT4cYQVccecnqunqml1YewIXpiDLp6MsKeWyprcgL4P2+4Se4/Yp0gVTBgqkVjsTw0qPyE40CIF3vd4j9UXWUq1W4dfptrX8E1/CTiyzX42nw42H1N2bfxCq0vgc=;24:a2aDVy80dFShulQj5HKNjADiZ75g9tEvMatSuwZyGxrMAADOwC40goWa2t5bFbCRnIwU/dNngn0w5MjijPk5ls4QcqK1sB/Y9CLW2dhuSYY=;7:MahD7AMil4J2HpIU8L5wvcpd0aGdfp0z98m2m/PEQp1k47kN6/x6MRXSFbQlmzFlLQAasyvGnONtzmWRErkjaBfGuPanVZNzrYvA5HVMlKrHpQuOVzfmTIEFWMQvR5jOuOfe1ApNFKk6P/f0TFYQu48pkPa2D/FwHkI92FxrmheSh+xZM9b6cZEnyJ1ZPB3Es5gR0rnKdJM8p2wabib5PVEN4b1R/Y5PCfrrVNxLegXQP//MTe26++XH49RPWswy SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Feb 2018 22:27:58.0220 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 10c5c0da-854d-4143-0280-08d57efa850d X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.60.83];Helo=[xsj-pvapsmtpgw01] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR02MB3821 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jolly Shah This API helps to determine the users for any clock. Signed-off-by: Jolly Shah Signed-off-by: Tejas Patel Signed-off-by: Shubhrajyoti Datta --- drivers/clk/clk.c | 28 ++++++++++++++++++++++++++++ include/linux/clk-provider.h | 1 + 2 files changed, 29 insertions(+) diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 0f686a9..947a18b 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -274,6 +274,34 @@ struct clk_hw *clk_hw_get_parent(const struct clk_hw *hw) } EXPORT_SYMBOL_GPL(clk_hw_get_parent); +static unsigned int sibling; + +static void clk_show_subtree(struct clk_core *c, + int level) +{ + struct clk_core *child; + + if (!c) + return; + + if (level == 1) + sibling++; + + hlist_for_each_entry(child, &c->children, child_node) + clk_show_subtree(child, level + 1); +} + +unsigned int clk_get_children(char *name) +{ + struct clk_core *core; + struct clk *pclk = __clk_lookup(name); + + sibling = 0; + core = pclk->core; + clk_show_subtree(core, 0); + return sibling; +} + static struct clk_core *__clk_lookup_subtree(const char *name, struct clk_core *core) { diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index f711be6..e94dfb2 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -745,6 +745,7 @@ unsigned int __clk_get_enable_count(struct clk *clk); unsigned long clk_hw_get_rate(const struct clk_hw *hw); unsigned long __clk_get_flags(struct clk *clk); unsigned long clk_hw_get_flags(const struct clk_hw *hw); +unsigned int clk_get_children(char *name); bool clk_hw_is_prepared(const struct clk_hw *hw); bool clk_hw_rate_is_protected(const struct clk_hw *hw); bool clk_hw_is_enabled(const struct clk_hw *hw); -- 2.7.4