From patchwork Sat Feb 10 03:05:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saravana Kannan X-Patchwork-Id: 199191 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1268335dyd; Fri, 9 Feb 2024 19:06:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IE26LBomcOfcTxfZMt2/8/zj3SvqSajJmIm6iJ23KrOfvnzB44cqULqeGqnBIWLG3uK4ekP X-Received: by 2002:a05:6a21:1394:b0:19e:b925:f191 with SMTP id oa20-20020a056a21139400b0019eb925f191mr959445pzb.10.1707534393333; Fri, 09 Feb 2024 19:06:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707534393; cv=pass; d=google.com; s=arc-20160816; b=GvTrcAJ0AEhm+b3snLj9c5haXID/+7acOSEtbNkYHzpoaUaJr814LsUcA1leHRq7Ls HrklIYsdNEcjHHntW0M77xozLdcLs48KTZBSV8WLOYTwvr58KEIJR2mSbI5ykWk3hI0a RXrBRedcG2nrVC80KH1pRc6hfbfxRaTS3lZgps/TfOVk6JxaspL4SmpiGpECzFJz4INQ DtSElA7ANZIxpLeScluDwgPSgWCv09wvDenYt4t2Q9YsFIRCYo8OUX8yekTwwEp1PTbS 1BdYCumoAyNPw8JSqn/omghEQurYRK1Ytol6CYhwaQowfpKQyw9/ebYOxXfxzZQnQwaG lbpw== 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=+K3jZfz6ZJpM1n2dt5cwkWjr08+sSZMq2mLrsQ52mPs=; fh=U1S+OrlfO72NW3tUDQW8QkUtA/JbueAk68xxK144lbM=; b=PxPOD7b2mWfil5y1k5atAt8ttDYc4hIs8FUYd+1/WNUkqFlT97kd9bYm2gbOlZWkWM yn5HoCIhi2GuytVMLsAhFIUN7ffCBLcv0ugwMO843wbQclB07OLiblfefX4It/8ljnHV rT74zAywy0ZBIk/QohPqobbBnwl5zllElxNcqDhETKiE8iBak0YybuVnw5wNZQeOeEhS k+iGLoTfJySnhJ8u7FTB3tYKzpOWQr1Llq7dR6juYnOgq3Vlo5kjsNK9l1Qq43itcxgF 9c03UO6vQNhzN0NPrxOS68O98CuNlY2Fo+4MEfAS5OQDzaxcGpXBgDXT0lPaJhfM0+5K w9kw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=ACCkEIVQ; 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-60257-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60257-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com X-Forwarded-Encrypted: i=2; AJvYcCWQvl6zLlLcydhcsjZRqHSmICZDyNzo3hchrm3w7bf6QsDxf2zF2avoS8NW+9JVsQKeMUuTtihmoBS/jFAN/Fd0optcvA== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id s2-20020a170902a50200b001d9773a1991si2578075plq.509.2024.02.09.19.06.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 19:06:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60257-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=ACCkEIVQ; 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-60257-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60257-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 17B462876BA for ; Sat, 10 Feb 2024 03:06:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 24292171D0; Sat, 10 Feb 2024 03:06:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="ACCkEIVQ" 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 8CB737472 for ; Sat, 10 Feb 2024 03:05:57 +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=1707534359; cv=none; b=paYHdi4Dmvk8AjNvXCwA81Q+D4R0h2wH3RbfNM3gJ5UCHziAGcoE++q5dlVcaaAr0wQ/fYP9grqgWRmB9y3z+xtgZvArzp2I5IEaP8/q2JnvZNo6wQVLORjciv5SqOJTxnCUJZvce7sDyh7+wO3bO3TwiUhE6XsUSKtMzqFHhr0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707534359; c=relaxed/simple; bh=sWUmF3vh9o4HGU5Ho8G3VWDldprPEGq5gO9RSRL2L2Q=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Cc:Content-Type; b=Vv0GhUguSUMPfA/yY6DuqFfzr48m2M3abwKOU2QhwWSM9FUjLSKWXFNtH2A+dOxCwa8zEuVIqrPmnHZDAj8UrAQi+g/o1ox5QEdmpwwmbnCb3AjSSHTIxhicZKOEAcsfwMbmndFPGsyYq9di7d3CxW9uUIoaNPTwjtGybLjRqcY= 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=ACCkEIVQ; 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-dc746fb535eso2706951276.3 for ; Fri, 09 Feb 2024 19:05:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1707534356; x=1708139156; 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=+K3jZfz6ZJpM1n2dt5cwkWjr08+sSZMq2mLrsQ52mPs=; b=ACCkEIVQNhE4KkCsOxGvClYjkLYikGN2KYCOSdw7UtVsYTRhlxr4hCAHd0R/txQoQp 5gOShlogs+aw7kplnJEtN4GS2LeVT06Fb6gfhjOTC4g3Bp4WFB4Tgv84999Ch4/XTg1k XqVVk+eTOC8RlCF/F0jfJn3wiSJicTdw2oWtxCgVVZEasg+mgg+1Ky1i55kDf1rDr1pR WoVP3ktZ2zEZZNFf7oCTe4v1coTqLZNwh4X8tVzSqP32sS3EuKCBOSL1RDgck2zC+cGq L6cGeA4rPkfzGE4ltFsoJwxP7VMEWUmXobJsFySuQ/eYRGjiMyX3jkoDcy0SrASyn9Xq ba2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707534356; x=1708139156; 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=+K3jZfz6ZJpM1n2dt5cwkWjr08+sSZMq2mLrsQ52mPs=; b=p08VqbkX3/WbTcwEx4ZmHDJkFUlU8EAOv+mnxFUCDAu8D5qH+K1xHF1OGMqBkuUrKQ zey7vfbhVsxzDed4gjaYfPin1JjBT0AJ4XLaUWtRLG5v5CvbXAU6VVx22J4fhvs/bldC 9IYqZhcSfPnNm5ZT08LZznSDhWcq7cDa2LmmY/v/JEIXe2ijHk+Xm+qyMd8nratFleBA Igyc/amJQuUJK7aagmpuiZisO1jy1TQ64mPfh2wYdzdFwoTkdVDLLpPrPY9alz2w+xrw +4ulIRKPlODrDK1I5Hm6kZfzmgyetAalLgnhi6vlo1rgucz24sWfzhb866gdMxTy8mkL P1Bg== X-Gm-Message-State: AOJu0Ywbw0TU3jYfBmfNQkllipQ506DJ+T74XyzKgQaflLYSFPlKEGZX lBGltKUEYjV5ckw7IJkfM8Bv38ralYPmwIwZfiWfIT27L7oKbTVEdALa54m7lpVFx6bHIp2kJq2 qMO3Z5ndEElKLrg== X-Received: from saravanak.san.corp.google.com ([2620:15c:2d:3:6b44:91e7:13e1:5d92]) (user=saravanak job=sendgmr) by 2002:a05:6902:4d0:b0:dc6:f59d:73fe with SMTP id v16-20020a05690204d000b00dc6f59d73femr242739ybs.13.1707534356597; Fri, 09 Feb 2024 19:05:56 -0800 (PST) Date: Fri, 9 Feb 2024 19:05:44 -0800 In-Reply-To: <20240210030549.4048795-1-saravanak@google.com> Message-Id: <20240210030549.4048795-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: <20240210030549.4048795-1-saravanak@google.com> X-Mailer: git-send-email 2.43.0.687.g38aa6559b0-goog Subject: [PATCH v1 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: 1790479583704531304 X-GMAIL-MSGID: 1790479583704531304 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 14d46af40f9a..33055001e08e 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 39a3ee1dfb58..751c11a28f33 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 Sat Feb 10 03:05:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saravana Kannan X-Patchwork-Id: 199192 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1268445dyd; Fri, 9 Feb 2024 19:06:57 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU1Xne519rbKjzHYzEvss2m1hoUC5jl6gbSwZsjnZoTg1rXezftiOg0wqA+LRwvcMRx9deioou7JqXwa/BQYJagIdJR2w== X-Google-Smtp-Source: AGHT+IG82bZFm3IC2zksLj0LwreCRbH8a4k2/XjgNM0e5XkrE5Mn2uINJa7W5NacEtRhJV1c0EXa X-Received: by 2002:a17:906:395:b0:a3b:b334:2f26 with SMTP id b21-20020a170906039500b00a3bb3342f26mr614411eja.61.1707534416886; Fri, 09 Feb 2024 19:06:56 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707534416; cv=pass; d=google.com; s=arc-20160816; b=xOzKeD58rg536/rf7+dla8wL0WbAOPUQpo31xeXAZ9kM/WSro6M531iSveC5CjKFSB ct8F7fqEXAYN7QsTcaayrYtp2uescX1MoeH1Zs0Oh4NrID2fQoVp+RWv6g2xQ6r/n5nk J63i1krfSxGtUYXog4jeaaO0iwLlBSx1iIKuicaucdwi76H9hWz0hyAY90lTZcFhMG/i ef9Czz0VM4xraXifaIEFY2xK/irT6x+bMMXMoSoFD1NWg8MCKRLpmOq2XwxtsVpNPdpI PQZzTL8rJ/i8nC/qO0Ryx1o8iVPSBr2y/jNYjHRmwRPoBs1jm7fZf+SnFlkxvmZHB+iy VwRg== 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=5fSy7E0mRmW50qOB3N+Jt7mdFvxY1Kvxhhy9gLys//A=; fh=lF9dY62jPlPfNNWe97pb/V5Aa5kP/KUiyq1NFVSUmeY=; b=No5LGZ5km/f4PCOmrnb8umtMEJiJxUu6Iqha06cc01SXcOsbGnhFTVH25JecG8+AXO effI7sUV208EY/cPhWAJU+G9P0qEn6Hi/3TIgFvAYPKJuigGpRG7Dwx4jctYNqQRI6Y4 DueF/MB0iTBAf49j1bp60zYThFFCilMZCeBJhERSVLc3/bXQz6sEfIZwgqqIBsO6+9wZ ftNyuZS9W7/c+UJuM/GX9X7Ivd9l0KZikFpE+7XvStlMbjXOTCLW4PVMeQoFXVDjXyh7 QMos59RJw1rP3bVd7e4pG8fjVGEtuCsQDj23nFJyjhHy/DIHatbjXSSbTm077aYqTatJ Z17Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=RJK37S4E; 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-60258-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60258-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com X-Forwarded-Encrypted: i=2; AJvYcCVBbBIuk29atZ/ZcTUmA6O5+Le7vwZjpdiQzFm7q2kNh/UPO8PEqF/2+Wu5YLws9KKrAozVi5jagLxCmZ5eFxkBOkU5og== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id d7-20020a170906040700b00a3bbf706e5asi1495467eja.96.2024.02.09.19.06.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 19:06:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60258-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=RJK37S4E; 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-60258-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60258-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 9D8691F236FA for ; Sat, 10 Feb 2024 03:06:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5546920335; Sat, 10 Feb 2024 03:06:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="RJK37S4E" Received: from mail-pl1-f201.google.com (mail-pl1-f201.google.com [209.85.214.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 AAEAE15E99 for ; Sat, 10 Feb 2024 03:06:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707534364; cv=none; b=ZqHCYMuQwRoC/Jp1W7p9sDcPxpt94yAlyT5euLJCqagZxH/Kh+aCOvo2w1EpkrtYuBto3cvGM6Pr6V0oCdRs7DQratilKKlZqckVnvxSbJgcOE9SqzLnXrznBQsBWNt3SHjILV7ic47WlnRdezxk1or4I8Zp3ZsheQSQDArTx0s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707534364; c=relaxed/simple; bh=iEDFuhE8mOQtSS/B79HZRgChFrCS7/VJXwJaloRdLeI=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Cc:Content-Type; b=NIAd5qQV6DmF2dcWto5HZRkNvSj8iMXDGJWkDUBOzuwAoYHLSx86Je7Fn8UkUMgtTY9vI2z5zwm6s4YN51ccQ7saZHyMWl4bNGkMwRy/rmFXYSIjXCAM/TzY3hzHlx9Uah9g3Ljyi+lb5l2Hz9A4XGGNDsRopvcxOu4xerKHSaA= 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=RJK37S4E; arc=none smtp.client-ip=209.85.214.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-pl1-f201.google.com with SMTP id d9443c01a7336-1d950445c0bso20535575ad.2 for ; Fri, 09 Feb 2024 19:06:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1707534361; x=1708139161; 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=5fSy7E0mRmW50qOB3N+Jt7mdFvxY1Kvxhhy9gLys//A=; b=RJK37S4EgogTgmG8r4v6aIVIVO9nqQFNXTAaU1tT2aRuHhL0IXlmIl3UcqVF0P+nsm 20lzJw1/s5hMABm7QxC5NOEuI0hIdfErY1usuhpHFCs0tl5v9ZSOGus/z3zrFZDNoJqA aeHf+f3RprulHXkbfiOAkG9xeaSqswgPShQXHJX4WowQxb2st6Aawr7zPSr3WKOytRhj sRZeKsidmhC9xO5ufN2pHzlkWKYIDuLWEMGuf8b6o/YdM/FAu2yG4gUnCNY1Pf1No+ky Ct/NksQG/Xvl/EuAdjTuwk6zzJxITcV3MgNC/oqVGX4376xG64Ayaq3QSkO5Gq4SDDaL 4xVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707534361; x=1708139161; 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=5fSy7E0mRmW50qOB3N+Jt7mdFvxY1Kvxhhy9gLys//A=; b=dYwollj6jj75Y1I34u4P/gl7vcz0XLVPUas+G6fF9z1B+ry6SwucDphQ9n1X/jyXlN 2PCLAIBQtJeTnfAbxKN5XPN+xKMuAupxO0zDn7lWmQGXw7BdSoVXaO1nglEhU34TppNK hzOfKwJwjpG8kxSAJe0iPAzxFSbNH0zG3D//cPmKzmFR067z3WQcmNOWDHDRwO9t0n4W wFee5J7gd1ngJEbF634mMVK+QlfkFmTnUWCYYnod3BCP4/VxGxOzr9m1rmcsSgF7Zi1T kNXDz2vsV1PNvgykkWG3i3Pz3P7Jw0M817SYziRglCgJlKQaS3TNF8YmEK24ohM6/b0w UlYw== X-Forwarded-Encrypted: i=1; AJvYcCVmktN9HmPpC9rQmZV5DnGd0piQjemzQwrQtWQaVmYoJxEoOzOfDG+aaKDmtfzt7SZdC0hW4b5xRFqWyWATOFS8W6Xrws94Jsdj7c9Q X-Gm-Message-State: AOJu0YwynZmWeFcKOgy0BMpQ5WH4QX8iHQ5QwbFoX0QX0t68R6vNqTia dHseJENbH8OLdyPFVPm3mWY/cvzucZBLnfZTWMNA3VVs2m0SGlTGcTIBzBIuwT7eEo2iz3Td2cr gwhHJ2wRsOaHMuQ== X-Received: from saravanak.san.corp.google.com ([2620:15c:2d:3:6b44:91e7:13e1:5d92]) (user=saravanak job=sendgmr) by 2002:a17:902:d4ca:b0:1d9:5d39:9438 with SMTP id o10-20020a170902d4ca00b001d95d399438mr2814plg.4.1707534360849; Fri, 09 Feb 2024 19:06:00 -0800 (PST) Date: Fri, 9 Feb 2024 19:05:45 -0800 In-Reply-To: <20240210030549.4048795-1-saravanak@google.com> Message-Id: <20240210030549.4048795-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: <20240210030549.4048795-1-saravanak@google.com> X-Mailer: git-send-email 2.43.0.687.g38aa6559b0-goog Subject: [PATCH v1 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: 1790479608548311875 X-GMAIL-MSGID: 1790479608548311875 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 33055001e08e..bd762d90dac0 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -1010,7 +1010,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; @@ -1960,6 +1961,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; @@ -2033,6 +2037,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 Sat Feb 10 03:05:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saravana Kannan X-Patchwork-Id: 199193 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1268531dyd; Fri, 9 Feb 2024 19:07:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IHHbj+D/7tHCTqYicY7LAV6NzLYj+qT9CWaVjvQFkQy1xO/fZ1yMQcJvYMpExHY7TXmltm6 X-Received: by 2002:a05:6512:3b09:b0:511:7259:370d with SMTP id f9-20020a0565123b0900b005117259370dmr500696lfv.33.1707534432763; Fri, 09 Feb 2024 19:07:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707534432; cv=pass; d=google.com; s=arc-20160816; b=oEOkflExcGOCiyYBrXxJprxX8fQzna0wBrXg+eUvqEph2w/uGrbSm6h6EhN0HAcBzq haQGOSKNQ8IGPPBDecc68mpw1H3oB0xuEqB/Szz1J5HM0Ay0Z5jQaQAZ9MFNhgZAdF9g cVZe8ThQAnqq9R+hQ0yUtwqhOcg/aOEAVRmXg9+me1J85Qzwm7E9ohj1eoc6dHs/F3dI Y2iTXErIlSiFF+Li8Ackv1z4fQ1a3E/tR3e79DfGS8voWv8vW2/MO5MAqUPAeIhppOlE RlYdOB1hC0gYLGHItBGYr5gLJXXDxLIKunnWQHIjnu4bBwKkL/jifnyfCWxnXWTM02VI dgyw== 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=EuboiLM3PiYaUht/sxY2s97Ou0aQoJajqakxuwnzARA=; fh=XNwNONzzhZow9WWCLvqEMpe7zEXy+asBWVpsqK70PgI=; b=jUvRBqQOa2f0EUFJPVJQ29Y4pCLu71J79fwFeCdmfzimjPQJHa3XeGUA+N1ihUH9n8 DFeaHcFH3F2q/GqIQbeDBAFq2rapcmC62CLmCkPU8eMQrtQJgX5eN/xJxLvAblMov+Gp aPI0WHHm2gOjx7h8MgvTgPFDBzY60lldZXPVqDe3UMhy/7lZ1sHv0c6sPJmfekFixrjW PeE2KErCJR2uAnbVsfqFNzCRtZz/EX/bEHyIHLlJ3KXydOfavNKSEsStl8XVgTBaEozH Zh2WtCwNbWwhYkITNCgmRfh9mlI+HtVTA8BJdceragvVzlz+6za5k7zoi4YWID/whW6q ettg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=MmwUDtzn; 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-60259-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60259-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com X-Forwarded-Encrypted: i=2; AJvYcCW939jAAhpy8c6WURvT79J3iT7u6k67fje51Px/cwftL/hepgFHl0hMMHqraRFi4SDmnLS6QJRFi0xcpxZTiNorraDCrg== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id gl10-20020a170906e0ca00b00a3c1ed29de8si430114ejb.614.2024.02.09.19.07.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 19:07:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60259-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=MmwUDtzn; 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-60259-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60259-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 244121F20FD6 for ; Sat, 10 Feb 2024 03:07:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AFE645234; Sat, 10 Feb 2024 03:06:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="MmwUDtzn" 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 75AEA1EEFC for ; Sat, 10 Feb 2024 03:06:06 +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=1707534368; cv=none; b=hCOPPOvm0pA9c+F/XRjaz4d6D1g9lF02a3xYVRYnhfhGdDOTgxaAhD/3A06QtmbLTLX/iCWzz34q4yk3yqzOrxOcSVIpkhdolnirA2iC5jIljhZk318FSJvcO2YdnGdzKbnnNHJzyK7rUa7B4SxEEw6vpwmVBozVkSjw3mCcqJc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707534368; c=relaxed/simple; bh=DDHVFJw3laeMHNAD1vbR4GSUPDGUWbNquUH9HPPVOrQ=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Cc:Content-Type; b=kBDgIC0AcV1Ahy+MIBeF0Yj6oL+/2AA+v8Xvb7ohVUSoKY0vofdaduX/v43H5daODEmBPuuwIryst/9noCtQSIniDvXqw+q/YhSk3+94L2SvMiaWcHtQra4WBHrPfPccbg1x3FXx5L9qr936z01UY3zgwxUWgQeiPdzy+9PYREQ= 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=MmwUDtzn; 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-604a4923adaso29403207b3.0 for ; Fri, 09 Feb 2024 19:06:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1707534365; x=1708139165; 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=EuboiLM3PiYaUht/sxY2s97Ou0aQoJajqakxuwnzARA=; b=MmwUDtznU4pxEV4YFkbbIuvyK8q+MXrRpXGgAtD4vZCbDvQHhZ8VOe8H4NXU/A7iEp k6c7lTUevqRFn/tAlvcZxnv29/YviWAEdZVHZ3sFNj9Svs2WHV1k5oxqZWcCIPOTOx9C 5zEBzpCPUNzTrT3Y1AKjUaceKNe2nREYuB7AtTaBfoRFn8n8aOthXZ+e2vAFOw93n9AQ EZKB5pgOEGDw7rRJMVW3mqrmnCS4181Uv+dJEG9fcodVrroqyZIRy8wjTiF1jPwVEaOf Td3NDLI0u5TQJYZMzrH1cICk97SEVJcELB+Y/2AyYj9HdWF8qZ4fa9FNnPh8ZHw8iQGl Avqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707534365; x=1708139165; 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=EuboiLM3PiYaUht/sxY2s97Ou0aQoJajqakxuwnzARA=; b=XVpwTQRPPqysN9piYI4Hr5dd7B6lBafYUvOsJ6ZfgJc5J8ZpLAXlfKCtBK5z7vdJAu ncfuz8jPR26mSLFH2o5ru62MEEVRLckPATbyYOXqfoKc/wqVI2ktGPQTBr+eAn+/wv5P 1ayYlwl6a3nL6gikJAJ/zV8QETP1HbbS+U7Jumm0AsxADzau2Yp2TlTJhCDs43znoUUT hqUrajIqwKQpJIzfLH7I6n+5v7F0rsb2Xqde8SnV17aA3VJr+BYS+d8gtHYyUoNSV9Kf 9cA8MGunZUptarFKoqbfaNN4l5MSm6EbLTfBvHfN0RQfGIpmII8QqpMGGyGGMAqf9PCm 37IQ== X-Gm-Message-State: AOJu0Yz1SgmgvNT9XHBii2pxxigxXTMj4QKNsHo50U1fXxyAMlOwa4Kh smdulUXU14LL8I0vv7lsZeyT7wcM9Iv4KLM0DX894lG7MLmYt8T5EzFfMLKAUV2U/AlW0ImZrLi CtaVmkh4ThvBPmQ== X-Received: from saravanak.san.corp.google.com ([2620:15c:2d:3:6b44:91e7:13e1:5d92]) (user=saravanak job=sendgmr) by 2002:a05:690c:884:b0:604:d53e:4616 with SMTP id cd4-20020a05690c088400b00604d53e4616mr179243ywb.6.1707534365489; Fri, 09 Feb 2024 19:06:05 -0800 (PST) Date: Fri, 9 Feb 2024 19:05:46 -0800 In-Reply-To: <20240210030549.4048795-1-saravanak@google.com> Message-Id: <20240210030549.4048795-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: <20240210030549.4048795-1-saravanak@google.com> X-Mailer: git-send-email 2.43.0.687.g38aa6559b0-goog Subject: [PATCH v1 3/4] dt-bindings: Add post-init-supplier property From: Saravana Kannan To: Saravana Kannan , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Greg Kroah-Hartman , "Rafael J. Wysocki" , Ard Biesheuvel , Frank Rowand , 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: 1790479625161583059 X-GMAIL-MSGID: 1790479625161583059 The post-init-supplier property can be used to break a dependency cycle by marking some supplier(s) as a post device initialization supplier(s). This allows the kernel 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-supplier.yaml | 99 +++++++++++++++++++ MAINTAINERS | 3 +- 2 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/post-init-supplier.yaml diff --git a/Documentation/devicetree/bindings/post-init-supplier.yaml b/Documentation/devicetree/bindings/post-init-supplier.yaml new file mode 100644 index 000000000000..cf9071ecd06e --- /dev/null +++ b/Documentation/devicetree/bindings/post-init-supplier.yaml @@ -0,0 +1,99 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +# Copyright 2018 Linaro Ltd. +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/post-init-supplier.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Post device initialization supplier + +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. + + A device can list its suppliers in devicetree using one or more of the + standard devicetree bindings. By default, it would be safe to assume the + supplier device can be initialized before the consumer device is initialized. + + However, that assumption cannot be made when there are cyclic dependecies + between devices. Since each device is a supplier (directly or indirectly) of + the others in the cycle, there is no guaranteed safe order for initalizing + 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 if 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 supplier 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 supplier(s) is not needed for initializing the + device that lists this property. + + In the example above, Z would list X as a post-init-supplier and the + initialization dependency would become X -> Y -> Z -/-> X. So the best order + to initialize them become clear: Z, Y and then X. + +properties: + # A dictionary of DT properties for this binding schema + post-init-supplier: + # One or more suppliers can be marked as post initialization supplier + minItems: 1 + description: + List of phandles to suppliers that are not needed for initializing or + resuming this device. + $ref: /schemas/types.yaml#/definitions/phandle + +examples: + - | + gcc: general-clock-controller@1000 { + compatible = "vendor,soc4-gcc", "vendor,soc1-gcc"; + reg = <0x1000 0x80>; + clocks = <&dispcc 0x1> + #clock-cells = <1>; + post-init-supplier = <&dispcc>; + }; + dispcc: display-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 3dfe7ea25320..40fd498543a5 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -6055,10 +6055,11 @@ S: Maintained F: drivers/base/devcoredump.c F: include/linux/devcoredump.h -DEVICE DEPENDENCY HELPER SCRIPT +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 DEVICE DIRECT ACCESS (DAX) From patchwork Sat Feb 10 03:05:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saravana Kannan X-Patchwork-Id: 199194 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1269459dyd; Fri, 9 Feb 2024 19:10:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IFE6f4cEowouCq4fU96DMtW9FyB5ep7ZIAWb6zNhlsOEs4Uyv2osXEDX75u9jjVxUJSXijJ X-Received: by 2002:a05:6870:b09:b0:219:7535:8d50 with SMTP id lh9-20020a0568700b0900b0021975358d50mr1227110oab.23.1707534622781; Fri, 09 Feb 2024 19:10:22 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707534622; cv=pass; d=google.com; s=arc-20160816; b=bzgPqIJ1jidt7EszOPiGfUCaYqwzIeKC1JT/f/iYBfK4XNfjJGrz1nUQHLdAyUXVzB 8KCjnryWYEMIebnNUcJRhRrO2N82QTbJ9jctNj6js090/01g1vRJ22pHcEKZf5tpcZ34 j21Fbyh8+ckyk98hxY/lgyBh5yNNsvJd/5r9GHH882kJmRsPYe+SORnkedzEOYrvb3wx JCRJw8CfWUaVoKMVoyrKXn0JJfZNlXI76epCts4NAx1HVeC+dlP08FNHtXF/wFoPm9ZQ z+aqoL9jOauSAi7Ra2UmZ0nG0TJrS2neC3C0Yxu+d2DLBoKD8zbNFJ8DrMd4t8gkGLpk XKvA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:references:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:in-reply-to:date :dkim-signature; bh=F5s7UC2LI5606ztlkySRh4zEDw9ZNIX2+7Suzh+XsVU=; fh=eU2TmqA+mlKzZolEgybrglSaKKYm7+CF7qZjR1/qO0g=; b=d0aD36XQEB14wUOYdoGn9gZA7Lx3PopR5Ww/Ws7eClOonbDwKK44PspyxZWpdqcg1l NNJ6vbyO37pzYJEG/IrnuUyU6aohaBH767rLCfjsHpniVWj3BYMSI1lpkqIj+Ne9lwo2 JDGUZJqD1SrnUakkMV05jq7Oo2UZq75JraIWtijXFD4JJoK3LfN5k1skw8gvpioD3v9p JuBInNT3TsYrJe1Y4/p/VjSIZOpG5e5Wc5ADikCUTYBPVAr9xcQHeYdEMqVf5lF7h3in Bwea3aVLsFV0kdv8k1C1cpMmz5viwJf34IFYY3ghu6Nx2UhUUgaHa8yK7VFmAkReVH3p JlLA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=pvopdkzM; 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-60260-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60260-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com X-Forwarded-Encrypted: i=2; AJvYcCVKU3iY9mrxhBe88ASvYT6NMtM0cTflofBVIIb8c/qCiJIwd/p1zgcY3IpYY5iJ81Fj/NMWkr6DtfXc9i1cyaiRNqZmxg== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id f18-20020a637552000000b005dc42c4775csi2671144pgn.822.2024.02.09.19.10.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 19:10:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60260-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=pvopdkzM; 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-60260-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60260-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 A055EB2792F for ; Sat, 10 Feb 2024 03:07:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 50A0B32C9C; Sat, 10 Feb 2024 03:06:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="pvopdkzM" 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 023EF29D03 for ; Sat, 10 Feb 2024 03:06:10 +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=1707534372; cv=none; b=tNZuROkC2iW7xdmNik6qBDbS7INf6kqHuO2dRMPkvotnWDlGFTLxq9tV1Hc6XevRCbtO+eDAJGrI1sEY6jOLAVzxbdGVNlC/GsDFGHMSxjsHx6myh2BEWJVm8QovKCqzqRkbP4SOylWiUSn/krJLVPN6YyNMuMMNNEe5Rv2Kkqs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707534372; c=relaxed/simple; bh=09nOuvy1xCjK1iYqCopDQXrnPVKpNm2a5rJaJXsm9lU=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Cc:Content-Type; b=V62XNQCNaSyQs0APOrTIRyAdFp5qKgLp/ECrs9ap1hd4NgZqVylNQijGT+GHg8JlBCW1odd3sWPTAoim3bP35ifb5By7CAXRjhQIykicoKAyFXp5ibnzUt3UA3zdDlPNYtRi2V5fPugfkX41IccSzj/ziUYQbjQXnKLCSYTddmQ= 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=pvopdkzM; 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-dc647f65573so2774481276.2 for ; Fri, 09 Feb 2024 19:06:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1707534370; x=1708139170; darn=vger.kernel.org; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=F5s7UC2LI5606ztlkySRh4zEDw9ZNIX2+7Suzh+XsVU=; b=pvopdkzMyY7gcSDnmuhMe1Lrbk1BKJR51rbeNR4MJLexjtGVOpCgs29lJ/dds4s8ZQ ECWW/fQO6z9RAjRwBm4vQXP9XTyrPdmqm+UIvEAkCwh680T3W4TY9rOHlqDbQULHo7aK g7eAqBA1kpjkaqgGNM2mPe1eqhWyqI0bcmpk7BTziBBYJsFEzyqzit+Otvz/EhnFxzxq U9Dj4wP6V25ucXHOLUR4KAD0yvVCfiFo8CKXfTDB8zWUE/WicBMsrE/XfxJwTnUK54HR wr+m7byxq6mJw9Vsgvdq0s5oOMMrcpRmKd61MAX3ws+RdxKOpydJtWCE3ct4Jq3ELdbn nRmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707534370; x=1708139170; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=F5s7UC2LI5606ztlkySRh4zEDw9ZNIX2+7Suzh+XsVU=; b=Rb6o34L9ahejux1xxZRlV62Ni64Ojrxo8jYdKz4Zd+QgiqB2KCneexTEbxIaFKlPEw CHHRRTeTUwtZZBGrL7oox4KOjBpIcE3lQ7d3pOX6aM/EY/r6cksU6naqEm41PTHNKb6S 2/lbVwM1LUwt0lTFTJMircBumcWGZN1NfbjphyENuxhSB3O7mj0L/qc5DbVSzKycTjMr f4TdDYuiz5m8qtSVMunOgvhc7dkRlxwa0RUsMsI3pgfLTnDZ/BRfgUSBWfLn8QZIyYJg RCwL5+FMSQM4GtOyaYFxyzmF9zkWvg79pGlt/+omE/uJg7Yy1z/WD5HyG+ZSHlxV/U60 pdCQ== X-Gm-Message-State: AOJu0Yw5OBeITHvg/4pBU5CcFCSTjXicV+4FvylRAc4p1ycPjx7dDEKS r+dIDP2AOQQYD710jU8iSV27czNGOsg9A3dEtHSMd9sehrdOpfXgoA8RkwzNo8XknIFCC7zhE3h LzMF03J7uz6JDtw== X-Received: from saravanak.san.corp.google.com ([2620:15c:2d:3:6b44:91e7:13e1:5d92]) (user=saravanak job=sendgmr) by 2002:a05:6902:1006:b0:dc6:ee88:ced2 with SMTP id w6-20020a056902100600b00dc6ee88ced2mr254743ybt.12.1707534369357; Fri, 09 Feb 2024 19:06:09 -0800 (PST) Date: Fri, 9 Feb 2024 19:05:47 -0800 In-Reply-To: <20240210030549.4048795-1-saravanak@google.com> Message-Id: <20240210030549.4048795-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: <20240210030549.4048795-1-saravanak@google.com> X-Mailer: git-send-email 2.43.0.687.g38aa6559b0-goog Subject: [PATCH v1 4/4] of: property: fw_devlink: Add support for "post-init-supplier" property From: Saravana Kannan To: Saravana Kannan , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Greg Kroah-Hartman , "Rafael J. Wysocki" , Ard Biesheuvel , Frank Rowand , 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: 1790479824964970722 X-GMAIL-MSGID: 1790479824964970722 Add support for this property so that dependency cycles can be broken and fw_devlink can do better probe/suspend/resume ordering between devices in a dependency cycle. Signed-off-by: Saravana Kannan --- drivers/of/property.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/of/property.c b/drivers/of/property.c index 751c11a28f33..dce451161c99 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c @@ -1066,7 +1066,8 @@ of_fwnode_device_get_match_data(const struct fwnode_handle *fwnode, } static void of_link_to_phandle(struct device_node *con_np, - struct device_node *sup_np) + struct device_node *sup_np, + u8 flags) { struct device_node *tmp_np = of_node_get(sup_np); @@ -1085,7 +1086,8 @@ static void of_link_to_phandle(struct device_node *con_np, tmp_np = of_get_next_parent(tmp_np); } - fwnode_link_add(of_fwnode_handle(con_np), of_fwnode_handle(sup_np), 0); + fwnode_link_add(of_fwnode_handle(con_np), of_fwnode_handle(sup_np), + flags); } /** @@ -1198,6 +1200,8 @@ static struct device_node *parse_##fname(struct device_node *np, \ * to a struct device, implement this ops so fw_devlink can use it * to find the true consumer. * @optional: Describes whether a supplier is mandatory or not + * @fwlink_flags: Optional fwnode link flags to use when creating a fwnode link + * for this property. * * Returns: * parse_prop() return values are @@ -1210,6 +1214,7 @@ struct supplier_bindings { const char *prop_name, int index); struct device_node *(*get_con_dev)(struct device_node *np); bool optional; + u8 fwlink_flags; }; DEFINE_SIMPLE_PROP(clocks, "clocks", "#clock-cells") @@ -1240,6 +1245,7 @@ DEFINE_SIMPLE_PROP(leds, "leds", NULL) DEFINE_SIMPLE_PROP(backlight, "backlight", NULL) DEFINE_SIMPLE_PROP(panel, "panel", NULL) DEFINE_SIMPLE_PROP(msi_parent, "msi-parent", "#msi-cells") +DEFINE_SIMPLE_PROP(post_init_supplier, "post-init-supplier", NULL) DEFINE_SUFFIX_PROP(regulators, "-supply", NULL) DEFINE_SUFFIX_PROP(gpio, "-gpio", "#gpio-cells") @@ -1349,6 +1355,10 @@ static const struct supplier_bindings of_supplier_bindings[] = { { .parse_prop = parse_regulators, }, { .parse_prop = parse_gpio, }, { .parse_prop = parse_gpios, }, + { + .parse_prop = parse_post_init_supplier, + .fwlink_flags = FWLINK_FLAG_IGNORE, + }, {} }; @@ -1393,7 +1403,8 @@ static int of_link_property(struct device_node *con_np, const char *prop_name) : of_node_get(con_np); matched = true; i++; - of_link_to_phandle(con_dev_np, phandle); + of_link_to_phandle(con_dev_np, phandle, + s->fwlink_flags); of_node_put(phandle); of_node_put(con_dev_np); }