From patchwork Mon Feb 12 21:31:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saravana Kannan X-Patchwork-Id: 200041 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp178824dyb; Mon, 12 Feb 2024 13:32:30 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWKi1d+gZY14XzJbWdi3ju8J8UHJQvDRgjWVB943wWEsYU5fO3dxEXIW/LVTa4GUNbc4PScpc1/902QJxUMSfi8CfFvnA== X-Google-Smtp-Source: AGHT+IFvGmi2FSNjDNZowIdyXKvbW0c/uNv5NfnHgBguldGANvh0lEr29U0biKt0U4bibMdvsU4z X-Received: by 2002:ac8:5a0f:0:b0:42c:6ce7:bad1 with SMTP id n15-20020ac85a0f000000b0042c6ce7bad1mr10163226qta.22.1707773550717; Mon, 12 Feb 2024 13:32:30 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707773550; cv=pass; d=google.com; s=arc-20160816; b=el/jwtse/eJfPGQ/PbHRurEZhIRNM+jQPdjxHX9sqXJhedCsAJtAwUpOvCljwYBbvN oSLVxwoRc/kD2Vp6QUjlqfb8ru0qz64E3F0mTACaSp7OA5DtzfoHR64+YEe4Jb3cgLPT EFL64gVDDzGOrzUdLDndVwyfZit/oKiLRB2B2SZgeLVEGHY55g/F61eGxhrqBWvfID4d txnjE8rv+WwnY9q1UJTPS8aCcvuthS2g6Iw/IF3/VRSU310zekDr/Cr/NpIAWtbc8Qog iM7h2YG855tjuIMU1uoJwyncfDtjKd+kLkn79GwcHmDBOz6y+rAB0YgxeSnfuEhICG/i u7PA== 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=/lJu/dE8Itei29iUxGJ21vac2fmW4WDjeIIAOyqkCJs=; b=viPehf8CRdsr806XybamaUb5gQgBHaD+9IlIXcpI2i92+HizEhGvqLJpv4j7wTmdKm J9XotZd9fkY+wF2ZXmxuaRJBUqgg9G6xSbQtR2FekH5Lt48pri4BOep3w5ueK/Y/OMNc RhOxmSA2thjNT9jvcrvcgfSYsV5DK+lXa7q09AVLPduyxhx4D0jCmDBMsaEyo0EzUHEs dltY3QKcc2u0hjqc1a91yw87N2juRVwftxQJYSK5hX2/hdD7Mo/iHXJxxXmPu8L/bacr OdilEs2Q3xK0/PKk+Yi3zJsMkJ+47nhu6Fww7TAOHwTDCpGhFry/rsHlOB6qo1Nt36El 0rgw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=SWwCTANO; 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-62393-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62393-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com X-Forwarded-Encrypted: i=2; AJvYcCUX/dsCo8vRSEg05rqAG9jazhgjm/RrYj1pzcQNVWFMbaIJkBUwhH36iz/x0dpQqsuaFqI1Vq78ULk+7+BP0OHzIHQ8HQ== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id c22-20020a05622a025600b0042c4cb72c48si1506599qtx.98.2024.02.12.13.32.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 13:32:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-62393-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=SWwCTANO; 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-62393-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62393-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 6C7951C225AB for ; Mon, 12 Feb 2024 21:32:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4B38C4D5BA; Mon, 12 Feb 2024 21:32:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="SWwCTANO" 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 86A524CE0F for ; Mon, 12 Feb 2024 21:31:54 +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=1707773517; cv=none; b=NQXzR3OYrUSeGtLmVg0zJvhAvfSpnfCRt2g5VULik7dV0ohAAkBnnfp3S90K9THQy+qKhg/EsEXI/KQWcAkzLI7dw5w5M5KFaGEPxgrol6een3cBpR7miNmFPSdfpd6ekEzs1LoUBiaGyPYdMBmem2O6o7uchDEPvENM2aKif2U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707773517; c=relaxed/simple; bh=sWUmF3vh9o4HGU5Ho8G3VWDldprPEGq5gO9RSRL2L2Q=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Cc:Content-Type; b=Ah8zi9AJvpKgf9rgFIBQw+QsTzrUic9YVfYE5cMaUDzewrMq5BaAjT1DoJ77xTy/jlxRJsf+u+P24jCgHgnKcnrslvNZN+74phB/0b2a24rkuridT20/3e5EioFTYMViw/1SPAvcS4cIogNgdITbev86Zu5N7cUM3v6m1dw+/Xk= 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=SWwCTANO; 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-dcc4563611cso335279276.3 for ; Mon, 12 Feb 2024 13:31:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1707773513; x=1708378313; 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=SWwCTANOSojhEP/TPDLG2MAkbnsPBHvzOb4nHKVYPKWax76GqlWab2GpaaCa6UEPAA 5gnnbwcWHNXCo7tHkn4SPZxMhPcLGrZPwDeDpl+OhncIHOL+uA8d5IGFvBpvVXeXdfwV ttirQYu4301FK7s4Ft3838L6fsr6OvpW6qhR5uC8FfItmGy5vbdPmXBDTKsGT1HXqQLn 1vL+J9B4FSuypUKGV0WHDoGOX9BxrKjAlFqaMtlHlA8BKiTSSiZtkFgM0KBLq0efn0oU LG7YI8aVleZ2lRMhC0zPI7EKctU0GQmSPHllimq8RhwaO/vIVDm9B+UmDDMjNbBxqJ3Z +yYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707773513; x=1708378313; 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=QlNyM3jTIhpP4/6YnnMhoDvHGJhJBHMGvR5vfUU3RLvTI28m4WWrMZGpS2Y2idBcIM pQnNC1bWmlQYuFNPYCZnkuPJbCAqK/9dccO2mgSxJjq6Iu50AUdzdU3SVTcuDLRNCMhK IKUV8FQ4bN/g7VPnuHrhDa7HV6M7DPtOlVgJpNndB+j/Fc7Mnsu5WjuWAsS4JAriIJbo 4XGLR16bRkjY0F3DccZWc3MfnO6Qb4YAQXR5qktOD7i8tIDE+nIGU/pOo52EW75LX1y7 l5RAN/aqXoLIDYiwYv8Ak0rJ44wJFmuHtLBkcTR8ozmaAQf7a3UVW2MkuqjOGCcMjv53 G2ew== X-Forwarded-Encrypted: i=1; AJvYcCUIzmq/1K40kjsf1QFf9Q+Dh4WXZgKGLYENjBpqBOyBVyQHfuhHmrkLAc9KiUwXqrysg058NeTHHSH+3dpS3P79W+cD28gajvMHI0n0 X-Gm-Message-State: AOJu0YwaGNj5XI9ELEUtrcijWJGQvzvaVNGtKzutDR1tsSXZkWlMWWN4 jUtw43r3/kY+eJyHOfdQsF5pEg4Y5CpFiPWArYeAWmNYzf18+j28CkHRCFzMCLMPDar4Px3xaSv E/Qpfc57riCIRtg== X-Received: from saravanak.san.corp.google.com ([2620:15c:2d:3:496d:5de1:a404:8bee]) (user=saravanak job=sendgmr) by 2002:a05:6902:728:b0:dc2:466a:23c4 with SMTP id l8-20020a056902072800b00dc2466a23c4mr2039431ybt.4.1707773513682; Mon, 12 Feb 2024 13:31:53 -0800 (PST) Date: Mon, 12 Feb 2024 13:31:42 -0800 In-Reply-To: <20240212213147.489377-1-saravanak@google.com> Message-Id: <20240212213147.489377-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: <20240212213147.489377-1-saravanak@google.com> X-Mailer: git-send-email 2.43.0.687.g38aa6559b0-goog Subject: [PATCH v2 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 , Len Brown , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus 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: 1790730358695154905 X-GMAIL-MSGID: 1790730358695154905 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 Mon Feb 12 21:31:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saravana Kannan X-Patchwork-Id: 200042 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp178912dyb; Mon, 12 Feb 2024 13:32:43 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWJKNx7tYfJ2dfCQ+KLBJbesNnrj5/uUFqcuxMHiKg+T6RaEs2nKCxx03ZsAeayR9dX9CFFZ5ogH76Ovgpq8x/dYaR1Iw== X-Google-Smtp-Source: AGHT+IEhhh7ZymE6JlwA1SzB2C37aO1+QBvR1FjeJ+iCO5HIj6Blb7SAL0akyis/owMXcrM0/j5G X-Received: by 2002:a05:6a20:c88b:b0:19c:acfe:5fe6 with SMTP id hb11-20020a056a20c88b00b0019cacfe5fe6mr10760101pzb.21.1707773563278; Mon, 12 Feb 2024 13:32:43 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707773563; cv=pass; d=google.com; s=arc-20160816; b=Uzpc4ecggygO5xLcS5rujIGy5AK1WTL4wG2hAs/H4BcaWN7OGmm1MsOVfg/oIjOP4b ry8yP4gBvA5wg7qRHekuep7E5ouizT2V7iGa87N3I1EXrCa9WaUrKtSUlQIAUIG85TDb c4cR4+autUCzC2ZqYDAN47P0KgeN5ce4/HI9iV4TtpIAWWQkKGLuvQUev5pPmGpWYcVC czuGdVVV/4jcgieW7FhR+AQ17cbpeu3eJ+WpwUuG8udEAdBTmrJgGKfQZHMojLzLpqfM ZGaGyE2Ig7DiIeyMa8/d2lwlCGphi3IAeB6dg3lcdY776lZ1wLGiAvZikj8LYOKsnxu4 ZyoA== 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=1lsC5KArk+KsjCLMRpgLNAyyfV6KTkBsZMdIuhUSTHk=; b=XjoxdBIcz1xpbh5DNr17iDnmpOgXB/lIOKgH1GAgE1yoyzsnWJl6zbz70HPfQntfiy 11F0I9nEPixNcukBdBz5MC1XUhWti3nU3AxK7qntfKgJOjWgw9106YQi4DSV28YK04VG 5jsisb4ngPItWFwu0bK6dhuC17PhBPB/Gw5h7Nttff/4VQWsiw++bsz9UHaVUMF/mnhw Y8KbowGMDYYAUe6zJOM+khDa7tJ4vxZTDOnNVCXESbB/QspsQ6uY8SjCxRi5OhChWNev z416zNeLHFtefh5pFKMbA6TPssmtg8psaww5bw335Sc6NOmKhZGWQa2QDXlEPW9/vF9C 8YIg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=D8jYcMjX; 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-62394-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62394-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com X-Forwarded-Encrypted: i=2; AJvYcCV+4mz5o+IzfaBnsZFt5IXzni7czNZiJ4OAIkOdvYmMyUNdfaBVAKtEgHh8qeeYRDW2q+qTB99U4CNPwLSHrh/0GSYpvA== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id ch1-20020a056a0208c100b005d4d50dd1acsi786450pgb.605.2024.02.12.13.32.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 13:32:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-62394-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=D8jYcMjX; 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-62394-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62394-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 12049284CB4 for ; Mon, 12 Feb 2024 21:32:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C12984DA10; Mon, 12 Feb 2024 21:32:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="D8jYcMjX" Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.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 3FD834D5B7 for ; Mon, 12 Feb 2024 21:31:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707773519; cv=none; b=Dp4pjwxNK+6KKhZ6LUh6xNAIEtiR19iTlR1A3k43tflk1Q3ENzLenDGI8aefW7N0igSXsjRzPJbF0UBDuNulM5bpmO/Na63l6vyoXH2ZIkA1BSnjWLk1RWvLi9vz8QR1En/+QZjFo6GjAVpTcxxH2z7PpyrrCag+ckP48ltcrvU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707773519; c=relaxed/simple; bh=iEDFuhE8mOQtSS/B79HZRgChFrCS7/VJXwJaloRdLeI=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Cc:Content-Type; b=LO/Lkc9bRz2sqKpnQ4sotCBTyLD8/neXBG/AYmuT+7pbQZbj1AoCHJBrSOo5XqIF8EECaQ4t5IA2LS1rJTKM7LYatvtv03TbYtxGyAZ5cpteYJnZup56dJ99/rfsf4DB7VTTXFGWIJ08PhboltK18cPOteHhHJD4t+vB+Y5Vl/M= 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=D8jYcMjX; arc=none smtp.client-ip=209.85.128.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-yw1-f202.google.com with SMTP id 00721157ae682-6077ca422d2so6708357b3.1 for ; Mon, 12 Feb 2024 13:31:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1707773517; x=1708378317; 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=D8jYcMjXGapMrTf6EwfANEkNGgsB8HgvdEG7WRrzsTJE/X444g2LdCzD2MmtXsH+0h QBxMJrg284bFKgmBpUyNIln3WDEkN3b7T+PbN33+KfEoi2X4zzma0jeKpt+GZj5ujJDs lFLlZxYg9VOXx1Jd9V54ejylhkm/UMVmyFPwyX/tp51otbmfSboc4DvILLwDSu38Yh3C tGMfcVbJsfJHNGzXu4fIMRDPEeJMxIcErfVcd40FVTQb+iQuRj9oAT1EM7Xz05pQjTh5 SjgXkbTD7/TMbcot+7Mmf43Dv2ji3FAdjUbXUq1aIkqlLSJeO4QyCn3u2T1rIuYs8YTo aAzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707773517; x=1708378317; 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=IQlnL/PqMe6EuWw6kb6VAZzhNOoYaqjeBTsipCw04HYGf2o8f+1RgsHV6BrFj17MRo 17kLrIMfJ4HFhHnCApMQgJly2RzGRrmdUzxUu17AgcXEhSRenHdymTxVuICRTYGsZU4t 3rxZ0fm/c3WA+azdtdB+CuOBw4EbXigW8doIMYeOtU49oo9MbNSNYB/YX6C3e2Ede2b5 iK6QltVRA2q8v77DReZSF9mBd+6FDhqBtteKEbMVIQlqbL0AZAxIk64GgNb+JfgQy3Vd lleymX3Lwf7mvMx4jbNrUMaFQzdCsWfU2Wc4BQQX9Rig80T1apPfHt/wxRoE7V54iKX2 a3fQ== X-Forwarded-Encrypted: i=1; AJvYcCVQq8bLGILklZGFqpvLqXF5cC6MIPFZtA7ZkrYrY/gzi2pqCUifHHj62L4MKBySnBVh4kblkg4ohaL75OLVSyjaDa1mSgoJwR9OaERF X-Gm-Message-State: AOJu0Yx6m0ljReT1RqL88N2yqeGH3Y1h7i2Hm+SpNtUvnx618d2ATY6P 8CwzA+fA+WV0iWIu4bVyf8jNgUvknI4l9UjlzgaxCxNbl64lEc3Vky3/ws7eZaTMUJ9LnDvxf/v N0CxSsgEx6PCs2A== X-Received: from saravanak.san.corp.google.com ([2620:15c:2d:3:496d:5de1:a404:8bee]) (user=saravanak job=sendgmr) by 2002:a05:690c:e06:b0:5fb:63fc:fac8 with SMTP id cp6-20020a05690c0e0600b005fb63fcfac8mr2203866ywb.8.1707773517438; Mon, 12 Feb 2024 13:31:57 -0800 (PST) Date: Mon, 12 Feb 2024 13:31:43 -0800 In-Reply-To: <20240212213147.489377-1-saravanak@google.com> Message-Id: <20240212213147.489377-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: <20240212213147.489377-1-saravanak@google.com> X-Mailer: git-send-email 2.43.0.687.g38aa6559b0-goog Subject: [PATCH v2 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 , Len Brown , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus 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: 1790730371934545225 X-GMAIL-MSGID: 1790730371934545225 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 Mon Feb 12 21:31: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: 200043 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp179067dyb; Mon, 12 Feb 2024 13:33:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IEAOl6omG7v6tLIotfyIehrh6MS8hj5wU35zH+Pn+cQLxmEobscR/4aHZnniqjlOABGyqVG X-Received: by 2002:aa7:d5c7:0:b0:560:cc04:a96c with SMTP id d7-20020aa7d5c7000000b00560cc04a96cmr5335054eds.24.1707773586857; Mon, 12 Feb 2024 13:33:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707773586; cv=pass; d=google.com; s=arc-20160816; b=C3lQlywdZ9/YO/HHYIojLft72gNhBfjO+e1pJjGKn+WLxUiaL/B8+VN6WCbEmmkxdP kxXsGrjAsTkGg7OVaPYtwLXXbgRFL7nAUyRJAoQHvlsqpXUNPBxAP98SocIXgNYI5tpG 2qORHVT5oul8/KYV8f1VFy44ffONHQSPVWobm1GSuaRl2KbgtpTFKZX3lRquJvafyCA5 FOP/20Dwv3h32PMrEaPuHOYIMgPLaJ01SsFWgwIB7CfJN51tjJwZbQROn2utNTqMlSzC VYs3+3zgZjV7vQ0bJJUGJwWM/oMrO+vgZZ/YVAGvEj9QDF10AG6PGyhNgci+aWRO0/BN Nt+A== 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=JQ35JcQOD8sngOY/PRE6LAzcrcvofp80cB9j/4A7v3U=; fh=WBmxevHKVfsPQuXFplKO+K68PMRXlS2KMEZL2uCCaAE=; b=NXkX+80ZWtGBmiANCB0MjhKhHWKJH1e1S7Mc+s8HOliXWJv7Z4mac8mtmCsKtSyPRu PGPjXQ14n9/4n2lsb+9z46LWRcowcixBZ8pvbkvO/fz2M5vA004PLGN1Zd7CPk00cgQi tjV+B0JbhN0D8NkKkh3+6UieLae/evFDW8MVphQfjqYEFA10jglJCDnYbvsaYpAnZIf7 LONAYRRDWecmU5nwIadQf2z6EjUMR28I4c/OM4W5APxf2kSKJJ0OR0ZgMfluuDrxeY4o WtRxq0bXA31tK1z441KXBIhxR7B8XTbR0njnFLyF6vMk4/rvSVxRJCN6MUs7LwoTAbwD uLXQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=K7SzWMdv; 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-62395-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62395-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com X-Forwarded-Encrypted: i=2; AJvYcCVsGw18lN45jPmH/UGzaNo2YoX2WpMS8qM4R+lIaiOOvwMf/1Jslz48+NsxLtaZAgKaG73+U8nPZz8mjiFIfuC/m02TUQ== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 21-20020a508755000000b00561baac1ba4si1246529edv.316.2024.02.12.13.33.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 13:33:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-62395-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=K7SzWMdv; 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-62395-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62395-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 47B0B1F22941 for ; Mon, 12 Feb 2024 21:33:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 820784CE1B; Mon, 12 Feb 2024 21:32:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="K7SzWMdv" 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 241634DA0E for ; Mon, 12 Feb 2024 21:32:01 +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=1707773523; cv=none; b=CBn7Yxg/3e17jIb0GgQgUppZrNUtz8xE+xN9wqRUv3EBsMheVa9eEb+H3n1mXxSSE+y4o0MEjSuRsAdi8NqW9Z1nwB2qn99NmBM7AySNV/4KUcMxYv3RX85nBLf8icKBBBY10Dgur1C3aiUk0n6Ja1q6dT4cDkf79dKXa2wC0fM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707773523; c=relaxed/simple; bh=dessp0Y0iydAOQinVxc9bvgHWYMKmwFPgKm6nVqH9Cs=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Cc:Content-Type; b=pHtHV3YG8967klfGvXNc2l/OomfIfrd93vQyzyWMn9lrCCJmuOlds2V0quQ+8vhd6zgdPOjKmoDjybmtqKeuscxsKBLcsdhx4d3HEB/+KF0afYE+LvEIt7en4L5eTwGsPFVGVyO9bYPU9Pvc91h/JtM3g3eIzxNaC4CpAfciP/4= 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=K7SzWMdv; 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-dbf216080f5so5709810276.1 for ; Mon, 12 Feb 2024 13:32:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1707773521; x=1708378321; 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=JQ35JcQOD8sngOY/PRE6LAzcrcvofp80cB9j/4A7v3U=; b=K7SzWMdvmea3hjbDgaKsjraad4vgI0rdi715XseSAT2erL0qicZ+OJQbMwTxgTW8IA 3JVBEOyTlCqlKTiZHu8uuXGEU/cV/e9e2nVpRIRhrpIHWVnn5W+NQIgKrtJc9mITwzVO FBZU5IoogTq2BMhQTG52HG5W0IMS4+zGrCe4vzcm2kaNwVRUFxvJJxJKh2LRahtyqgSe 4dNIb0eULHWrrWPVz1PgnoTrkJ71wAw4dAPviyCzJFuw/AzBDWRQeCQyKyKD3X8o/PvR sYJLPDW7F8Mv4e30ejWAxObfa0eKPJ9wcuZ+1DGHFT455OCyXsXQbL+aIN6XJK1z5J9d 3x+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707773521; x=1708378321; 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=JQ35JcQOD8sngOY/PRE6LAzcrcvofp80cB9j/4A7v3U=; b=YqOzwImrs3EU5sgcv+zglOV7JXZJ76Yihxpp9pOzV2ytvZpiBnH1V6Zr2Z8DEELDFx 1fJW/VFqGfbpxHCIiEr697/txDjIJe8V32FP9uD1KgmlVQSzQGaDnUK6aLeXqV58+jNp +hrzpZzRqzgP/tQSmDLrFLPPhtL3p9GM4MCmLvHDpJ4dJuUiehVg4wH/GMED4lZSKMZ2 EE+/s17DLI3dVbVRh90urjOk9mSrsWpIlC6AmkmEyTG+TxDa3nPvR4VRdUB1+1cZwPOF jAxNAJu2U6pyDMRtLsHp5cPZxaoO3MR+GpFcLwWNs6Sye3HU3tj3nu5Ly5KkWfDhT+C9 sUVA== X-Gm-Message-State: AOJu0Yy3bAJElww7Q6IhsxXfVHulM5vV5iW9ACnxt5/rPZvjp//JUPK/ NeeS54DXIM3x4Zz20iztaWAD4yo6zvwXjZELQo0DNMzyOhq1I6Mht8CH8eyV+rVlHfGbYO3PNhp WLfB0a0wTxTET2A== X-Received: from saravanak.san.corp.google.com ([2620:15c:2d:3:496d:5de1:a404:8bee]) (user=saravanak job=sendgmr) by 2002:a25:6910:0:b0:dc2:398d:a671 with SMTP id e16-20020a256910000000b00dc2398da671mr2027894ybc.10.1707773521205; Mon, 12 Feb 2024 13:32:01 -0800 (PST) Date: Mon, 12 Feb 2024 13:31:44 -0800 In-Reply-To: <20240212213147.489377-1-saravanak@google.com> Message-Id: <20240212213147.489377-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: <20240212213147.489377-1-saravanak@google.com> X-Mailer: git-send-email 2.43.0.687.g38aa6559b0-goog Subject: [PATCH v2 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 , Len Brown , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus 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: 1790730396380416831 X-GMAIL-MSGID: 1790730396380416831 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 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-supplier.yaml | 101 ++++++++++++++++++ MAINTAINERS | 13 +-- 2 files changed, 108 insertions(+), 6 deletions(-) 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..aab75b667259 --- /dev/null +++ b/Documentation/devicetree/bindings/post-init-supplier.yaml @@ -0,0 +1,101 @@ +# 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-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. This property is meaningful only when pointing to direct suppliers + of a device that are pointed to by other properties in the device. + + 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 dependencies + between devices. Since each device is a supplier (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 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. + +select: true +properties: + post-init-supplier: + # One or more suppliers can be marked as post initialization supplier + description: + List of phandles to suppliers that are not needed for initializing or + resuming this device. + $ref: /schemas/types.yaml#/definitions/phandle-array + items: + maxItems: 1 + +examples: + - | + gcc: clock-controller@1000 { + compatible = "vendor,soc4-gcc", "vendor,soc1-gcc"; + reg = <0x1000 0x80>; + clocks = <&dispcc 0x1> + #clock-cells = <1>; + post-init-supplier = <&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 3dfe7ea25320..79719af714be 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -6055,12 +6055,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 @@ -8295,6 +8289,13 @@ F: include/linux/firewire.h F: include/uapi/linux/firewire*.h F: tools/firewire/ +FIRMWARE DEVICE LINK (fw_devlink) +M: Saravana Kannan +L: linux-kernel@vger.kernel.org +S: Maintained +F: Documentation/devicetree/bindings/post-init-supplier.yaml +F: scripts/dev-needs.sh + FIRMWARE FRAMEWORK FOR ARMV8-A M: Sudeep Holla L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) From patchwork Mon Feb 12 21:31: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: 200044 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp179160dyb; Mon, 12 Feb 2024 13:33:19 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXOoWWE1nXBfUqN0VhJaKbXEQt2Tljp5NRrtY0NR48SUoMS7MP/KoJaR9dggmX1ED2+321tEfKnlSC7NeapvfswgFigbA== X-Google-Smtp-Source: AGHT+IGmkJX5Mffhk2QpY2AGUT5UGT3CTQNh2yXfbp4T+CCNyX33khi3n2yVjb7kwLlb6jWTzT5o X-Received: by 2002:a05:6512:b8f:b0:511:7b11:9b9c with SMTP id b15-20020a0565120b8f00b005117b119b9cmr7253107lfv.4.1707773599059; Mon, 12 Feb 2024 13:33:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707773599; cv=pass; d=google.com; s=arc-20160816; b=xVSXrqZQOO+ccxJXVwVsX3fpO0gMC/cGzyjVY7brYF+6HIHfNQ8oD92YTaM681Ba88 fsY1ftBdtBvJJA3/JCuxGBLPchuKjjLdR96Xzh81NEWlSRB+Yw+O4tX3JUk1ACo3vQ9i rZpq/iVN98koyljpzSeDMmmStajtWfSOyeqGJnGKISH4l27lhxCbR8x/EXnfzhEV28Hk CR6lMfNAkCAWkSX2PDhBMYfqaskbfF27AisdFmSKs85KL3KmDlwGcMubLGfapqNh+3Fb n4Ekzh0S6RtKZth+cvvTS7xj2lp75LJOeT2Xt5hqHC+YWbdui4+uuF67OlYW+suE0mUf Sn0A== 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=adgZf38vUF1hjhLf/GKaR34JDGVXAQk3yEcx7iZDFCY=; b=0rrcpbk9lcjsf/7TxRAbVYfVBYi1IkG41Pw5ZsAGzfA8CNMb2RDlq7W2rbI/BkY6DV 73hp4kZVORYZrL8du9ufL2H6Cwp328tJY78OF8YUCdyMUesVZafSTLwbctaaevkIwcdk epug9W0TvsK7Actz+nNG1qcCSKtSkfCjYBf4RUsIpSO1a9zTRDmFbm/1N5o0orAH0Mp4 2juy/IHpHyBbw/4Ao+ZR7pENiG8KnUKaxqNMu9ypbqmFxhNs7vDsq78MrVKwtFjS6lgB mdqtYUbcyhFvuuTGiMZm8MpUymNCZI1lo0vIkv7nYJCvV9gE+hXjJJwfK+C8qeVtx7fV IAag==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=OHBx6F9b; 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-62396-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62396-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com X-Forwarded-Encrypted: i=2; AJvYcCV9gpw1T+GhwY8LW2AXd/c00rPrXnp8doQFo7oCnFDawAoDYLYG+HPuPxQhuYPY0z+QrovUlYVpnf0VO23/X3NqOQezBw== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id bs25-20020a170906d1d900b00a3ba261d09dsi542041ejb.709.2024.02.12.13.33.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 13:33:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-62396-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=OHBx6F9b; 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-62396-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62396-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 7D1C71F22DF3 for ; Mon, 12 Feb 2024 21:33:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EF0034EB32; Mon, 12 Feb 2024 21:32:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="OHBx6F9b" Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.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 6FED64E1BA for ; Mon, 12 Feb 2024 21:32:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707773527; cv=none; b=l0a4FObi3ryzkKcCpiIEVn7JBNYRmgJvgOO9s/XzALTkzlDvPlMFQy75vMPE7PioEhzTEasUoReehWwH0TjyKFeUk+WzO3RaCOlCF2u4zPV4gsNvGQ7WssDVp+gkf2o1Gx7l9JMJXKqyrHTbzAmMma0G8o8BnXRXhi63JD2VtuM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707773527; c=relaxed/simple; bh=09nOuvy1xCjK1iYqCopDQXrnPVKpNm2a5rJaJXsm9lU=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Cc:Content-Type; b=gPTObIHDc3YOxhcWmHFVs4isG0eS0Idwf1jxzziL218mtx/JUjF2VR2sZsYbi3QYnpkK+3Myuw/AZiavasZrYZrElQEXdE3K5Dgh0GsR0vpC+Hzhu1I4NHwEji2Q+oX+wVE7rb+yzQ3aHve8K71RQO3jvqvxrjGOnm1fflxAyg8= 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=OHBx6F9b; arc=none smtp.client-ip=209.85.128.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-yw1-f202.google.com with SMTP id 00721157ae682-60761bdbd4cso19722607b3.3 for ; Mon, 12 Feb 2024 13:32:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1707773524; x=1708378324; 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=OHBx6F9bhwsJvj9SRIzninQd62CTd0mat67Ry0G4dzfpMXC9lLLH/2cqAtkPZBKWOs rCJlNGFOdzUHHSyx00VaV5roKpsat69I49vXVWf9nM10D5g6AdFuX3akbE1MiBcmwf/3 U//fWlNw92ilZqOqSovV9mdpvdT5dJ202Xq3Gnl5XmSg5+K/5u0KYaPEpqu1aRUQ7I8R bMzmPnomy8vPKmO1iyBgm0mVL9Emn4B+OM9TotHLWNPRZjnhPKrNz83/FOQvMN7JijYp UeCGftAtQwFbnm3brtQMnWqc1osOv0HsjGW9FkVb887vW7Th/2S/CTchqaHupDFuZYjz CGjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707773524; x=1708378324; 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=UgR019Y3597SWfbEaG3CYAEgb4XdC/hs+D7erI+FfFm6ExlN5HFDnjdzm5zZMDDVhK DqvgV3Tl7TsdSBwY65xGq3SVNA46DVj9SaNBOQ0UReWdsKsd17YuYRtSShFCDU7c1MX1 E7RIOa8OK75OnzWCq/sr5MCIDTh7sBIqo8MCuOQFIrcJxrnKba3xQCWGfgBjse4/o8U2 f0B9TYPaq7Z+gLrYiQFmjP6qIqn1Gspd61hl6gndyJEK9OICfF/9v0PjJ7y8SzQdm7dN dRpIoGK6wuyYmrMONPSeosnNaYQPzEr+TF+f57cG+oTXB1Cq72F/YHW02tkGiEULvaJP GRKw== X-Forwarded-Encrypted: i=1; AJvYcCVzVLz9U0qXd+uKYShnhwiSa9/GqS1ssxTkY7rpSVeEnH7QAXBYXPR3cwRIMD/aw4uAAEgz1G7WfLfXjsk06rn3E+sJKz20twECfHhx X-Gm-Message-State: AOJu0YwzlZ5/Um/pDRecvzHUf6wiTQGenhP5wJQHWtAq7Zw9HFAdLnWI Xt9g01dTQF1KasV9HHfaJxR1BW71QS+WoMTeLVEsRhkF9O3Rfvr1tjpnL9J8DGynPc/b2hdyVIa Jd5o0YdgCT6C9/w== X-Received: from saravanak.san.corp.google.com ([2620:15c:2d:3:496d:5de1:a404:8bee]) (user=saravanak job=sendgmr) by 2002:a05:6902:120b:b0:dc7:6efe:1aab with SMTP id s11-20020a056902120b00b00dc76efe1aabmr1793262ybu.6.1707773524580; Mon, 12 Feb 2024 13:32:04 -0800 (PST) Date: Mon, 12 Feb 2024 13:31:45 -0800 In-Reply-To: <20240212213147.489377-1-saravanak@google.com> Message-Id: <20240212213147.489377-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: <20240212213147.489377-1-saravanak@google.com> X-Mailer: git-send-email 2.43.0.687.g38aa6559b0-goog Subject: [PATCH v2 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 , Len Brown , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus 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: 1790730409153518850 X-GMAIL-MSGID: 1790730409153518850 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); }