From patchwork Wed Feb 21 23:30:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saravana Kannan X-Patchwork-Id: 204493 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp1357779dyc; Wed, 21 Feb 2024 15:33:12 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVRV7ebVdSMvUxFUhrpcd+jnAe0LH5sXfrexgLWCBntJJZaFB/3XBP+Un72cWCbiYXs5ji2CE9wNZIFU0pSdLcR0p3hKA== X-Google-Smtp-Source: AGHT+IGnGdXnO0ZmlOrMWd62glfjw7SoOfq242bJfv2xe4dqvcPM/pqevPRh5f/2sgk58/MDNiUV X-Received: by 2002:a05:6870:b6a0:b0:21e:c5d7:595e with SMTP id cy32-20020a056870b6a000b0021ec5d7595emr11181580oab.57.1708558391814; Wed, 21 Feb 2024 15:33:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708558391; cv=pass; d=google.com; s=arc-20160816; b=nvGSwEB5jumhpPAxiBi1YVR1HXsDOw//aFZzwyrX4KwqsGA0hOomg4cEIE02BTE3ru 6JOf7T7Pzk2raW6zczYFXl7pXGYaHmWtNJXXol0vDZu7fjye0ywUr1dikTpF25vzEnE7 6mRUfmfOiD9UuezWle+I2GKDYa5MRazxSbJbmj2Su1j3j1yg+K4LdmD0XiNvdVJkhQnE k8hKiv50m+tLWJdTGWI1XsXj4NwNXZ2uDRH0yesuqAUila8vug8FG1VNxNUG7msIDfLF L4UceHZsV7Hjew9RJUttZQqfkHZ1VOLloUsXo9xjqXIHQHWiGXpn7uKdoDmGtyyjvtGr cD4Q== 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=2RZcm32i75equt/unWf5KMZ/RAcqfb/I89ao1kCyS8A=; fh=RulszLGOen5FzCnn7a5PwLLGCmvhrxwOcEdRpvAuQGg=; b=IYXkNtQjiFNbJWobOj6ZCw/yUA2FCeKe3qCxC2jaz+GxCa7y0HuZQkkU3UkE8sbnmJ u5abeK39+oQhoL/IHwdvB9liNivVlwXVCuxbhKEKlUxpPRSYUWGQ/l7UgWsb/LyBHbSC +keaJt76232B1XFVKfnuADgKbBR2ewDw2uh758duXNLGvsni3KHIokUfr1dh4mSR3TCk 3MES0sIs/lqGOFE/lUJLinDJmxN3uF6NC90UPEnwp6I/PFJyQ6CDu1jwtYgMqfA2VdNm 6+wplcup/CuNFS/Y9LxT5v8O3d27gkbaeLtTDNlR9tq0r/xVJgRuHeUGr6t7zCzut82l c/yQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=ccXHuh83; 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-75656-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75656-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id q6-20020a634306000000b005d8b547307bsi8916162pga.575.2024.02.21.15.33.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 15:33:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75656-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=ccXHuh83; 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-75656-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75656-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 7037AB24C1B for ; Wed, 21 Feb 2024 23:31:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0DE5612DD81; Wed, 21 Feb 2024 23:31:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="ccXHuh83" 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 4841112B170 for ; Wed, 21 Feb 2024 23:30:36 +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=1708558239; cv=none; b=n1YoJP8x7+NqD45KyMCY9ZulSmYxYGt2jv0byIpoL3EJTl5/JoZD3pBs9blp3rE4Tj1ryieVVgG8F0j32V/DblegHaIRfF783XlgwEftjqIS1QiXWq3sXNUE00geq71hRQSS6V7J3ebgxv9ri0EG6HNlqTQ0JlGeRNLWT1lDARE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708558239; c=relaxed/simple; bh=O3k+nYu1MYBPKH6TsA/y54d2ADLO3F4v2KYWl0x8bqo=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Cc:Content-Type; b=bOoOBht9INsdQvtRtxYhHrvuJqpf65XxieXzelb9MT8z5qmWM19c6RA5uTL9NVlM00u8+zZAAyiffM71h0FWr+/aIJRYAfgqzbnTdzNjWuN5fyNYEzaISuGnBqlVK6Fo3quLQLc+tsjslIlNCBRj7M+4gRPXjwB1ingewIKhSps= 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=ccXHuh83; 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-6082ad43ca1so64078007b3.2 for ; Wed, 21 Feb 2024 15:30:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1708558235; x=1709163035; 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=2RZcm32i75equt/unWf5KMZ/RAcqfb/I89ao1kCyS8A=; b=ccXHuh83DugB0FVQYirkrAty60fONap3CK593aejGZlaS6pxh5cf7aP+nDz5jBoEm7 KYlEeTnHJJEKVGY2myu7/+bwy0rxvFSN34PvfuFcWEB9pB123ANwq/20iTZmxMdGXEcQ HGuTq6NWx7HYVRdbIKzFKYJAm4n36KH1fVynRqk5YtQ7fpgvNXnIa8OSMsxH7BsEVHHD OfOiKjLx/qSTq096n0LfP2kq1HVqDK9GtVJi8UdPIAn94MNGG8g6yVDNOmH3kULnaS74 8hfgdkA8Ue9aP9xmh6cXs6Oo+uh9gzuyGOPXZfmUOXcrlkxpTmVkCq1dWlH/z1RGpn5P lSTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708558235; x=1709163035; 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=2RZcm32i75equt/unWf5KMZ/RAcqfb/I89ao1kCyS8A=; b=LRPAZ937ha4hJDynuJxy8w6cLDEXiT+eCoVi3s+MKG2Sy4uJGibGVQRYeTzYRwx3DN PpBUUGiS3V8WHuW/DMjtkizEdfkUZHtGjVxUH8XiGSrZERGb7WLnjFDgbN4nfDZC9Iwx 6ngz3lCS4PrBkWhpFO4sVLamiy/fa7MKW6FDDI6WFteqMQdertRQQXhE+utb33Kq4mjc e6eYB5FJsZ9zqn5Jjw2cXAcWQMcPGcWbtB0JeTuZkC8z9B++MCDA/se7SC6FUUDJsWWN Ss8ZnAc3GQwK3jbJP+vhtczy8DWr4pjGV8uC/3mR9zEBP1yaRskZTqMrSpFHgJo7UdOC 0vsg== X-Forwarded-Encrypted: i=1; AJvYcCWx6HkxTAkq72YZwGPE1kubenm3Um66H3lVbWpfoV8vL1E7CgjlSn5JOZUFmjeXB2+QUsixnbYYKFNNYjbVZKzjkhGGm1vL59KhdcsB X-Gm-Message-State: AOJu0YxBVrzThn6Bn4GY+esxpPkrtfuQK2X7joXPuEF/dW4LIe7hcady vl8OJjV+w50vHVDzdEJQ6lS4AFVfdL2MuU/Bv5sBB+JZwraSgI8Nq5ExcU5mAiGXzmtv0jr1GBr eMuO8q25B/6XIPg== X-Received: from saravanak.san.corp.google.com ([2620:15c:2d:3:4e1e:336a:2b30:13fe]) (user=saravanak job=sendgmr) by 2002:a0d:e6c5:0:b0:608:801a:e66e with SMTP id p188-20020a0de6c5000000b00608801ae66emr571836ywe.3.1708558235317; Wed, 21 Feb 2024 15:30:35 -0800 (PST) Date: Wed, 21 Feb 2024 15:30:21 -0800 In-Reply-To: <20240221233026.2915061-1-saravanak@google.com> Message-Id: <20240221233026.2915061-2-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 1/4] driver core: Adds flags param to fwnode_link_add() 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: 1791553323761814077 X-GMAIL-MSGID: 1791553323761814077 Allow the callers to set fwnode link flags when adding fwnode links. Signed-off-by: Saravana Kannan --- drivers/base/core.c | 5 +++-- drivers/firmware/efi/sysfb_efi.c | 2 +- drivers/of/property.c | 2 +- include/linux/fwnode.h | 3 ++- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/base/core.c b/drivers/base/core.c index 9828da9b933c..adeff041d472 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -92,12 +92,13 @@ static int __fwnode_link_add(struct fwnode_handle *con, return 0; } -int fwnode_link_add(struct fwnode_handle *con, struct fwnode_handle *sup) +int fwnode_link_add(struct fwnode_handle *con, struct fwnode_handle *sup, + u8 flags) { int ret; mutex_lock(&fwnode_link_lock); - ret = __fwnode_link_add(con, sup, 0); + ret = __fwnode_link_add(con, sup, flags); mutex_unlock(&fwnode_link_lock); return ret; } diff --git a/drivers/firmware/efi/sysfb_efi.c b/drivers/firmware/efi/sysfb_efi.c index 456d0e5eaf78..cc807ed35aed 100644 --- a/drivers/firmware/efi/sysfb_efi.c +++ b/drivers/firmware/efi/sysfb_efi.c @@ -336,7 +336,7 @@ static int efifb_add_links(struct fwnode_handle *fwnode) if (!sup_np) return 0; - fwnode_link_add(fwnode, of_fwnode_handle(sup_np)); + fwnode_link_add(fwnode, of_fwnode_handle(sup_np), 0); of_node_put(sup_np); return 0; diff --git a/drivers/of/property.c b/drivers/of/property.c index b71267c6667c..bce849f21ae2 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c @@ -1085,7 +1085,7 @@ 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)); + fwnode_link_add(of_fwnode_handle(con_np), of_fwnode_handle(sup_np), 0); } /** diff --git a/include/linux/fwnode.h b/include/linux/fwnode.h index 2a72f55d26eb..c964749953e3 100644 --- a/include/linux/fwnode.h +++ b/include/linux/fwnode.h @@ -210,7 +210,8 @@ static inline void fwnode_dev_initialized(struct fwnode_handle *fwnode, } extern bool fw_devlink_is_strict(void); -int fwnode_link_add(struct fwnode_handle *con, struct fwnode_handle *sup); +int fwnode_link_add(struct fwnode_handle *con, struct fwnode_handle *sup, + u8 flags); void fwnode_links_purge(struct fwnode_handle *fwnode); void fw_devlink_purge_absent_suppliers(struct fwnode_handle *fwnode); From patchwork Wed Feb 21 23:30: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: 204491 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp1357363dyc; Wed, 21 Feb 2024 15:32:10 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXKzOaCkZ2ItOdR7PmJ0r9/VIlsSeovDk2u3ImeImVMXkFlVeAS485PdcQrY8JRdF1n/CXNq0GE+WWG5vb1zc90lTYP3Q== X-Google-Smtp-Source: AGHT+IHtS9SmedvOtKkCz4kyjoulDyd0pzPTJ1oPj6ApH1jmTDf5va3b5gOP/IP4L1GJBsO5qmCk X-Received: by 2002:a05:6a21:670b:b0:19e:cf1a:5376 with SMTP id wh11-20020a056a21670b00b0019ecf1a5376mr19207547pzb.40.1708558330494; Wed, 21 Feb 2024 15:32:10 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708558330; cv=pass; d=google.com; s=arc-20160816; b=YQeKZ0ZFDjy7d2gw2B1PAUGA9ydJsKXL4WFPw2b8h/xYhHVAEyC/LGNYUVA7WnaYUT bvVpyB0PCQvi8gfEm2XF/YpaQVLNDQHmessFvsGaTSdEgAhiYnFC8oyS6NYvH05fUqS3 pIz+5iwBv7eR59aHDzqHSyafRLSVpxkYO1Zab9f/wB82K4baw1obUK5/NrZKXI07rfhx RVEjRqjd+n/Mlm9Dk0DC2g0+XiYzRRYYbGDrNsjv6/K4jj+n8qOt30/RppMauRA2nqQI GEuZfH+ANXsCgIzWW//NT68Aj+T7xnnm1LLdO9T29fY5OWiMmB6oWjFv45Ijjak4rB15 f6UA== 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=hz8i/GyBU5B3ALvYkkFzM0iQaG+ZmlRW+5k11B+Bktg=; fh=Ps+upxH9t4DyppcZ4bQHsd+wL0yzgQCYZ3zG9Z6IJgI=; b=DeRi8h03TPvnJ4FUPO5w9JIz2VlrQZqmU4spIBvn+GPYy9n3xRY8befgW750Hk7QSO 6J+Tx+4xl0c0Rhk+cBZWKLDfWqCN8aPu2h+FZ/t1hEKWJaGcmLEHIyeGoW1HzI1FzpBP D5/0tLt8oZw8XYnLjauInjyQTkk09ToQUolkSRO9KA2J3YAt4obu0zr3BTH17bMOfkLF +PkAAusc8OVcqX2PVJ0pCYQQvnUc3VosIE1dx9vl9ZuAnFkEr5brsG+OUSdvP9aZ5a4b FZFUX25Og+EzlX4d2cpw4nek/vS/PoI+nOsYqGs5bpXdQE3eexFv03LfTA8GfSsuM1OQ bdiQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=kdO1X11a; 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-75657-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75657-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 h7-20020a170902f70700b001dc4adb4c79si174184plo.361.2024.02.21.15.32.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 15:32:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75657-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=kdO1X11a; 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-75657-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75657-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 D7BD52832D0 for ; Wed, 21 Feb 2024 23:31:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8609E12C549; Wed, 21 Feb 2024 23:31:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="kdO1X11a" Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.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 55CC412A14C for ; Wed, 21 Feb 2024 23:30:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708558244; cv=none; b=Xnn6iu3AMAQTiIRf90teGombPQsEkFz3MuC39gx1Ix/gbWNDmDrK6T8qKrRxTOAEbCu1PTXuzyyesBrv1gSv/JSOz+dpNfEPMVmpppA0n6fuShNkoifPpXSS+vuE7QPRR7QdO7ihnCrCc21rtteIZL5O9R3bcTzNwIc7fgqWqYY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708558244; c=relaxed/simple; bh=/z8Eu/KeLJ7IbgMJCENA0qx1maElopa30GOhgYXJfiQ=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Cc:Content-Type; b=slSmRmNY5z9XaYVZ3pF3VmpO+SrgzcQjysYWoQWMYgq21qTMOxT/pCchnQm35BhaDt0omjpiBW04VBLr3LTYX4ojOJYlCrOfl+khEq1UkmSH0F6Gk8opt0h6G5/AYQdyWuwkz1shYMjLix2LIEr1S/eL5b2V3C53uB+hsPYsx3Y= 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=kdO1X11a; arc=none smtp.client-ip=209.85.219.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-yb1-f201.google.com with SMTP id 3f1490d57ef6-dcc0bcf9256so8207955276.3 for ; Wed, 21 Feb 2024 15:30:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1708558239; x=1709163039; 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=hz8i/GyBU5B3ALvYkkFzM0iQaG+ZmlRW+5k11B+Bktg=; b=kdO1X11aIl4Lz7Ab4W0RtCxTzU56PzthcPHHI74ohhv9ewWe1BQvHC+DrAEh+cbjhr Fp+9Eu+WgZzFYjDQ0JtVpWAXOa0AGSg4Do7kj84E/1KhFejG9QjzkAXrYgmpBsB5umwu dONIbsErrDxfNkSphy/oxoI6zfmxkQsfBZA4T3Z/Pj0jBxb2ujm6H6b+Z3t0513bG45o bOugM0UE7EdMZ47G1OEC1baI0WygVYOA38IsnHN9oyd4+TLn80jLmpSmIJh6kLeHBghq 5J/22fDE24RDjzKWl5ysDngxe0v3oNmAWd4NSqw0Yrdz517/0UNIfWnVp5ckce2Tqy/y f4pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708558239; x=1709163039; 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=hz8i/GyBU5B3ALvYkkFzM0iQaG+ZmlRW+5k11B+Bktg=; b=HLqGnP83jBAOmgmw99rdvj0jn5zGJZpyyEys1918XiFUW+3mfFaew9Su7lC6l4NpmQ wn07Zl/JeJ6VcrsQR9ebVhsu9AQRPCg2Odp2vsGIrQ+AvA3L95OijK8YKWbAT+OkoyIC tBAYfdu+O+9sW50mHqTsiV6aiu0pukZo0ImGQ3+25iQ4t9i8yJGnsdh3atFJtWHMGA7j JpEWRAejBVbr2g2/nPolOp42ooLp+2FDBa+elEbmXJR/aBiSkFhm3TS/BXDF+nBEFt26 Wvk2NGyyeb6dKeU8D+5k7Wrx0R7O69I5t9ek22TiEPMf7AF4Yj9gSjHI6Rs3IdCglx0g FxhQ== X-Forwarded-Encrypted: i=1; AJvYcCUMI3vSOcb8Nw2ngUWM+8SEsTXL8HaSVGLMaUhE1dfKlQgiHrT6fwKsx5HQeOMQVisepnb6dxXqzvdx/FQoumL7XxA99IR9440MaaiY X-Gm-Message-State: AOJu0YzwTKU/gTzJ6XAxgHhlPOVEEd0N/dRgoZTN98fKYultYzaU8Iy1 PbURNTGhOuK2bS3ptYCMZrCsZvDcNEIDxQdPg8UamNDw12aRS4JBToSe+IXfmJEeb+7yFrj+V/O /O+/+rZa/j3+mWg== X-Received: from saravanak.san.corp.google.com ([2620:15c:2d:3:4e1e:336a:2b30:13fe]) (user=saravanak job=sendgmr) by 2002:a05:6902:72d:b0:dc7:3189:4e75 with SMTP id l13-20020a056902072d00b00dc731894e75mr30785ybt.3.1708558238961; Wed, 21 Feb 2024 15:30:38 -0800 (PST) Date: Wed, 21 Feb 2024 15:30:22 -0800 In-Reply-To: <20240221233026.2915061-1-saravanak@google.com> Message-Id: <20240221233026.2915061-3-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 2/4] driver core: Add FWLINK_FLAG_IGNORE to completely ignore a fwnode link 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: 1791553260224500522 X-GMAIL-MSGID: 1791553260224500522 A fwnode link between specific supplier-consumer fwnodes can be added multiple times for multiple reasons. If that dependency doesn't exist, deleting the fwnode link once doesn't guarantee that it won't get created again. So, add FWLINK_FLAG_IGNORE flag to mark a fwnode link as one that needs to be completely ignored. Since a fwnode link's flags is an OR of all the flags passed to all the fwnode_link_add() calls to create that specific fwnode link, the FWLINK_FLAG_IGNORE flag is preserved and can be used to mark a fwnode link as on that need to be completely ignored until it is deleted. Signed-off-by: Saravana Kannan --- drivers/base/core.c | 9 ++++++++- include/linux/fwnode.h | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/base/core.c b/drivers/base/core.c index adeff041d472..fac017657d25 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -1012,7 +1012,8 @@ static struct fwnode_handle *fwnode_links_check_suppliers( return NULL; list_for_each_entry(link, &fwnode->suppliers, c_hook) - if (!(link->flags & FWLINK_FLAG_CYCLE)) + if (!(link->flags & + (FWLINK_FLAG_CYCLE | FWLINK_FLAG_IGNORE))) return link->supplier; return NULL; @@ -1963,6 +1964,9 @@ static bool __fw_devlink_relax_cycles(struct device *con, } list_for_each_entry(link, &sup_handle->suppliers, c_hook) { + if (link->flags & FWLINK_FLAG_IGNORE) + continue; + if (__fw_devlink_relax_cycles(con, link->supplier)) { __fwnode_link_cycle(link); ret = true; @@ -2041,6 +2045,9 @@ static int fw_devlink_create_devlink(struct device *con, int ret = 0; u32 flags; + if (link->flags & FWLINK_FLAG_IGNORE) + return 0; + if (con->fwnode == link->consumer) flags = fw_devlink_get_flags(link->flags); else diff --git a/include/linux/fwnode.h b/include/linux/fwnode.h index c964749953e3..21699eee9641 100644 --- a/include/linux/fwnode.h +++ b/include/linux/fwnode.h @@ -53,8 +53,10 @@ struct fwnode_handle { * fwnode link flags * * CYCLE: The fwnode link is part of a cycle. Don't defer probe. + * IGNORE: Completely ignore this link, even during cycle detection. */ #define FWLINK_FLAG_CYCLE BIT(0) +#define FWLINK_FLAG_IGNORE BIT(1) struct fwnode_link { struct fwnode_handle *supplier; From patchwork Wed Feb 21 23:30:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saravana Kannan X-Patchwork-Id: 204490 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp1357197dyc; Wed, 21 Feb 2024 15:31:49 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXhyVnK1iF7nzx5fbXODxkh9Ss2P7IIez+ATfr8YUH/W4l5SSaT7v2ERTnilIsLhGA2KZa6MJ9FKLoQyg6VBMv/ubtypA== X-Google-Smtp-Source: AGHT+IEZVzQseARwOgWgCoqTxrT4Kj4+wnIjRAxFx30R73fkrbwdZNFMQojVHpB2q8MfCviKHhRi X-Received: by 2002:a05:6214:5094:b0:68f:3295:245a with SMTP id kk20-20020a056214509400b0068f3295245amr18570676qvb.4.1708558309308; Wed, 21 Feb 2024 15:31:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708558309; cv=pass; d=google.com; s=arc-20160816; b=Dft9AQ/lA86VUzQ5Ii1inb3auQaVyjtehc1gppXKTpeOswc7xX+L73B6UoHKyj6r/r sB/HXubdadTMg4reBpsoYzJP7BDT0NCMqyTWQMKJntH4onjxaMxPHBn3tvjVTtE5RL8u c7lw1AaGpjLgPofhGvBDwqxM77kLk9EL7N3DLp1+5B4QQosCi7QUQbbKexmXMvviztl8 1CEK3Jf51V6jjINqDMx34E2hDnBlP75DX6This5tT99hqpDeb+ppIdY6arbRG+IuGrJo mVbhn7OtayaVBaN/0NFXPi/ifQJs8UbiuoKpMalstyq12Irig0GKJRevk6Qh0IWhSt7r 6KJg== 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=vosJNO3Zn4Xnibp+U/swV64D06bjeRMU8MziMRFin+Y=; fh=7bo5UXIqgTG/iosRGm5HvaMubh7ETKlNT+Z69G+WXkc=; b=JbbPqKAi3PRYXAqbxKgFDZ50x1IjHh1K1kOQEur92Nrf2EzussdA2UHZYK96+xqo5Z cFlj7Y52np2EfqOq4nwc4yuMvu69fAZuMEzzBpLO4Az7kTBJ0q3ebOzpUC/fsgBJjvHQ INEgOGjFHuTHX1h3FL9BvPMN1O0ON9UeHTryiXwiM/YcscxqKHqMdz6B1D9eBU9fg+CK X5qiaa79txanQHjgoYd/Wo29NWHFHFzrYj3Ta8lHSsk9/SUKLI8Jg1oc2dEnaQoEXkFM bgbMFW1R3UG5sGUIiFpU+TNv+4Od71dYGMmErVyYZ5iYY1kZhEu8MlYF+ZiW6z3+APyR 3lyA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=AtDxyuo1; 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-75658-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75658-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id ge13-20020a05621427cd00b0068cbcf48e43si11913286qvb.49.2024.02.21.15.31.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 15:31:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75658-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=AtDxyuo1; 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-75658-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75658-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 10B4D1C2279E for ; Wed, 21 Feb 2024 23:31:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5498312DD8B; Wed, 21 Feb 2024 23:31:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="AtDxyuo1" 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 75E1A128824 for ; Wed, 21 Feb 2024 23:30:44 +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=1708558259; cv=none; b=XSx4vSR4v6jjEZ8EhDgXl5NMwD+adssMbZMxP8lqNVuFSIU/QwuOd/dcRjt3m1LQ0q6QMcQ34IaRELR++ev+m3yUy/pOn0b9pje1Rc6/oVEdhBF7oXf69iIwINY9/nqkArnXmYpeNJrudv9Bx5XbTMcAGGWJkT3tfj6TrulZnfk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708558259; c=relaxed/simple; bh=jUX4qJT8DPbrff7AecTpaNd/U/+p/bjh3Aq7WNnY2rU=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Cc:Content-Type; b=Nz32cTnFHkSCWYVMPw4fxU08EbFMQ0Z/h2/YIn6eFQdkQtQFGiv1BGn5+6CdGsUTfaNMJp3I38m4HqsrCNKHwrVLxTLjnO1ZP/EwhGOkWJGoK8dGuAJDuGlOHVswm1nB74JrbmeKEQ0gLRP2WASW+f0/B/TdnEX1WABJtuYqmP8= 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=AtDxyuo1; 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-60878cf0cb2so28042727b3.0 for ; Wed, 21 Feb 2024 15:30:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1708558243; x=1709163043; 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=vosJNO3Zn4Xnibp+U/swV64D06bjeRMU8MziMRFin+Y=; b=AtDxyuo1yLNiljUl4l7lFhtdq1a4LD6pL8rdED9ZbyyobDdwGwLG2pRmv7ikpgc/HX T4ZowgFnTJCPzdfv0dqk1qelcW/775LRrhGjZiEyIMOg9R7gX8KtoaDZ1MIKIHqWS+vw h4wxB4eNA0aK+EOUgwVBrbo9/xY1mMWqdPo1Y5tmizVb5/wmwSqOa/J9XIGyvdGuSfZE 5FmF+L5YCHD5/JyZu4IL6+PPmXFuZMHXqLEyO9fndxYmyPhPA0K/6Jk1tlZ76D1LU/zW btJasIXE31gmgkymUAeXTK8qQXQhUVsUfImoxNKQl7UeT3L6OGb7lJ2Up0lkBRkj9BtO 1LaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708558243; x=1709163043; 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=vosJNO3Zn4Xnibp+U/swV64D06bjeRMU8MziMRFin+Y=; b=wXf7pgD/q5xNUw/u4a7aev59rVoWWuBW/iDfBQaZSJbIqMWG6n/QDgMdAV9m5tPkW/ xaWPGZ9GylewlPvHB2UQ2dwXik6ulHLbRAfwBP0T91UL6n5y41Y4n7LGml68DzJ1+ugo BTv2NFxniu6YC0KD8V2GLuATN5GPEBavYHPN3vnNjR+nFTk9Xz0hnXx6ZhBbK1IkZxBO f5TBAQV++0pHwLH0JzU2gQ841XcfH7e8yXUVMDoV2o5Yz12tibxzYwy2dNRSS2JFGo4h rEqlq8joKiCGfT+BdXefkDf2825h3IicD5RjD4gzgusGHH7ogpYbs6lLZEXmpwQi+C1V J97g== X-Forwarded-Encrypted: i=1; AJvYcCUJ2haQpzlhqulcF3skbmL75tdjqBY7N094S+6YSArRKufThMpJ3nDn68dGHTMhGSu9htLtj4us20ENk8KZ8J4L86p8tKY/93NrpTDn X-Gm-Message-State: AOJu0Yw/EfmHOg4zdClX3h5E+F7SIE++I9rBbF0SAiHCmlcfs1uhBLei XBRObOluHvpZXKLpHRM+hiKw9ldVYbA/3SyD69BtlB9qZm1WzVuMEUdepOPHHI/qfaP6ArS19EL UTSsk/Q54IkuEgQ== X-Received: from saravanak.san.corp.google.com ([2620:15c:2d:3:4e1e:336a:2b30:13fe]) (user=saravanak job=sendgmr) by 2002:a81:df03:0:b0:608:8f74:bbfb with SMTP id c3-20020a81df03000000b006088f74bbfbmr350946ywn.9.1708558242802; Wed, 21 Feb 2024 15:30:42 -0800 (PST) Date: Wed, 21 Feb 2024 15:30:23 -0800 In-Reply-To: <20240221233026.2915061-1-saravanak@google.com> Message-Id: <20240221233026.2915061-4-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 3/4] dt-bindings: Add 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: 1791553237344111995 X-GMAIL-MSGID: 1791553237344111995 The post-init-providers property can be used to break a dependency cycle by marking some provider(s) as a post device initialization provider(s). This allows an OS to do a better job at ordering initialization and suspend/resume of the devices in a dependency cycle. Signed-off-by: Saravana Kannan --- .../bindings/post-init-providers.yaml | 105 ++++++++++++++++++ MAINTAINERS | 13 ++- 2 files changed, 112 insertions(+), 6 deletions(-) create mode 100644 Documentation/devicetree/bindings/post-init-providers.yaml diff --git a/Documentation/devicetree/bindings/post-init-providers.yaml b/Documentation/devicetree/bindings/post-init-providers.yaml new file mode 100644 index 000000000000..92eb9a027443 --- /dev/null +++ b/Documentation/devicetree/bindings/post-init-providers.yaml @@ -0,0 +1,105 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +# Copyright (c) 2020, Google LLC. All rights reserved. +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/post-init-providers.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Post device initialization providers + +maintainers: + - Saravana Kannan + +description: | + This property is used to indicate that the device(s) pointed to by the + property are not needed for the initialization of the device that lists this + property. This property does not make a device (that's previously not a + provider) into a provider. It simply downgrades an existing provider to a + post device initialization provider. + + A device can list its providers in devicetree using one or more of the + standard devicetree bindings. By default, it is assumed that the provider + device can be initialized before the consumer device is initialized. + + However, that assumption cannot be made when there are cyclic dependencies + between devices. Since each device is a provider (directly or indirectly) of + the others in the cycle, there is no guaranteed safe order for initializing + the devices in a cycle. We can try to initialize them in an arbitrary order + and eventually successfully initialize all of them, but that doesn't always + work well. + + For example, say, + * The device tree has the following cyclic dependency X -> Y -> Z -> X (where + -> denotes "depends on"). + * But X is not needed to fully initialize Z (X might be needed only when a + specific functionality is requested post initialization). + + If all the other -> are mandatory initialization dependencies, then trying to + initialize the devices in a loop (or arbitrarily) will always eventually end + up with the devices being initialized in the order Z, Y and X. + + However, if Y is an optional provider for X (where X provides limited + functionality when Y is not initialized and providing its services), then + trying to initialize the devices in a loop (or arbitrarily) could end up with + the devices being initialized in the following order: + + * Z, Y and X - All devices provide full functionality + * Z, X and Y - X provides partial functionality + * X, Z and Y - X provides partial functionality + + However, we always want to initialize the devices in the order Z, Y and X + since that provides the full functionality without interruptions. + + One alternate option that might be suggested is to have the driver for X + notice that Y became available at a later point and adjust the functionality + it provides. However, other userspace applications could have started using X + with the limited functionality before Y was available and it might not be + possible to transparently transition X or the users of X to full + functionality while X is in use. + + Similarly, when it comes to suspend (resume) ordering, it's unclear which + device in a dependency cycle needs to be suspended/resumed first and trying + arbitrary orders can result in system crashes or instability. + + Explicitly calling out which link in a cycle needs to be broken when + determining the order, simplifies things a lot, improves efficiency, makes + the behavior more deterministic and maximizes the functionality that can be + provided without interruption. + + This property is used to provide this additional information between devices + in a cycle by telling which provider(s) is not needed for initializing the + device that lists this property. + + In the example above, Z would list X as a post-init-providers and the + initialization dependency would become X -> Y -> Z -/-> X. So the best order + to initialize them becomes clear: Z, Y and then X. + +select: true + +properties: + post-init-providers: + # One or more providers can be marked as post initialization provider + description: + List of phandles to providers that are not needed for initializing or + resuming this device. + $ref: /schemas/types.yaml#/definitions/phandle-array + items: + maxItems: 1 + +additionalProperties: true + +examples: + - | + gcc: clock-controller@1000 { + compatible = "vendor,soc4-gcc", "vendor,soc1-gcc"; + reg = <0x1000 0x80>; + clocks = <&dispcc 0x1>; + #clock-cells = <1>; + post-init-providers = <&dispcc>; + }; + dispcc: clock-controller@2000 { + compatible = "vendor,soc4-dispcc", "vendor,soc1-dispcc"; + reg = <0x2000 0x80>; + clocks = <&gcc 0xdd>; + #clock-cells = <1>; + }; diff --git a/MAINTAINERS b/MAINTAINERS index 9ed4d3868539..5c97a0b5e9c1 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -6060,12 +6060,6 @@ S: Maintained F: drivers/base/devcoredump.c F: include/linux/devcoredump.h -DEVICE DEPENDENCY HELPER SCRIPT -M: Saravana Kannan -L: linux-kernel@vger.kernel.org -S: Maintained -F: scripts/dev-needs.sh - DEVICE DIRECT ACCESS (DAX) M: Dan Williams M: Vishal Verma @@ -8300,6 +8294,13 @@ F: include/linux/firewire.h F: include/uapi/linux/firewire*.h F: tools/firewire/ +FIRMWARE DEVICE LINK (fw_devlink) +M: Saravana Kannan +L: linux-kernel@vger.kernel.org +S: Maintained +F: Documentation/devicetree/bindings/post-init-supplier.yaml +F: scripts/dev-needs.sh + FIRMWARE FRAMEWORK FOR ARMV8-A M: Sudeep Holla L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 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); }