From patchwork Thu Feb 22 03:46:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saravana Kannan X-Patchwork-Id: 204554 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:aa16:b0:108:e6aa:91d0 with SMTP id by22csp14835dyb; Wed, 21 Feb 2024 19:47:00 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWOncM6D8IgHtS41YXF9AFmUR3Qw/XL/YkBm3nYw7air81V3JRoUhobMyKtllH/Nw7tYjW0N9vroPfUCq7SzRJxMBo2pw== X-Google-Smtp-Source: AGHT+IGNyhW9gMYNYVf+6h1cGGGheEX+wa51rPMb6/rHy07gkLzWPb9K6uY8dDUov1R2dkGImod5 X-Received: by 2002:a05:6a00:13a6:b0:6e4:c54b:9681 with SMTP id t38-20020a056a0013a600b006e4c54b9681mr1954885pfg.9.1708573619959; Wed, 21 Feb 2024 19:46:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708573619; cv=pass; d=google.com; s=arc-20160816; b=esF98p30KC46YG6GcgI+fQ8U8BWFpf3AJ73vCDZKQLZyErtJx9Hp1Ey9++HuV/y2aZ +ePDwisttmTuzrcWd8fgNxiX9aZ9A2kIIiqE3dI2QlFlG3RIJ/n3segBW9SXc3gvpq3a Pvv+G6tG14+ig5Bk70r8Jeeq76YHfQ5WsLblO+L2wb2aZhjLDw+bNO+2K3iO+umPzHMA PF+WW/HYFpl0CzdKTH0pljDJa1VVKCuJ3UeQZPGtiQr1xTKMdwQzcM/nPVxg36ZU4fz/ LAuIYTmNJPbz7/uZcYAaTQLR3Rr29dbEpcKxD/ISzaIx3w4GCv6cjF3Xx3IgdrkqzxTX 0lZQ== 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=L1U5MbITZODrN5iOioWX4JaFGd9/A/fmlRYrMAYwpeA=; b=Vg2omXYFR5bk7D4e3WpeAo2OW1KfRB+zJjQuOK0Hj2FTsjmtIaxtTNbMp6YWegAQ/i 0vAQhR++YqcaqyCTrZ2wxBFUewmD1YZBRnTvxd6+nAwMWJgXyDyQV3aOVIcn2sSOo4w2 EPtFfVljXbrWsLdvKojjV3uAp5JEgaRe6eHu3P44cOgrkzUFBVVSQPdWztY3V1jUHd0V 0+djPDQ4JCwtTrlbbLAxovudPMjoqXV6pCXJAekIJjQYJ7G0eweTW68nqd9LW6r3vZwj 6jphmif+uRv+cj4wQBX/Fk/XwJL/NJcOc9VYf2yuP2g29wwzHvHykENCPHKBOpEgm3r5 RWww==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=VNhOeutf; 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-75869-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75869-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 s17-20020a632c11000000b005ced2a6b890si3999272pgs.668.2024.02.21.19.46.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 19:46:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75869-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=VNhOeutf; 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-75869-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75869-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 B8FD4284F66 for ; Thu, 22 Feb 2024 03:46:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 95EDB1865B; Thu, 22 Feb 2024 03:46:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="VNhOeutf" 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 09FC31775F for ; Thu, 22 Feb 2024 03:46:31 +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=1708573593; cv=none; b=eobd3jys3wFY55YlvpmvslmjE8coqAqWLTmNVqUmy/ixlhhqmcFtGkHf8y+GaICXjCkEIe3gxxJfJJsEikxR1iGP+IbXOYVyuBABmQxhkVlGlZXmjbQnn9Vp8TdtFubJ+p1CJy4NbLLHbtn2XEwlVLR5dYZz7tqPxLLT+uqzvhc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708573593; c=relaxed/simple; bh=O3k+nYu1MYBPKH6TsA/y54d2ADLO3F4v2KYWl0x8bqo=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Cc:Content-Type; b=QdEOWHp0mfCqXN+ONpabgr3rfOyUjNjYGzmcmVZZlO3dDmD/DLYEq4xDkFz5X8an30L1+rXc82Rz9RtwyxpgZwVWqekO20/QrtjqUjmqgVDl1uBnvwJfP7MXWlZRCSYViL9KNMTcPOFEpel5ZzjHJvS3QUJKhZ5Maf5Tl5WKgFk= 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=VNhOeutf; 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-dcbfe1a42a4so2828944276.2 for ; Wed, 21 Feb 2024 19:46:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1708573591; x=1709178391; 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=VNhOeutf99wuKQ4mc9T//DCHqlek+iA/ffF7r67ow5P4Lgnh7YHO6RKcL0sOEl6Y7r DfBto8hTyDAO0HPwOKi0d14XYSAnEdip8lT5BieTWasTF67ZCn4GNAZZ49dvAsJbOMQ7 pBxVoR9Mx+G4iUqCVIKmhWBso5ydF6rdnETLa3WeJd7Vz27yEtrOtZjzQtS+mN7QWMY0 8oKgy/7yiHtaKqAtIccGj5e3apAPGlP+9lAqbwBF87oVmVxRjYDXyQ3yrX6GcdzBSukw NV/TdsQ4Jp220XbFeijE/pm8MioibnU9S8UmuII37oIUpLbRfxoMjSwCkGMItFKFF/Uu kHEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708573591; x=1709178391; 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=aaKt/HDBpxYZY4H0W/FlCvJ8O6bwQaLR6fosgk2/Py5JX7EIEzaHStvB9OEVurugan eQri5eA5gESZ8dkqRWQJRMd6p4IlYstMXXn0Zex5YY/21UfF2a+QxVkkNfv8L1l5n/Io peIUFt1gT79o0pTRcvjk7R16Hgw1Bqh56BoPEqFxYhLALC9uVnC/UKvX071noyoQlCJR LHcwzTzCNapIccHEGTheJAbiCGC5WnGJpsAGfppYbhmDgMYJzSZNNXsqzL2fsoluMLvz gtYut/jKUA077JKnn6sC7LAGSqv6xb7CVugziBI3oGdnEbnGTOf70ejumW6stFphHRfT /3HA== X-Forwarded-Encrypted: i=1; AJvYcCWTirNMsJsiOfTalhZluYi8Ex0MCgrgbnUuLAt47XYrBYPoVLauzflJ0x778J1a4R9tjLgT7C6u4RAh6ON7YPLrLVL4olwyG5dM9T19 X-Gm-Message-State: AOJu0YxE9pN35iBtNPKz68AC6uh4fsBO7J6O2oeqL+XhkX+K35z+vzXm lHGIvL5U3PN2rqixcmfTMFNW+s9lEJsaBy7fC04gMk/+kLdplmAm90I6MegM7vkqkWwlDoAYz4F U5OjvMjLHcVENNg== X-Received: from saravanak.san.corp.google.com ([2620:15c:2d:3:451c:c6c5:1fb1:a2a1]) (user=saravanak job=sendgmr) by 2002:a05:6902:150c:b0:dc6:e1ed:bd1a with SMTP id q12-20020a056902150c00b00dc6e1edbd1amr340344ybu.2.1708573591099; Wed, 21 Feb 2024 19:46:31 -0800 (PST) Date: Wed, 21 Feb 2024 19:46:19 -0800 In-Reply-To: <20240222034624.2970024-1-saravanak@google.com> Message-Id: <20240222034624.2970024-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: <20240222034624.2970024-1-saravanak@google.com> X-Mailer: git-send-email 2.44.0.rc0.258.g7320e95886-goog Subject: [PATCH v4 1/4] driver core: Adds flags param to fwnode_link_add() 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: 1791569292117845618 X-GMAIL-MSGID: 1791569292117845618 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 Thu Feb 22 03:46:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saravana Kannan X-Patchwork-Id: 204555 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:aa16:b0:108:e6aa:91d0 with SMTP id by22csp14990dyb; Wed, 21 Feb 2024 19:47:29 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVS58+0ilNsHzldfWkIdhDcKxEwwIcfNDjfuVDvmrPGCBHkCq64Sf0rOUJ95Ng+g9+qkrpRQprvfQcMVMbx3TmuqI2M4w== X-Google-Smtp-Source: AGHT+IGr1+PC9YQsItL0Kb5JfQynw67fkzT/hknekSml4os/b7bdq0VxdlCqzMTbXrhIhz+4OjJA X-Received: by 2002:a17:906:7198:b0:a3e:f4c9:b90c with SMTP id h24-20020a170906719800b00a3ef4c9b90cmr5231640ejk.64.1708573649782; Wed, 21 Feb 2024 19:47:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708573649; cv=pass; d=google.com; s=arc-20160816; b=cC7OgCh2E1hAU5qfdUmqVbwTdf4zQpUgpAsiCzp2a2hjSU4aJxO6eUa64FpPdd290R 7jiHgWXxTMZlDwF+2Ov3m/dxChjPn6uThhzJE0g8xNbm4NPUk/K01J+yikW5zF1cWDhk 8Tae0qqHB1sRDPxb7Z35kyJymUdTTJHXaqgYNPmJyj1asOwTZx9Tm1UurLHXRW7DDJJJ FZrc1I5tixO0Al/V+V/WSo+skmTXN7CpTLdlCL1mg8CPIdsB1LZ33epppjDqJoU6ZA53 SKSlxe3jURc46K46XXZjSHQCVzYpikb37ZyBKd0UN6nrP2fLPUY3aresMVCQ6Gaju9pe 43FQ== 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=8XHyPgMGTD3C+twqtGKwgx+5neW19KXB0S+oArEMuTQ=; b=MYH5sje+7EJXH1V+dawsMaIGej5V7Cy9Yvy6B2RaOLepw7dbv+/wsBSXjFP3RxROs+ /JN4g6ps02p7lguv7J1FyUlDNuWflXBDHreuRGle/AY+DYUkXSlNOdusBKdWi83OtL1/ NVs1nJ0bsR2tflFnb95jCdnZ9VbtOH/THI/DuqWCiguIlWMek794jkz8a/J2SE2CZQtO olMXbzUvCIah+lwr2cnNZE1mMtXrFhafzPfuBI0L3mBPIfY6aHc6gg9Q0Vn6q0CeD4CA l9h9DZf/ElKHfRqyH2dZgFSpEK2lhEEJYMHOTKRXXf3izm/AwSkYaL0HBAY4bAWQGzk6 zGgQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=Qhk18JYI; 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-75870-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75870-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 g10-20020a170906594a00b00a3e34b0c644si4495754ejr.99.2024.02.21.19.47.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 19:47:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75870-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=Qhk18JYI; 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-75870-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75870-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 329C21F23D54 for ; Thu, 22 Feb 2024 03:47:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3C3A7111B2; Thu, 22 Feb 2024 03:46:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Qhk18JYI" Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.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 D887418627 for ; Thu, 22 Feb 2024 03:46:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708573597; cv=none; b=jWd0/8rG18M6SzpXQVoH4hFBkZg3Wk5ZNzHsE7JrUa9d80nw3o+HGaNZuiUzsjvEqLXRDdMJZIglSRBjdD8X7gOcTeGkIE+YhmYfQHhI6WmHq8tQnufLZR1vMzkyF2YzrLF0Zd1oiK9LN3JXUDftyv09Kk2xEz7kinISUz9ptt8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708573597; c=relaxed/simple; bh=/z8Eu/KeLJ7IbgMJCENA0qx1maElopa30GOhgYXJfiQ=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Cc:Content-Type; b=Vt/mKKgUCZuyZGs49FvmGPaoPDNGO6T11arruOETTHFst8s/z6oOvUDThVA+cYTuFFrOgdyjC1TqzNPDDl1JM4DYUk8vkcEhoeas0zgMRGRuYjsgXvnlmeocGCkLMQuUjQPviyOFUqhEoFj3SzyewXX9fDk1IXCBWdqmPbJT4sk= 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=Qhk18JYI; arc=none smtp.client-ip=209.85.219.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-yb1-f202.google.com with SMTP id 3f1490d57ef6-dccc49ef73eso8878115276.2 for ; Wed, 21 Feb 2024 19:46:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1708573595; x=1709178395; 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=Qhk18JYIGwL3GWM+1Rd5LcpQxWCDDMvoSRBadEndPXts/NfnyFIwS5BTkz9TnHF+ef udacYejdBUnvuRa1naCEirLw6crLMjA5CVNfxhveuNK4iTu0A3rpNxusk6/gPRBGvg9J wiZFepL3apuxJu9TbmhrnzYnvy5uSRCio5Ejek/akPWfrajT96v10RURaS/wsgc8roTc CBjKXenOBc7q7jipaM8ak19oHx4LCNr3Fj+iYpRwkbhMxu+x50eIuUCkM+YlbpbMiMeW 3V5TYr6m/sI545Yqu7+sJDVYHMqX1lth7/+/HXTTd9/1t3bBvNEn2wsJ5fYodRsrQ0ch hitA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708573595; x=1709178395; 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=OoVU3urfYKmnMUkThXaCS8iWXJtzicJv0kvbc/mEy6U5OdKmxfyigxcIgXCdHcalrL CWjlv3OyP9IBClBV0qXmzANjANobWXhvvXwy/0jcIWMWnICgPxKUZFkORDuxodyPr1uK qZfWcBwNpdEbai3gvYwCpi2lpw9CwWOUsDkkIm26+laNpHTQemMr26g42MyUUHd4v2ge UNd63/OPNF+zi96LCcBd7QiptI3Rqz8ZOhhSuQONw7kk0DRa2BJdGXX8zoK7Gj4+PEHL L+/Eoss+EkvYTknYmflEL1EhYiFqOtPuY4v0yHu3ZSsXBbWzAe9TD4gbaJSkl3wECMMp 1vdw== X-Forwarded-Encrypted: i=1; AJvYcCVf8g8xlz6pz1csxGe9bsuu/E2xvUfmVsDb6ZmY/6vMtLsDKz3fCWM5rWStN+gfBoDy1Q0C6ru4yyplKGoh0bUT/L8znh/U58G55eLl X-Gm-Message-State: AOJu0YzcUZ0ehSVcmtWrslCq0wKaSgSx5+Dtb4OG7XWGpKGIJILeWbZ5 vILIBz6GLIdgyEdNcc+DDpSLDQ1zUgOk0/XcHRtvSv9qUt5fMT43tCjEAjC/O6ku/MtfE29cFl+ okuCnuRsGnWS8iw== X-Received: from saravanak.san.corp.google.com ([2620:15c:2d:3:451c:c6c5:1fb1:a2a1]) (user=saravanak job=sendgmr) by 2002:a05:6902:1891:b0:dc6:e20f:80cb with SMTP id cj17-20020a056902189100b00dc6e20f80cbmr69205ybb.3.1708573594920; Wed, 21 Feb 2024 19:46:34 -0800 (PST) Date: Wed, 21 Feb 2024 19:46:20 -0800 In-Reply-To: <20240222034624.2970024-1-saravanak@google.com> Message-Id: <20240222034624.2970024-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: <20240222034624.2970024-1-saravanak@google.com> X-Mailer: git-send-email 2.44.0.rc0.258.g7320e95886-goog Subject: [PATCH v4 2/4] driver core: Add FWLINK_FLAG_IGNORE to completely ignore a fwnode link 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: 1791569323503907920 X-GMAIL-MSGID: 1791569323503907920 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 Thu Feb 22 03:46: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: 204556 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:aa16:b0:108:e6aa:91d0 with SMTP id by22csp15020dyb; Wed, 21 Feb 2024 19:47:35 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUsLNQFezm+0gYHwIVf8J67u6Zuk7CnPcQx7cZM9b9PBS7XZ/MZM5MDKeHfn+vI0e7DQiA/NrxTzVuDRBhHZynjQGb7hA== X-Google-Smtp-Source: AGHT+IHlF4C/lwatkkfKZLd6sGntIi/qQ8jgTVTZKFtp39OR7YQ5Dr80Vzg1GzKnmzkN/WyjrUwK X-Received: by 2002:a05:622a:2c2:b0:42e:1245:d5eb with SMTP id a2-20020a05622a02c200b0042e1245d5ebmr11890219qtx.46.1708573654837; Wed, 21 Feb 2024 19:47:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708573654; cv=pass; d=google.com; s=arc-20160816; b=qtN2MtjWinCFUwGoYPpqEhS1Np2gQL0bz3SqqzZ+S49OeVvPncUDE4fDv8e00Vv3DO 7f6EERlezTHo3+V0FHe4FiqaL75y3YQWMx1Zt9X3DgQfRZpmbCQbGwlCMcQrObF0kjwK 4R93J1GHwBbA9X6NlrVyysswrsVfdDvVBzwtMACMtaPNEbuHfRp+wLOSIMjehi9BG4pI DA/mJZU72OVNlr4Cd8/IMtrSFBp+oFg5hoLIKofC0NGboFfy57wuXEvZTnJRiAVYtIjX HhqmYYbwFoEjkYsKkXSwYjTjE5+5gXagXcElHXyd9+8ErPlROmrgQaLz2DOXvV5uTVVQ Xwrg== 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=wH33w5aG2BffksVtrB54fX5fBHp+P/Q2DjXoHgc9nyE=; fh=/14qnK6Avln9/TQlMrdxc68LfOedtAVTUVRvRF1AxGA=; b=MYBHqSAKZs4lfabz7sHbH0jGO2uIlaUBVe6OJEA+2vDXAEN1i70YDBItsaa+ia2BoP PtBTXiIdAj/s3xmG7Dmmo6gG99fUxnohf7PIBSRmxxZ45mU/K+qgTGI/k1QlmW8CQzcV 29ZASnyq254+OcEXdERLHE0BYoZ9aCJ5EpCZcIFYTNa9HPwRkhk9kWKL0OxK/C0r5PRG KF6/kquDpwhyJ3+NXyg9WwviLuOedDgrwRYPyaQxkTLU38HIERKzysMENpYO34sOgNgm PBg22MwXkgrhrjgN0732RTI6AoDO5FdnFI4NOLpAgpEHk2GcCVVpdZzw70dgD/HMbOcR I6fA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=eKdfwIsH; 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-75871-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75871-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. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 21-20020ac84e95000000b0042e3c93b998si2332084qtp.608.2024.02.21.19.47.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 19:47:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75871-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=eKdfwIsH; 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-75871-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75871-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 8E21D1C22B15 for ; Thu, 22 Feb 2024 03:47:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1382E1CA8F; Thu, 22 Feb 2024 03:46:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="eKdfwIsH" 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 9169B1B599 for ; Thu, 22 Feb 2024 03:46:39 +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=1708573602; cv=none; b=EQ1hMcqPnIG1b97n+WoDXpVqIvCb8/F6mlmE3oCP0SJTX1UtL2gwgUacGYWZf5jwAX4y7TzpiYHKw8frbk4q8M0goND4D8/jVnHyXgKoHtuk8S/Dvw20QZ9EVhL02Ug8CMxgge1JdK4jRTV8mwGUjDUNop4FeyG08GT+Sj9ufZo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708573602; c=relaxed/simple; bh=cp0XJ1vg7N+tq7T/hQqrmLoRlQ0Tu1sLQF3XCorNNhs=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Cc:Content-Type; b=Eme08yPV1iPSrdNEbpTM0Tl0T9JMs8NuPi+gaBG4B+aXAlbTafNrmqImpfAVoclaJyXrj+8+RoltAeuHdA0wk7eFp6xwSgClhq6dWZn6GB/5pNaW7C5T8wHp49ErRwDu4vda8Ev+Pkm+JDmuh427GKu+Bm98vWlItMUG/OaBVRk= 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=eKdfwIsH; 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-602dae507caso122707567b3.0 for ; Wed, 21 Feb 2024 19:46:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1708573598; x=1709178398; 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=wH33w5aG2BffksVtrB54fX5fBHp+P/Q2DjXoHgc9nyE=; b=eKdfwIsH5w8eFcUFGOrDNG/nCGjXPZf/pnkbbo2V+M9kBdTsxftXqvex1bZH3QyPej vf5qtS1JqXIFAxAKDryQ3FdMVe6Mp+0bq/8FakzEjuZ6Ayub6tPlOUjT267kX4ZXMWe1 OVgbXZVa9Koexehbjaw2ii3FHjPNqATNH3DqUJwaQ7ORk+WovRD8rb/d+jknFyyxFFwA nWq3UA2LLLkKlzygJIKHDrR0Vj5AdeuXqgQvGe7tJ6P0tkyO0ECvctCa/9cKqJQpvFbM 2dAbDJMzfQWssNIDHl5xALh9sYW4wMQ0iiw5i9lvYtzMDQGjc7nG8a5ZB2zfrmHCbW4P mo8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708573598; x=1709178398; 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=wH33w5aG2BffksVtrB54fX5fBHp+P/Q2DjXoHgc9nyE=; b=H622Cml7eW0Wl3kdOmp9FoFgqjMX6U9hjc5jR7pqPvJpGxqO/HdvboOUsKXXZoesA3 SKu//8hfRzwGSLQYYSfFXVe4kqgAeREzbjmXXHZLtLh14y3wP4lV5jwpXZSGXH/QIslK 4FWOpGYP68xZhFHHOQ1diqdWK0GWVD6pji2jkMLY0dgObtJ1T5rWGgw83h2sFSNAP0YD uSrm0jo0UmU2DTDj3ZzbxQHJdclAH9TBasUdPXxQ8fdDFKFVc5S9JCrTCKZDaRXPN2es Kiau4ZWMFX0TS3+T1yLiSf23i6tViyXnpni3JuGiTKa38L7EGwpJcU/Pv6WCsJd+uK/U l6Fg== X-Forwarded-Encrypted: i=1; AJvYcCWnSdDqzyeenTvvc2WCwNpJmDOxuwKWRDEabsH3s15n/G/hxOH8J2IH0c8LnP1FuFiwVq6cgbz4Ag2UIvaqxKWgPbSx1guVrBLqrC0r X-Gm-Message-State: AOJu0Yz9PQeSZ2PFiGfkWVJtEeA5ZL75Q9Ps6hSCMjqY3OalowQL9jEU NVG0Y8HQJxmBKBJU5UPrNKp9KzkU1uFq9mLIz/uJUXar9E5ESrTBfO80pii8p7aDrF5kCRCnNne dO/firH12995lqw== X-Received: from saravanak.san.corp.google.com ([2620:15c:2d:3:451c:c6c5:1fb1:a2a1]) (user=saravanak job=sendgmr) by 2002:a25:ef09:0:b0:dc6:53c3:bcbd with SMTP id g9-20020a25ef09000000b00dc653c3bcbdmr325368ybd.7.1708573598675; Wed, 21 Feb 2024 19:46:38 -0800 (PST) Date: Wed, 21 Feb 2024 19:46:21 -0800 In-Reply-To: <20240222034624.2970024-1-saravanak@google.com> Message-Id: <20240222034624.2970024-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: <20240222034624.2970024-1-saravanak@google.com> X-Mailer: git-send-email 2.44.0.rc0.258.g7320e95886-goog Subject: [PATCH v4 3/4] dt-bindings: Add 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: 1791569328839603891 X-GMAIL-MSGID: 1791569328839603891 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..feec740239c9 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-providers.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 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); }