From patchwork Thu Aug 22 05:53:10 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Turquette X-Patchwork-Id: 2848070 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 650589F239 for ; Thu, 22 Aug 2013 05:55:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8EAB020336 for ; Thu, 22 Aug 2013 05:55:48 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9760720328 for ; Thu, 22 Aug 2013 05:55:47 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VCNrG-0004pF-F3; Thu, 22 Aug 2013 05:54:59 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VCNqt-0005aR-Ho; Thu, 22 Aug 2013 05:54:35 +0000 Received: from mail-pd0-f178.google.com ([209.85.192.178]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VCNqG-0005VH-B6 for linux-arm-kernel@lists.infradead.org; Thu, 22 Aug 2013 05:53:57 +0000 Received: by mail-pd0-f178.google.com with SMTP id w10so1435309pde.37 for ; Wed, 21 Aug 2013 22:53:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=6eu6fPGd20LaZHWcX8/TZaenexhKAKbG8VvNf81KwBw=; b=kA97jEcJpvjgZ072CaKv4Ry9a9qFLq3ZdOLUvbio9aRqmj0oXZgcENTTRtxXGE9URr 0uS+fUSO+23/A0jayEmqjlccUdOLH+gowo8zFBSVPlc0PjIW0Vm9iOdEmmq+qmr+BKF7 HDFC7h6p/qAz/EQsy9T9bRKFVlnBv7xjGb9tcPE7UWVAnuYnTR6UNTp1zme6actRHnK4 pUVcKaXDuB+szrWPlhFYhsmMCUuCsn2HSgi+9jjEGMcl30LKzAjO0+y7RT/JelL0OMdq ZpAb1EEDtIV12iiQkuBe9pQBbQdMrpWBBnvYGRnFmmnunI5mneTQYE8IBi6U0/F0at7U 6Hpg== X-Gm-Message-State: ALoCoQkNIiqcMsv2cgsjjuTChb3cnuL6uGPNVyxRgNodUD2pJmpF0x/NV+94shQBEfKdLpG/0vSq X-Received: by 10.66.139.8 with SMTP id qu8mr3578056pab.94.1377150805770; Wed, 21 Aug 2013 22:53:25 -0700 (PDT) Received: from localhost.localdomain (c-174-62-77-112.hsd1.ca.comcast.net. [174.62.77.112]) by mx.google.com with ESMTPSA id zq10sm14362680pab.6.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 21 Aug 2013 22:53:24 -0700 (PDT) From: Mike Turquette To: linux-kernel@vger.kernel.org Subject: [PATCH v4 2/5] clk: of: helper for determining number of parent clocks Date: Wed, 21 Aug 2013 22:53:10 -0700 Message-Id: <1377150793-27864-3-git-send-email-mturquette@linaro.org> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1377150793-27864-1-git-send-email-mturquette@linaro.org> References: <1377150793-27864-1-git-send-email-mturquette@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130822_015356_571414_42EFC42E X-CRM114-Status: UNSURE ( 8.54 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.9 (-) Cc: devicetree@vger.kernel.org, Mike Turquette , =?UTF-8?q?Heiko=20St=C3=BCbner?= , Stephen Boyd , Tero Kristo , Haojian Zhuang , Matt Sealey , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Walks the "clocks" array of parent clock phandles and returns the number. Signed-off-by: Mike Turquette Tested-by: Heiko Stuebner Reviewed-by: Heiko Stuebner --- No change since v3 drivers/clk/clk.c | 6 ++++++ include/linux/clk-provider.h | 1 + 2 files changed, 7 insertions(+) diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index bc02037..2655882 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -2189,6 +2189,12 @@ struct clk *of_clk_get_from_provider(struct of_phandle_args *clkspec) return clk; } +int of_clk_get_parent_count(struct device_node *np) +{ + return of_count_phandle_with_args(np, "clocks", "#clock-cells"); +} +EXPORT_SYMBOL_GPL(of_clk_get_parent_count); + const char *of_clk_get_parent_name(struct device_node *np, int index) { struct of_phandle_args clkspec; diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 015f18c..5497739 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -471,6 +471,7 @@ void of_clk_del_provider(struct device_node *np); struct clk *of_clk_src_simple_get(struct of_phandle_args *clkspec, void *data); struct clk *of_clk_src_onecell_get(struct of_phandle_args *clkspec, void *data); +int of_clk_get_parent_count(struct device_node *np); const char *of_clk_get_parent_name(struct device_node *np, int index); void of_clk_init(const struct of_device_id *matches);