From patchwork Mon Feb 12 21:31:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saravana Kannan X-Patchwork-Id: 200044 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp179160dyb; Mon, 12 Feb 2024 13:33:19 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXOoWWE1nXBfUqN0VhJaKbXEQt2Tljp5NRrtY0NR48SUoMS7MP/KoJaR9dggmX1ED2+321tEfKnlSC7NeapvfswgFigbA== X-Google-Smtp-Source: AGHT+IGmkJX5Mffhk2QpY2AGUT5UGT3CTQNh2yXfbp4T+CCNyX33khi3n2yVjb7kwLlb6jWTzT5o X-Received: by 2002:a05:6512:b8f:b0:511:7b11:9b9c with SMTP id b15-20020a0565120b8f00b005117b119b9cmr7253107lfv.4.1707773599059; Mon, 12 Feb 2024 13:33:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707773599; cv=pass; d=google.com; s=arc-20160816; b=xVSXrqZQOO+ccxJXVwVsX3fpO0gMC/cGzyjVY7brYF+6HIHfNQ8oD92YTaM681Ba88 fsY1ftBdtBvJJA3/JCuxGBLPchuKjjLdR96Xzh81NEWlSRB+Yw+O4tX3JUk1ACo3vQ9i rZpq/iVN98koyljpzSeDMmmStajtWfSOyeqGJnGKISH4l27lhxCbR8x/EXnfzhEV28Hk CR6lMfNAkCAWkSX2PDhBMYfqaskbfF27AisdFmSKs85KL3KmDlwGcMubLGfapqNh+3Fb n4Ekzh0S6RtKZth+cvvTS7xj2lp75LJOeT2Xt5hqHC+YWbdui4+uuF67OlYW+suE0mUf Sn0A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:references:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:in-reply-to:date :dkim-signature; bh=F5s7UC2LI5606ztlkySRh4zEDw9ZNIX2+7Suzh+XsVU=; fh=adgZf38vUF1hjhLf/GKaR34JDGVXAQk3yEcx7iZDFCY=; b=0rrcpbk9lcjsf/7TxRAbVYfVBYi1IkG41Pw5ZsAGzfA8CNMb2RDlq7W2rbI/BkY6DV 73hp4kZVORYZrL8du9ufL2H6Cwp328tJY78OF8YUCdyMUesVZafSTLwbctaaevkIwcdk epug9W0TvsK7Actz+nNG1qcCSKtSkfCjYBf4RUsIpSO1a9zTRDmFbm/1N5o0orAH0Mp4 2juy/IHpHyBbw/4Ao+ZR7pENiG8KnUKaxqNMu9ypbqmFxhNs7vDsq78MrVKwtFjS6lgB mdqtYUbcyhFvuuTGiMZm8MpUymNCZI1lo0vIkv7nYJCvV9gE+hXjJJwfK+C8qeVtx7fV IAag==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=OHBx6F9b; arc=pass (i=1 spf=pass spfdomain=flex--saravanak.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-62396-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62396-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com X-Forwarded-Encrypted: i=2; AJvYcCV9gpw1T+GhwY8LW2AXd/c00rPrXnp8doQFo7oCnFDawAoDYLYG+HPuPxQhuYPY0z+QrovUlYVpnf0VO23/X3NqOQezBw== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id bs25-20020a170906d1d900b00a3ba261d09dsi542041ejb.709.2024.02.12.13.33.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 13:33:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-62396-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=OHBx6F9b; arc=pass (i=1 spf=pass spfdomain=flex--saravanak.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-62396-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62396-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 7D1C71F22DF3 for ; Mon, 12 Feb 2024 21:33:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EF0034EB32; Mon, 12 Feb 2024 21:32:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="OHBx6F9b" Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6FED64E1BA for ; Mon, 12 Feb 2024 21:32:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707773527; cv=none; b=l0a4FObi3ryzkKcCpiIEVn7JBNYRmgJvgOO9s/XzALTkzlDvPlMFQy75vMPE7PioEhzTEasUoReehWwH0TjyKFeUk+WzO3RaCOlCF2u4zPV4gsNvGQ7WssDVp+gkf2o1Gx7l9JMJXKqyrHTbzAmMma0G8o8BnXRXhi63JD2VtuM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707773527; c=relaxed/simple; bh=09nOuvy1xCjK1iYqCopDQXrnPVKpNm2a5rJaJXsm9lU=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Cc:Content-Type; b=gPTObIHDc3YOxhcWmHFVs4isG0eS0Idwf1jxzziL218mtx/JUjF2VR2sZsYbi3QYnpkK+3Myuw/AZiavasZrYZrElQEXdE3K5Dgh0GsR0vpC+Hzhu1I4NHwEji2Q+oX+wVE7rb+yzQ3aHve8K71RQO3jvqvxrjGOnm1fflxAyg8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--saravanak.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=OHBx6F9b; arc=none smtp.client-ip=209.85.128.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--saravanak.bounces.google.com Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-60761bdbd4cso19722607b3.3 for ; Mon, 12 Feb 2024 13:32:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1707773524; x=1708378324; darn=vger.kernel.org; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=F5s7UC2LI5606ztlkySRh4zEDw9ZNIX2+7Suzh+XsVU=; b=OHBx6F9bhwsJvj9SRIzninQd62CTd0mat67Ry0G4dzfpMXC9lLLH/2cqAtkPZBKWOs rCJlNGFOdzUHHSyx00VaV5roKpsat69I49vXVWf9nM10D5g6AdFuX3akbE1MiBcmwf/3 U//fWlNw92ilZqOqSovV9mdpvdT5dJ202Xq3Gnl5XmSg5+K/5u0KYaPEpqu1aRUQ7I8R bMzmPnomy8vPKmO1iyBgm0mVL9Emn4B+OM9TotHLWNPRZjnhPKrNz83/FOQvMN7JijYp UeCGftAtQwFbnm3brtQMnWqc1osOv0HsjGW9FkVb887vW7Th/2S/CTchqaHupDFuZYjz CGjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707773524; x=1708378324; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=F5s7UC2LI5606ztlkySRh4zEDw9ZNIX2+7Suzh+XsVU=; b=UgR019Y3597SWfbEaG3CYAEgb4XdC/hs+D7erI+FfFm6ExlN5HFDnjdzm5zZMDDVhK DqvgV3Tl7TsdSBwY65xGq3SVNA46DVj9SaNBOQ0UReWdsKsd17YuYRtSShFCDU7c1MX1 E7RIOa8OK75OnzWCq/sr5MCIDTh7sBIqo8MCuOQFIrcJxrnKba3xQCWGfgBjse4/o8U2 f0B9TYPaq7Z+gLrYiQFmjP6qIqn1Gspd61hl6gndyJEK9OICfF/9v0PjJ7y8SzQdm7dN dRpIoGK6wuyYmrMONPSeosnNaYQPzEr+TF+f57cG+oTXB1Cq72F/YHW02tkGiEULvaJP GRKw== X-Forwarded-Encrypted: i=1; AJvYcCVzVLz9U0qXd+uKYShnhwiSa9/GqS1ssxTkY7rpSVeEnH7QAXBYXPR3cwRIMD/aw4uAAEgz1G7WfLfXjsk06rn3E+sJKz20twECfHhx X-Gm-Message-State: AOJu0YwzlZ5/Um/pDRecvzHUf6wiTQGenhP5wJQHWtAq7Zw9HFAdLnWI Xt9g01dTQF1KasV9HHfaJxR1BW71QS+WoMTeLVEsRhkF9O3Rfvr1tjpnL9J8DGynPc/b2hdyVIa Jd5o0YdgCT6C9/w== X-Received: from saravanak.san.corp.google.com ([2620:15c:2d:3:496d:5de1:a404:8bee]) (user=saravanak job=sendgmr) by 2002:a05:6902:120b:b0:dc7:6efe:1aab with SMTP id s11-20020a056902120b00b00dc76efe1aabmr1793262ybu.6.1707773524580; Mon, 12 Feb 2024 13:32:04 -0800 (PST) Date: Mon, 12 Feb 2024 13:31:45 -0800 In-Reply-To: <20240212213147.489377-1-saravanak@google.com> Message-Id: <20240212213147.489377-5-saravanak@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240212213147.489377-1-saravanak@google.com> X-Mailer: git-send-email 2.43.0.687.g38aa6559b0-goog Subject: [PATCH v2 4/4] of: property: fw_devlink: Add support for "post-init-supplier" property From: Saravana Kannan To: Saravana Kannan , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Greg Kroah-Hartman , "Rafael J. Wysocki" , Ard Biesheuvel , Frank Rowand , Len Brown , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus Cc: kernel-team@android.com, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-efi@vger.kernel.org, linux-acpi@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790730409153518850 X-GMAIL-MSGID: 1790730409153518850 Add support for this property so that dependency cycles can be broken and fw_devlink can do better probe/suspend/resume ordering between devices in a dependency cycle. Signed-off-by: Saravana Kannan --- drivers/of/property.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/of/property.c b/drivers/of/property.c index 751c11a28f33..dce451161c99 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c @@ -1066,7 +1066,8 @@ of_fwnode_device_get_match_data(const struct fwnode_handle *fwnode, } static void of_link_to_phandle(struct device_node *con_np, - struct device_node *sup_np) + struct device_node *sup_np, + u8 flags) { struct device_node *tmp_np = of_node_get(sup_np); @@ -1085,7 +1086,8 @@ static void of_link_to_phandle(struct device_node *con_np, tmp_np = of_get_next_parent(tmp_np); } - fwnode_link_add(of_fwnode_handle(con_np), of_fwnode_handle(sup_np), 0); + fwnode_link_add(of_fwnode_handle(con_np), of_fwnode_handle(sup_np), + flags); } /** @@ -1198,6 +1200,8 @@ static struct device_node *parse_##fname(struct device_node *np, \ * to a struct device, implement this ops so fw_devlink can use it * to find the true consumer. * @optional: Describes whether a supplier is mandatory or not + * @fwlink_flags: Optional fwnode link flags to use when creating a fwnode link + * for this property. * * Returns: * parse_prop() return values are @@ -1210,6 +1214,7 @@ struct supplier_bindings { const char *prop_name, int index); struct device_node *(*get_con_dev)(struct device_node *np); bool optional; + u8 fwlink_flags; }; DEFINE_SIMPLE_PROP(clocks, "clocks", "#clock-cells") @@ -1240,6 +1245,7 @@ DEFINE_SIMPLE_PROP(leds, "leds", NULL) DEFINE_SIMPLE_PROP(backlight, "backlight", NULL) DEFINE_SIMPLE_PROP(panel, "panel", NULL) DEFINE_SIMPLE_PROP(msi_parent, "msi-parent", "#msi-cells") +DEFINE_SIMPLE_PROP(post_init_supplier, "post-init-supplier", NULL) DEFINE_SUFFIX_PROP(regulators, "-supply", NULL) DEFINE_SUFFIX_PROP(gpio, "-gpio", "#gpio-cells") @@ -1349,6 +1355,10 @@ static const struct supplier_bindings of_supplier_bindings[] = { { .parse_prop = parse_regulators, }, { .parse_prop = parse_gpio, }, { .parse_prop = parse_gpios, }, + { + .parse_prop = parse_post_init_supplier, + .fwlink_flags = FWLINK_FLAG_IGNORE, + }, {} }; @@ -1393,7 +1403,8 @@ static int of_link_property(struct device_node *con_np, const char *prop_name) : of_node_get(con_np); matched = true; i++; - of_link_to_phandle(con_dev_np, phandle); + of_link_to_phandle(con_dev_np, phandle, + s->fwlink_flags); of_node_put(phandle); of_node_put(con_dev_np); }