From patchwork Thu Feb 22 03:46:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saravana Kannan X-Patchwork-Id: 204557 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:aa16:b0:108:e6aa:91d0 with SMTP id by22csp15117dyb; Wed, 21 Feb 2024 19:47:49 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWfnwB3sSswdhsg8LLl/GVOV6Hvd+q/a2aZyCLp9jF/0PhIHLlJsSQJ767H7Zj8oJ7TOT/7jkqce4R6u/2zAjyiYGzjAQ== X-Google-Smtp-Source: AGHT+IFAeDzo0I2LWopYpIn03dGKg/3faMsX5dPoN7GsTViMvEJdyzVvlDroIRjA3GgXh4JIl8vI X-Received: by 2002:a17:906:a84a:b0:a3e:7a8f:27dc with SMTP id dx10-20020a170906a84a00b00a3e7a8f27dcmr7449647ejb.49.1708573669250; Wed, 21 Feb 2024 19:47:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708573669; cv=pass; d=google.com; s=arc-20160816; b=H/TW+de1n+w8xbb3cYV+oACGraTffgljNa7JeT9HnNrExiwxz2wjJ1VleEQKcYbE5x KVTm4G4BmlWKyeI7XhbeRmYY2xkff4es9U6QDywjRrYYEUSqo8anyl/dsz7iaCkJamLm Ga5CruORB2r8JDokutw8AZYYXo/3f7kBR+uMKCnBD+qhBJC/k5GqS1MkRn6CG54N1oVd B7qbXsk9ixhdfsf+hAelJH8bYlpZcpiQYAR5pCO48vJ0JDBxCQhubxZgQkc3cDaPmliA kDfDBTd9+3o1OeO9e0+MC17ntkhf/6sasM1GrKZ4bg4R8Wq9uJuRUX0KdzAedMOzPXsG +wgg== 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=ffifgDXh6C+7XBhJdeqkwnncDH4hJvYntSOWpGwJjr8=; b=zl8A817u2gTLb1ogtk1cSP0Eqmu5SSOLaq6lQd9L3FJ1viRVIvUfYMnFHlg0oezPz7 KLtTEGtfR1sHkPOsNCUbhGQ8BfhyuATRjAnBvcOGGM5x0hwM7jGrXPGZyFSnRdS6+5Fp AcleXPpAzOvIvHwF1Rtk072OakS2toOyD8jlqK7oqb51zZXXMRqtP/w7ZEcT9FmA+NiQ 5aX+ycz4scqK53S5S/EH/PfTT8D4ezOz5GR2vIC/kqa9O/S6w6Mu9+1s8m7SFYdN7YiP XDT/F+yP7KsiIfrodlsbYx+2l8u/QMyNUH4eqKRB7c2c0BRqvVgN9zJQPHW5xJtkcsGh sqOQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=zRy22DHV; 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-75872-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75872-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id f10-20020a170906084a00b00a3e7636f513si3690157ejd.167.2024.02.21.19.47.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 19:47:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75872-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=zRy22DHV; 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-75872-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75872-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 B2B201F217FC for ; Thu, 22 Feb 2024 03:47:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 74CB0200D4; Thu, 22 Feb 2024 03:47:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="zRy22DHV" 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 3FD2A1B819 for ; Thu, 22 Feb 2024 03:46:43 +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=1708573606; cv=none; b=c/BLYryRoq9CMTg3Y83MWqJji/+UvXWfMsuBXxzSQQn3tPNrIcjosmJrdGJOqgzR8egiIvicm4OLn07KRjO4+ZLWz8AeBAMHw6+oJE1VTuO5ny101AEOEDuSp7anjHFempAfdigM50P2AO85mjAUIgyMLA3Q+lw0bECnCm6Vrj4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708573606; c=relaxed/simple; bh=BYJ0NZJqbtsDWKL5M2UsBKoeU9XD22jULrfryxgvv50=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Cc:Content-Type; b=A2W7vmNH1ie5PWB8BloS4tVENmITJ04M8SwhlFYxAFMdb9AHRYfekz2EUFhdPbDKWriKKAWzrakzOYPIT/mhmsx2u3CA2BZ8pgDt08kcHEsO6O+TIT6GF6QchKKbQdSNtO4S81bm95JbG1tDwAwgaNiPPwqu9aEgmFqYVY7e7ZU= 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=zRy22DHV; 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-6085e433063so51729177b3.1 for ; Wed, 21 Feb 2024 19:46:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1708573602; x=1709178402; 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=zRy22DHV0i/8GoOTEt5NG9RaIEs4ONI6qGKz6htHAyLu0Y+ze9SUdiW2cjkX0yaar/ 5py1BMb+AXTxLTxM/r5bmJE/TFtQveF8t6Wh4y7/mE/GObgFuXoGxWoJ0XU3zlQU9Y0l MkAZ9LzptdK/LCKuVz9Q4aohP6s4kottbwx+xHwg/6IMFQj+xwCiUSQO2oO5+zfKYP3L iCyh2XeE6ocTm9+OUU1ti8E5mdzxOUj3R+ooLnffQtg2CgOgdDcZs6Ej8ixOe5QcCubq meaulOtQklEC+J1kZ7eq6BQS8uW4mXGYNol8htPnb0gRT2+jSbrC+kG4X5ZpCydPSwNY +sgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708573602; x=1709178402; 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=ppTbO9oxSnR8hP7p7/wVKlX1prjPUwwM5JPxeBaE0kvw7Mh0CI+qMPPaYCJbb/crTd 28gO/S6VqSN7nxdK4SnFN4Q15HT7hyd7Ws15HWIcqNO1qhGVVEEchz3n68T80IbNbx/L jIFIg9jN75gy2Wu+WR9VNgt4duYC48uEvfV7H+OQKQYogMu2vYwtvqNzCFkNqh3eZ41B f988Qlo3ZUJn1xM/K0wbwcis3FUmdXuNlFz9QOLF/qWJ5hM67EKWKHVf7bMGsL6wDVyT 0ageVRSR1nitZe/+2atLBHpKeQYRAes1kV0Frrj9rlfTDSE1pS/eiMSWwk7qgqR5zdFO iFDQ== X-Forwarded-Encrypted: i=1; AJvYcCX6npc7tT/Z7vkD98llJBJd5VqG4U+TwIPhrz16zj2DF88oaWSDREUfVUGzdjFcfuMoHKLAl9WcGU8fx2ajec/6QCeLIz7+ejcH4CQM X-Gm-Message-State: AOJu0Yw86kq88dX6ry8O4EFUNcIqggRYPNR5MURQZQr9Ul+cByphPrCT Mltc5vGY1IvSipwsWY0Vx5GJn+yP1DB5kAFHDAU0zrIucHXGMkyYAAZ8Mfi7LQC2vfgPTmXo9QW fCQGZiE3usQLZ/w== X-Received: from saravanak.san.corp.google.com ([2620:15c:2d:3:451c:c6c5:1fb1:a2a1]) (user=saravanak job=sendgmr) by 2002:a25:b47:0:b0:dc7:8e30:e2e3 with SMTP id 68-20020a250b47000000b00dc78e30e2e3mr329609ybl.2.1708573602344; Wed, 21 Feb 2024 19:46:42 -0800 (PST) Date: Wed, 21 Feb 2024 19:46:22 -0800 In-Reply-To: <20240222034624.2970024-1-saravanak@google.com> Message-Id: <20240222034624.2970024-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: <20240222034624.2970024-1-saravanak@google.com> X-Mailer: git-send-email 2.44.0.rc0.258.g7320e95886-goog Subject: [PATCH v4 4/4] of: property: fw_devlink: Add support for "post-init-providers" property From: Saravana Kannan To: Saravana Kannan , 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 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: 1791569343717666791 X-GMAIL-MSGID: 1791569343717666791 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); }