Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1934591ybl; Thu, 29 Aug 2019 00:47:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqwDi33FKWYGH3halFM6/A6jSqu6mpqGvzoZM1NMJAkzseADKKfnEntcBm+wbeKeyLhCEXRZ X-Received: by 2002:aa7:9495:: with SMTP id z21mr9582904pfk.220.1567064866037; Thu, 29 Aug 2019 00:47:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567064866; cv=none; d=google.com; s=arc-20160816; b=cSSgVlpimNTqN6o4u8HuuZPHB3Fhd6H80iO47htUuehHnTxMauU9wjuSkFSoYq9B6x XQlv2D4vD7T2E0M6QYx8xOOaxAhsrIaqoCgQKfaPTiKjs664roSwkg70AkHCTw1bi3fT 6uSrOrGgqCd1m/BVy05FX5UAB28VoREtk7HObURhhmtSA6Mh/OauIvMp9lBXBUNYZDw5 PGv69hLSCE0Yx4Qq/s38ynkjWAqbPEuOp2ITZiBw/eizemznCadzoLaVP8fsfBh89tw6 AO5u4lsLkHWFh51jv7o7vZB7nZpNAOxZQ9ad8Er/v/9rSsbV3DDh7ovz2ralijoxoWOh 2FWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:references :mime-version:message-id:in-reply-to:date:dkim-signature; bh=nhjHwCHt3mcz+mHDiVxN7s8L1KuUZ7MDwDAfLe16I50=; b=z4v/PXXyHvyT0mSfnCMx7Ex1IaFy5xxvnDHaKhuIQM0T87T0j21z90/ZVgDqpBXemI 3kmdbyok0iDMvugbS7bVR0wuEjQ0dx6YOTZMkK6HvYKOuaXR8PKWKlOjSPoKXL/yKmlj r8AYh+GAh57zzjOBsPQB4EB1+L9W3MBghbqNY7u7MEGG0EhxZbcJVCCSWUCW/iZHGZWq 79jXgpaEUy+kKKmAF7vAsSXRScHfKEWP7qMwlD7UiizPeh+kQW9r/85Z0X+SwNnLSIqd jXjJAF0hSgnlDacNBbkQ/4p4teAsP0D5hBL7iJXJrqcHxHA/H3Ya+wxbpqYofG5KiWcj UAHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=G+4eBBbE; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x8si1775694pfj.264.2019.08.29.00.47.30; Thu, 29 Aug 2019 00:47:46 -0700 (PDT) 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=@google.com header.s=20161025 header.b=G+4eBBbE; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728070AbfH2Hqe (ORCPT + 99 others); Thu, 29 Aug 2019 03:46:34 -0400 Received: from mail-pf1-f201.google.com ([209.85.210.201]:56003 "EHLO mail-pf1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728046AbfH2Hqc (ORCPT ); Thu, 29 Aug 2019 03:46:32 -0400 Received: by mail-pf1-f201.google.com with SMTP id 22so1823363pfn.22 for ; Thu, 29 Aug 2019 00:46:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=nhjHwCHt3mcz+mHDiVxN7s8L1KuUZ7MDwDAfLe16I50=; b=G+4eBBbE8eR+JweFO/MTbU/JiiK//ZmQj8k/LyrXbCGTThb38w/Z2lUm+J9+GnNM0R ILZAbYqpRKL7TOIZvfQiUJ2cF39/iD9rfGRzN/JPmUP0imOiTAzvaNMocnkNuQkRpez1 TeFD7m5SShMLKZ99sCn6+3Jk0GWByzZ/IZjTTkJhmHdk/U8KSb8jext129vtnUphdVPK 3Og8DoR1JhhS8QHP8PSei9z2OIoEIJgw7WByG4I5s8EIdtWDrfnC1s2xxQI7P6I0R2oo vZCWREqieybOCkNKb7WgvgWuO6NUQORyGlcpSxF+myfSq3RilEg/tbt3CAbeESXosLmc vLfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=nhjHwCHt3mcz+mHDiVxN7s8L1KuUZ7MDwDAfLe16I50=; b=PS41R+vXS5PIAaGQVvCXaN1rvZ4a60kse2qCcAjjz/C8W/olh+kL2qL2yRswK/kY3m MQJu9op+6F8E6kjPAWjedeShSf5ApIQV3i0CdVgClaRGjcSc8boLN4Ft20zGKoFNtyQ3 DwvEJxv6VApzET+6XvA5rSplgRy2XViXCM72+yFINrEHB6LWpltgzKXz1DhT4R4BdhT1 0h4nIZW2M+zpGhHqD/uoec9B2obLw3Hr6pLmH43c/0wiQHPS7pXKQuSKN6sxQU+KEBk3 x2CLqyvxqnEtSnawUW3cOGguwqRQT0Yiz2XBOQnWvXwBceAz3tYMgSa5Y3QrM/Y/J3yt KbnQ== X-Gm-Message-State: APjAAAUxLRQ2S072tyI7X2TcgyUrJCe80U+6UGncq+/eShwyYK+FCsur Wl1cfbiaWJ+VWSHktoB1kqqjnitgkwF8Q0M= X-Received: by 2002:a65:690f:: with SMTP id s15mr6855732pgq.432.1567064791199; Thu, 29 Aug 2019 00:46:31 -0700 (PDT) Date: Thu, 29 Aug 2019 00:46:03 -0700 In-Reply-To: <20190829074603.70424-1-saravanak@google.com> Message-Id: <20190829074603.70424-8-saravanak@google.com> Mime-Version: 1.0 References: <20190829074603.70424-1-saravanak@google.com> X-Mailer: git-send-email 2.23.0.187.g17f5b7556c-goog Subject: [PATCH v10 7/7] of: property: Add "depends-on" parsing support to of_fwnode_add_links() From: Saravana Kannan To: Rob Herring , Mark Rutland , Greg Kroah-Hartman , "Rafael J. Wysocki" , Frank Rowand , Jonathan Corbet , Len Brown Cc: Saravana Kannan , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-acpi@vger.kernel.org, clang-built-linux@googlegroups.com, David Collins , kernel-team@android.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If dependencies inferred by of_fwnode_add_links() result in a cycle, it can prevent the probing of all the devices in the cycle. The depends-on property has been added to explicitly override inferred dependencies when they create a cycle. Add depends-on parsing support to of_fwnode_add_links() so that platforms with cyclic dependencies can use "depends-on" to break the cycle and continue successfully probing devices. Signed-off-by: Saravana Kannan --- drivers/of/property.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/of/property.c b/drivers/of/property.c index 420c2d428184..78a262e24686 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c @@ -1106,6 +1106,12 @@ static struct device_node *parse_interconnects(struct device_node *np, "#interconnect-cells"); } +static struct device_node *parse_depends_on(struct device_node *np, + const char *prop_name, int index) +{ + return parse_prop_cells(np, prop_name, index, "depends-on", NULL); +} + static int strcmp_suffix(const char *str, const char *suffix) { unsigned int len, suffix_len; @@ -1151,6 +1157,7 @@ static const struct supplier_bindings bindings[] = { { .parse_prop = parse_clocks, }, { .parse_prop = parse_interconnects, }, { .parse_prop = parse_regulators, }, + { .parse_prop = parse_depends_on, }, {}, }; @@ -1203,6 +1210,12 @@ static int __of_link_to_suppliers(struct device *dev, struct property *p; int ret = 0; + if (of_find_property(con_np, "depends-on", NULL)) { + if (of_link_property(dev, con_np, "depends-on")) + ret = -EAGAIN; + return ret; + } + for_each_property_of_node(con_np, p) if (of_link_property(dev, con_np, p->name)) ret = -EAGAIN; -- 2.23.0.187.g17f5b7556c-goog