From patchwork Wed Feb 21 23:30:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saravana Kannan X-Patchwork-Id: 204492 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp1357522dyc; Wed, 21 Feb 2024 15:32:31 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXmCRLFkhmri6c3rMQat9DHRTWKsJ0xCNR86eBxZOD7qNmi7d2nBTozNqJxTP4k5Uh4j+wcdGXJBxBZBjyIZ+QxURBHDA== X-Google-Smtp-Source: AGHT+IGLHQNwTdIfz2mhVWwopM859VKeBWzqA1WOA4OctDE2A8JGSJgBXloBLelpqoiLtR4wuHFr X-Received: by 2002:a05:6218:260e:b0:17b:59e6:ff8c with SMTP id oy14-20020a056218260e00b0017b59e6ff8cmr3927804rwc.6.1708558349065; Wed, 21 Feb 2024 15:32:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708558349; cv=pass; d=google.com; s=arc-20160816; b=03oZCUvhvT6OwmcAAURkzQT3cz8BVWRf7F/OgbUdgd2grF4UhuSuY7BoEWU5xlJ5Pt TFEeICWRnUbhf6b6FmCbDw5nnjVKDqpAmx26Uzkh4Rf1/g9t8c7kbArWg0OI8mBls+na 4vY3nye7x+98IOlMShBQ88xKM6Y3EzcX+fNBMwfepURWi33ArP8S0vsDCS0Y6wtwvwvx XE0Djsg91yPw+tIQZ9UMX+b1ndGHFaYbEUCN+y3XD0ZxjnrRylOiS2AYL7wYeDu5P6lH n2OGejAn0/5hpKugKIl3fdT/KmBJe82v2OnHa4K8gCVZ6iPK3C13f19jNxG4AG1rl+pY KW9A== 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=raWZBAYgki529t/WhxJsWod/PF9BbEcSvIxTt/14UCc=; fh=YUBBw0aGa+ykq94+4vFNdaDyx/fC0PxiliKqlebo8XY=; b=alWkWri7rEcX5YWULzI6tnY+Rke6mKzRaqmVXuOcmPmW7458joYtXoJqxV18ZkwtqG 4vsnquk0P7F6j12XUMcR3CXLJtSdSfOL31WZe6XNvc4IWIkDUyTUp3N2S6vgcS9RNr0W e09rmfOQx6tzOjoQpuapq7lUvd4g2uB63g+qqaEWNLCgb/9OCKhBQ9Z6a9Fbh0pUoU61 ME6G50VIkAVK6Hslx2dvzfnr6PZDL9ebyDmR0sldBcdJNwcAnj9K/aedta2iX2H9oaj6 09Yj13jqCWNCJrN3s5pf1rCmEnEuw91Kd2JgAJfsnIYIu3Vr9ccecnpykYZ/McLSHI23 rp9g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=0aVy5DJ6; 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-75659-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75659-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id v64-20020a638943000000b005dc47b71821si8947179pgd.572.2024.02.21.15.32.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 15:32:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75659-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=0aVy5DJ6; 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-75659-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75659-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id BE273284709 for ; Wed, 21 Feb 2024 23:31:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8952312C539; Wed, 21 Feb 2024 23:31:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="0aVy5DJ6" Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) (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 985C51E485 for ; Wed, 21 Feb 2024 23:30:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708558273; cv=none; b=XRyhkMx4pZPvHGEMCQehS0ExFmDXhhakkQ5kQ9zXjVS+ssB8Hp20EcSa/o7C1mwsIhb1CQ7Xi/spopodr4LAc6JC1hZ/IgPWkaiM4h1zXtpXD5refIRkUmgjb4HAHrj/iQW1dn50c8Arw+BuymbF5UAaLPRQ2UpQCsitMDsTWK8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708558273; c=relaxed/simple; bh=BYJ0NZJqbtsDWKL5M2UsBKoeU9XD22jULrfryxgvv50=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Cc:Content-Type; b=LDY5tdSr/DhXJFxBDt9lca4snHxBPkDn6oWkwPxvojBF5vOkU+UZcU0ijQvum/NS2wLoEhKzCDoxbSFPSvECRMcRGEY/ZveGLAveNAkMTS6j/0JxjR70jRUdpX90fXeQtNUh1wnvf7vQVGYKf0bHjLMMRday348iJpjkNdqwTQU= 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=0aVy5DJ6; arc=none smtp.client-ip=209.85.128.201 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-f201.google.com with SMTP id 00721157ae682-6082ad43ca1so64080387b3.2 for ; Wed, 21 Feb 2024 15:30:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1708558247; x=1709163047; 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=raWZBAYgki529t/WhxJsWod/PF9BbEcSvIxTt/14UCc=; b=0aVy5DJ6UiwYuSWxHynSSNBrX0riB5eUc556Vc1drbCSyrGPafZgvS5eb1yoFYTGVn Y5Bw4xsR1F70uv2NiiuhRxLG6WnzQdb8g0xsbLp2kqc7B1Jxa7qM1gD7LTKwCO+7dRqO ZOrE3dcCDAVZsuMdAlWC69x1VPhOwXW9PWq1G8hU9KDWxh+4Yo/Bm/YV582X+PICN5oa nSfxJnvoUeiKmJOS3QOLpQGbke2SIRIuVE6GG/vDaUXhLy8ZJ/4sge+c57KccfFbP1Qo miDEnOoh83N9QulTp8eB8YGOkA6cDzEumB2RAeQT8oo8vRwh4lpKHUrX2RXVRUrUw1qo uhhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708558247; x=1709163047; 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=raWZBAYgki529t/WhxJsWod/PF9BbEcSvIxTt/14UCc=; b=iLCpzi6D2Q429s9YQ3Toi0o7jOxMcvPYhOlrPr1dyutWOQ0P3IeJYJ8YtSBj2eYA0i B9GJA6GIpYEX+vIS3Jnl0vHeh5E5T+F7gXOqHF0mVxQtICsd/aid0jixGzudnAUpt/ra GlotB78zUoNIRFxPlsg31o5lKdF8jYCreNpxIe7kkcqdO34+mwfLQ9KHpH4HJZ00bxVJ ciE7dONv4AxposMhzsDER4od30Vx+C6mMgkEw0TFuDjqSV/PBg80DcH1jZXcVfnYS4fA PGf0WYj4I7WorN9WUfq7+7WEZymOBiJYUBqhravMr0CeeLF5KVkc5lRifgg/ewJgCbMp FZBQ== X-Forwarded-Encrypted: i=1; AJvYcCWQ1bZmH/HduBfN5fJJHCeZn5/w6BMqJtYV8O09Rv5zzVMqWojJM/nn8nyK61X7mjYHuthremm3wFR6JT8RcoYa9UJYj6NeOA+QE95q X-Gm-Message-State: AOJu0Yza+oDu/RbNwh/gpeUTa3ngcFY/2QBTV7joVnWaaDd7uLQs+KiH m15xijAtlJe4ZjLpWAQKo6rYBhIy84aN2XzDsctTF3sZHWiIDEUrmVryObhpoXNctZ9qpDnesuN 6acu6q4D4yGb0Ug== X-Received: from saravanak.san.corp.google.com ([2620:15c:2d:3:4e1e:336a:2b30:13fe]) (user=saravanak job=sendgmr) by 2002:a0d:d685:0:b0:607:7564:a830 with SMTP id y127-20020a0dd685000000b006077564a830mr3405493ywd.0.1708558246788; Wed, 21 Feb 2024 15:30:46 -0800 (PST) Date: Wed, 21 Feb 2024 15:30:24 -0800 In-Reply-To: <20240221233026.2915061-1-saravanak@google.com> Message-Id: <20240221233026.2915061-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: <20240221233026.2915061-1-saravanak@google.com> X-Mailer: git-send-email 2.44.0.rc0.258.g7320e95886-goog Subject: [PATCH v3 4/4] of: property: fw_devlink: Add support for "post-init-providers" property From: Saravana Kannan To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Greg Kroah-Hartman , "Rafael J. Wysocki" , Ard Biesheuvel , Frank Rowand , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus , Len Brown , Saravana Kannan Cc: kernel-team@android.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org, linux-acpi@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791553279472239389 X-GMAIL-MSGID: 1791553279472239389 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 bce849f21ae2..15ccad6cba4a 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_providers, "post-init-providers", 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_providers, + .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); }