From patchwork Wed Feb 5 09:48:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris BREZILLON X-Patchwork-Id: 3585391 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 B1FFDC02DC for ; Wed, 5 Feb 2014 09:49:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E411C201B6 for ; Wed, 5 Feb 2014 09:49:01 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 91E42200F4 for ; Wed, 5 Feb 2014 09:49:00 +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 1WAz69-0003fz-UP; Wed, 05 Feb 2014 09:48:50 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WAz67-00058X-Iv; Wed, 05 Feb 2014 09:48:47 +0000 Received: from 2.mo3.mail-out.ovh.net ([46.105.75.36] helo=mo3.mail-out.ovh.net) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WAz64-00058A-4S for linux-arm-kernel@lists.infradead.org; Wed, 05 Feb 2014 09:48:45 +0000 Received: from mail628.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo3.mail-out.ovh.net (Postfix) with SMTP id 0C7731024161 for ; Wed, 5 Feb 2014 10:48:22 +0100 (CET) Received: from b0.ovh.net (HELO queueout) (213.186.33.50) by b0.ovh.net with SMTP; 5 Feb 2014 11:48:30 +0200 Received: from unknown (HELO bbrezillon-laptop.int.overkiz.com) (b.brezillon@overkiz.com@80.245.18.66) by ns0.ovh.net with SMTP; 5 Feb 2014 11:48:24 +0200 From: Boris BREZILLON To: Gregory CLEMENT , Mike Turquette Subject: [PATCH] clk: add strict of_clk_init dependency check Date: Wed, 5 Feb 2014 10:48:00 +0100 Message-Id: <1391593680-9388-1-git-send-email-b.brezillon@overkiz.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1391554766-11285-1-git-send-email-gregory.clement@free-electrons.com> References: <1391554766-11285-1-git-send-email-gregory.clement@free-electrons.com> X-Ovh-Tracer-Id: 638948197669763073 X-Ovh-Remote: 80.245.18.66 () X-Ovh-Local: 213.186.33.20 (ns0.ovh.net) X-OVH-SPAMSTATE: OK X-OVH-SPAMSCORE: -100 X-OVH-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeejtddrjedvucetufdoteggodetrfcurfhrohhfihhlvgemucfqggfjnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd X-Spam-Check: DONE|U 0.500029/N X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeejtddrjedvucetufdoteggodetrfcurfhrohhfihhlvgemucfqggfjnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140205_044844_338625_EB5159FC X-CRM114-Status: GOOD ( 17.33 ) X-Spam-Score: -1.9 (-) Cc: Thomas Petazzoni , Andrew Lunn , Jason Cooper , linux-kernel@vger.kernel.org, Boris BREZILLON , Ezequiel Garcia , linux-arm-kernel@lists.infradead.org, Sebastian Hesselbarth 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=-4.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 The parent dependency check is only available on the first parent of a given clk. Add support for strict dependency check: all parents of a given clk must be initialized. Signed-off-by: Boris BREZILLON --- Hello Gregory, This patch adds support for strict check on clk dependencies (check if all parents specified by an DT clk node are initialized). I'm not sure this is what you were expecting (maybe testing the first parent is what you really want), so please feel free to tell me if I'm wrong. Best Regards, Boris drivers/clk/clk.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index beb0f8b..6849769 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -2543,22 +2543,37 @@ static int parent_ready(struct device_node *np) { struct of_phandle_args clkspec; struct of_clk_provider *provider; + int num_parents; + bool found; + int i; /* * If there is no clock parent, no need to wait for them, then * we can consider their absence as being ready */ - if (of_parse_phandle_with_args(np, "clocks", "#clock-cells", 0, - &clkspec)) + num_parents = of_count_phandle_with_args(np, "clocks", "#clock-cells"); + if (num_parents <= 0) return 1; - /* Check if we have such a provider in our array */ - list_for_each_entry(provider, &of_clk_providers, link) { - if (provider->node == clkspec.np) + for (i = 0; i < num_parents; i++) { + if (of_parse_phandle_with_args(np, "clocks", "#clock-cells", i, + &clkspec)) return 1; + + /* Check if we have such a provider in our array */ + found = false; + list_for_each_entry(provider, &of_clk_providers, link) { + if (provider->node == clkspec.np) { + found = true; + break; + } + } + + if (!found) + return 0; } - return 0; + return 1; } /**