From patchwork Wed Feb 21 23:30:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saravana Kannan X-Patchwork-Id: 204491 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp1357363dyc; Wed, 21 Feb 2024 15:32:10 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXKzOaCkZ2ItOdR7PmJ0r9/VIlsSeovDk2u3ImeImVMXkFlVeAS485PdcQrY8JRdF1n/CXNq0GE+WWG5vb1zc90lTYP3Q== X-Google-Smtp-Source: AGHT+IHtS9SmedvOtKkCz4kyjoulDyd0pzPTJ1oPj6ApH1jmTDf5va3b5gOP/IP4L1GJBsO5qmCk X-Received: by 2002:a05:6a21:670b:b0:19e:cf1a:5376 with SMTP id wh11-20020a056a21670b00b0019ecf1a5376mr19207547pzb.40.1708558330494; Wed, 21 Feb 2024 15:32:10 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708558330; cv=pass; d=google.com; s=arc-20160816; b=YQeKZ0ZFDjy7d2gw2B1PAUGA9ydJsKXL4WFPw2b8h/xYhHVAEyC/LGNYUVA7WnaYUT bvVpyB0PCQvi8gfEm2XF/YpaQVLNDQHmessFvsGaTSdEgAhiYnFC8oyS6NYvH05fUqS3 pIz+5iwBv7eR59aHDzqHSyafRLSVpxkYO1Zab9f/wB82K4baw1obUK5/NrZKXI07rfhx RVEjRqjd+n/Mlm9Dk0DC2g0+XiYzRRYYbGDrNsjv6/K4jj+n8qOt30/RppMauRA2nqQI GEuZfH+ANXsCgIzWW//NT68Aj+T7xnnm1LLdO9T29fY5OWiMmB6oWjFv45Ijjak4rB15 f6UA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:references:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:in-reply-to:date :dkim-signature; bh=hz8i/GyBU5B3ALvYkkFzM0iQaG+ZmlRW+5k11B+Bktg=; fh=Ps+upxH9t4DyppcZ4bQHsd+wL0yzgQCYZ3zG9Z6IJgI=; b=DeRi8h03TPvnJ4FUPO5w9JIz2VlrQZqmU4spIBvn+GPYy9n3xRY8befgW750Hk7QSO 6J+Tx+4xl0c0Rhk+cBZWKLDfWqCN8aPu2h+FZ/t1hEKWJaGcmLEHIyeGoW1HzI1FzpBP D5/0tLt8oZw8XYnLjauInjyQTkk09ToQUolkSRO9KA2J3YAt4obu0zr3BTH17bMOfkLF +PkAAusc8OVcqX2PVJ0pCYQQvnUc3VosIE1dx9vl9ZuAnFkEr5brsG+OUSdvP9aZ5a4b FZFUX25Og+EzlX4d2cpw4nek/vS/PoI+nOsYqGs5bpXdQE3eexFv03LfTA8GfSsuM1OQ bdiQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=kdO1X11a; arc=pass (i=1 spf=pass spfdomain=flex--saravanak.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-75657-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75657-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id h7-20020a170902f70700b001dc4adb4c79si174184plo.361.2024.02.21.15.32.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 15:32:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75657-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=kdO1X11a; arc=pass (i=1 spf=pass spfdomain=flex--saravanak.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-75657-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75657-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id D7BD52832D0 for ; Wed, 21 Feb 2024 23:31:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8609E12C549; Wed, 21 Feb 2024 23:31:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="kdO1X11a" Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 55CC412A14C for ; Wed, 21 Feb 2024 23:30:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708558244; cv=none; b=Xnn6iu3AMAQTiIRf90teGombPQsEkFz3MuC39gx1Ix/gbWNDmDrK6T8qKrRxTOAEbCu1PTXuzyyesBrv1gSv/JSOz+dpNfEPMVmpppA0n6fuShNkoifPpXSS+vuE7QPRR7QdO7ihnCrCc21rtteIZL5O9R3bcTzNwIc7fgqWqYY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708558244; c=relaxed/simple; bh=/z8Eu/KeLJ7IbgMJCENA0qx1maElopa30GOhgYXJfiQ=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Cc:Content-Type; b=slSmRmNY5z9XaYVZ3pF3VmpO+SrgzcQjysYWoQWMYgq21qTMOxT/pCchnQm35BhaDt0omjpiBW04VBLr3LTYX4ojOJYlCrOfl+khEq1UkmSH0F6Gk8opt0h6G5/AYQdyWuwkz1shYMjLix2LIEr1S/eL5b2V3C53uB+hsPYsx3Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--saravanak.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=kdO1X11a; arc=none smtp.client-ip=209.85.219.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--saravanak.bounces.google.com Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-dcc0bcf9256so8207955276.3 for ; Wed, 21 Feb 2024 15:30:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1708558239; x=1709163039; darn=vger.kernel.org; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=hz8i/GyBU5B3ALvYkkFzM0iQaG+ZmlRW+5k11B+Bktg=; b=kdO1X11aIl4Lz7Ab4W0RtCxTzU56PzthcPHHI74ohhv9ewWe1BQvHC+DrAEh+cbjhr Fp+9Eu+WgZzFYjDQ0JtVpWAXOa0AGSg4Do7kj84E/1KhFejG9QjzkAXrYgmpBsB5umwu dONIbsErrDxfNkSphy/oxoI6zfmxkQsfBZA4T3Z/Pj0jBxb2ujm6H6b+Z3t0513bG45o bOugM0UE7EdMZ47G1OEC1baI0WygVYOA38IsnHN9oyd4+TLn80jLmpSmIJh6kLeHBghq 5J/22fDE24RDjzKWl5ysDngxe0v3oNmAWd4NSqw0Yrdz517/0UNIfWnVp5ckce2Tqy/y f4pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708558239; x=1709163039; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=hz8i/GyBU5B3ALvYkkFzM0iQaG+ZmlRW+5k11B+Bktg=; b=HLqGnP83jBAOmgmw99rdvj0jn5zGJZpyyEys1918XiFUW+3mfFaew9Su7lC6l4NpmQ wn07Zl/JeJ6VcrsQR9ebVhsu9AQRPCg2Odp2vsGIrQ+AvA3L95OijK8YKWbAT+OkoyIC tBAYfdu+O+9sW50mHqTsiV6aiu0pukZo0ImGQ3+25iQ4t9i8yJGnsdh3atFJtWHMGA7j JpEWRAejBVbr2g2/nPolOp42ooLp+2FDBa+elEbmXJR/aBiSkFhm3TS/BXDF+nBEFt26 Wvk2NGyyeb6dKeU8D+5k7Wrx0R7O69I5t9ek22TiEPMf7AF4Yj9gSjHI6Rs3IdCglx0g FxhQ== X-Forwarded-Encrypted: i=1; AJvYcCUMI3vSOcb8Nw2ngUWM+8SEsTXL8HaSVGLMaUhE1dfKlQgiHrT6fwKsx5HQeOMQVisepnb6dxXqzvdx/FQoumL7XxA99IR9440MaaiY X-Gm-Message-State: AOJu0YzwTKU/gTzJ6XAxgHhlPOVEEd0N/dRgoZTN98fKYultYzaU8Iy1 PbURNTGhOuK2bS3ptYCMZrCsZvDcNEIDxQdPg8UamNDw12aRS4JBToSe+IXfmJEeb+7yFrj+V/O /O+/+rZa/j3+mWg== X-Received: from saravanak.san.corp.google.com ([2620:15c:2d:3:4e1e:336a:2b30:13fe]) (user=saravanak job=sendgmr) by 2002:a05:6902:72d:b0:dc7:3189:4e75 with SMTP id l13-20020a056902072d00b00dc731894e75mr30785ybt.3.1708558238961; Wed, 21 Feb 2024 15:30:38 -0800 (PST) Date: Wed, 21 Feb 2024 15:30:22 -0800 In-Reply-To: <20240221233026.2915061-1-saravanak@google.com> Message-Id: <20240221233026.2915061-3-saravanak@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240221233026.2915061-1-saravanak@google.com> X-Mailer: git-send-email 2.44.0.rc0.258.g7320e95886-goog Subject: [PATCH v3 2/4] driver core: Add FWLINK_FLAG_IGNORE to completely ignore a fwnode link From: Saravana Kannan To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Greg Kroah-Hartman , "Rafael J. Wysocki" , Ard Biesheuvel , Frank Rowand , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus , Len Brown , Saravana Kannan Cc: kernel-team@android.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org, linux-acpi@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791553260224500522 X-GMAIL-MSGID: 1791553260224500522 A fwnode link between specific supplier-consumer fwnodes can be added multiple times for multiple reasons. If that dependency doesn't exist, deleting the fwnode link once doesn't guarantee that it won't get created again. So, add FWLINK_FLAG_IGNORE flag to mark a fwnode link as one that needs to be completely ignored. Since a fwnode link's flags is an OR of all the flags passed to all the fwnode_link_add() calls to create that specific fwnode link, the FWLINK_FLAG_IGNORE flag is preserved and can be used to mark a fwnode link as on that need to be completely ignored until it is deleted. Signed-off-by: Saravana Kannan --- drivers/base/core.c | 9 ++++++++- include/linux/fwnode.h | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/base/core.c b/drivers/base/core.c index adeff041d472..fac017657d25 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -1012,7 +1012,8 @@ static struct fwnode_handle *fwnode_links_check_suppliers( return NULL; list_for_each_entry(link, &fwnode->suppliers, c_hook) - if (!(link->flags & FWLINK_FLAG_CYCLE)) + if (!(link->flags & + (FWLINK_FLAG_CYCLE | FWLINK_FLAG_IGNORE))) return link->supplier; return NULL; @@ -1963,6 +1964,9 @@ static bool __fw_devlink_relax_cycles(struct device *con, } list_for_each_entry(link, &sup_handle->suppliers, c_hook) { + if (link->flags & FWLINK_FLAG_IGNORE) + continue; + if (__fw_devlink_relax_cycles(con, link->supplier)) { __fwnode_link_cycle(link); ret = true; @@ -2041,6 +2045,9 @@ static int fw_devlink_create_devlink(struct device *con, int ret = 0; u32 flags; + if (link->flags & FWLINK_FLAG_IGNORE) + return 0; + if (con->fwnode == link->consumer) flags = fw_devlink_get_flags(link->flags); else diff --git a/include/linux/fwnode.h b/include/linux/fwnode.h index c964749953e3..21699eee9641 100644 --- a/include/linux/fwnode.h +++ b/include/linux/fwnode.h @@ -53,8 +53,10 @@ struct fwnode_handle { * fwnode link flags * * CYCLE: The fwnode link is part of a cycle. Don't defer probe. + * IGNORE: Completely ignore this link, even during cycle detection. */ #define FWLINK_FLAG_CYCLE BIT(0) +#define FWLINK_FLAG_IGNORE BIT(1) struct fwnode_link { struct fwnode_handle *supplier;