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;