From patchwork Fri Jun 21 06:14:13 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Turquette X-Patchwork-Id: 2760341 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A26AAC0AB1 for ; Fri, 21 Jun 2013 06:16:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BE5202017D for ; Fri, 21 Jun 2013 06:16:27 +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 AF36420174 for ; Fri, 21 Jun 2013 06:16:26 +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 1Upud9-0003u9-9c; Fri, 21 Jun 2013 06:15:31 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Upucv-0000kc-U6; Fri, 21 Jun 2013 06:15:17 +0000 Received: from mail-pb0-x22b.google.com ([2607:f8b0:400e:c01::22b]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UpucX-0000gh-VV for linux-arm-kernel@lists.infradead.org; Fri, 21 Jun 2013 06:14:55 +0000 Received: by mail-pb0-f43.google.com with SMTP id md12so7288960pbc.2 for ; Thu, 20 Jun 2013 23:14:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=GvXv74mlNx9eYVyHLzf52Z9T4mbRnm12ilLz6Clc09k=; b=F/h7F5UHYdd7+o3FVHh9XEkuCAuNYDVckMV7YPaSqqf1ywvxpmljqPMkMa3BQXwiTU pfsjXxEN8qyxuFDf5dC1c27GBH8PMAkZc84WSHFs0samLQdjZ9cBqx1S5/gxnoTYhJoD cjUbjI1thhYaoEjvEIAbaHVzIgM2VtUy1UfCeW3tifVlGmrDkwxsG9SkGR3rr1BKWFPy M8PkWXZHHFrdRUZLwSfjS3cWYStTTgqTkM08HeUQsHSuc+8uTCjKbvMiQyE6UU7JEHbF 7HcQAZpPwo5YGyvgg9B+7de2jeiUOANDT85zZ20FVnuRpx8qIN5+Eswq5TaveimqiIv2 AVkw== X-Received: by 10.66.190.234 with SMTP id gt10mr15018137pac.136.1371795272510; Thu, 20 Jun 2013 23:14:32 -0700 (PDT) Received: from localhost.localdomain (c-50-152-203-145.hsd1.ca.comcast.net. [50.152.203.145]) by mx.google.com with ESMTPSA id tq3sm4250612pab.7.2013.06.20.23.14.30 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 20 Jun 2013 23:14:31 -0700 (PDT) From: Mike Turquette To: linux-kernel@vger.kernel.org Subject: [PATCH v3 2/5] clk: of: helper for determining number of parent clocks Date: Thu, 20 Jun 2013 23:14:13 -0700 Message-Id: <1371795256-16703-3-git-send-email-mturquette@linaro.org> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1371795256-16703-1-git-send-email-mturquette@linaro.org> References: <1371795256-16703-1-git-send-email-mturquette@linaro.org> X-Gm-Message-State: ALoCoQnr0zsb6129b9fYJnMKw5yAk0yifsGXx4s4IRqW8nQQowi/PzNiaT2FY6xcJib7vP8xoXLz X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130621_021454_177280_C6973B70 X-CRM114-Status: UNSURE ( 8.74 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.9 (-) Cc: Mike Turquette , =?UTF-8?q?Heiko=20St=C3=BCbner?= , devicetree-discuss@lists.ozlabs.org, 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=-5.7 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 --- No change since v2 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 edf3fe1..a9feab6 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -2081,6 +2081,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 4920fd1..8730cb9 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -457,6 +457,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);