From patchwork Mon Jun 17 02:58:22 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Turquette X-Patchwork-Id: 2730201 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 F236EC0AB1 for ; Mon, 17 Jun 2013 03:01:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2CE4820174 for ; Mon, 17 Jun 2013 03:01:13 +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 3589A2016E for ; Mon, 17 Jun 2013 03:01:12 +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 1UoPgA-0003hb-1f; Mon, 17 Jun 2013 03:00:26 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UoPg1-0003IX-Ny; Mon, 17 Jun 2013 03:00:17 +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 1UoPfh-0003EX-NX for linux-arm-kernel@lists.infradead.org; Mon, 17 Jun 2013 02:59:59 +0000 Received: by mail-pd0-f178.google.com with SMTP id w11so2293696pde.9 for ; Sun, 16 Jun 2013 19:59:36 -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=c8GpuqiwkVFPRmPfng+qOAHKhRgyz4mop1EH3s1eoxQ=; b=P7qkxHOODx8LKjPCx+3L6qioZavbGhngLYt8+MVGCEF6DuAVbnMvP9zTSW7cZJfbiP Y669zk8SDMSE5vpZkV9Rlo5AbSUDzN+eco3m1rfavHvWbYZOLgWbFW3ed92QH/uK8dcK ylguMVHXgf/nQgwERD2RBmsg4iVOVNwnvJDx1wu1Nidv1bwg/U+E6R/QS8oDlhpzFEs9 AZcw7DOdYNrV8NzvlTE7OozEpa9wtFeD4dX1xmV3AJpw7gLO8O3a0KoIuDT2zwFyWifh 559BgxuKudmDu7qf4L5X6mpERtP4JClPrxw2NRyr2H8gTTgXQ6zBp7Z3d2MjJpB2nFne xG3w== X-Received: by 10.68.130.42 with SMTP id ob10mr2284495pbb.59.1371437976157; Sun, 16 Jun 2013 19:59:36 -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 vu5sm12836936pab.10.2013.06.16.19.59.34 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 16 Jun 2013 19:59:35 -0700 (PDT) From: Mike Turquette To: linux-kernel@vger.kernel.org Subject: [PATCH v2 2/5] clk: of: helper for determining number of parent clocks Date: Sun, 16 Jun 2013 19:58:22 -0700 Message-Id: <1371437905-15567-3-git-send-email-mturquette@linaro.org> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1371437905-15567-1-git-send-email-mturquette@linaro.org> References: <1371437905-15567-1-git-send-email-mturquette@linaro.org> X-Gm-Message-State: ALoCoQnPSZv0f7zjMKeksoT1BiKprQLoSXAPUZE5Vaw6f+uWG0TB4yjJdKynKdb6Do6UV8aULc2j X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130616_225957_918577_E7EBFC60 X-CRM114-Status: UNSURE ( 8.51 ) 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 , 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.3 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 v1 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);