Received: by 2002:a05:6500:2018:b0:1fb:9675:f89d with SMTP id t24csp152604lqh; Thu, 30 May 2024 18:03:52 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXTbNoLN5P21iQzuDS6z2f6DwMTJ1IEhmFFIBpb9g960hWoqRaxosVrxM3smH/xfUWs3aCKqMNtN5X0t/Mgl8j/yXzNpjDuS8Bd6pyVRw== X-Google-Smtp-Source: AGHT+IHoW13CryCNFy8SFAzXisudT78auOZHh4+dfS+S6e+/nbYKPAzZXmIJgiK+uQVvu+Mf+9HS X-Received: by 2002:a05:6214:43c9:b0:6aa:fdb6:7d9c with SMTP id 6a1803df08f44-6aecd6c2e24mr4718566d6.37.1717117432066; Thu, 30 May 2024 18:03:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717117432; cv=pass; d=google.com; s=arc-20160816; b=IuQtlr/nwM+V2DLZnHnBGTNWAkNyFlgBs/2JjD2Pw0cCituGgE19mHqN6sF3R65CNo GNXoH2RekHuxfRPO/H6SUYs78IlZrujK+9tFGRtwItnMAfG1vJdhpu9VzpXVKXk2emjP pp5jEM24/RvgRjYmdZMgqiXzWgXQLbX7xg1ecvLCSioPYvS/tKxyTqpok8XGV90bAec4 aIsrfGqBkFGf5vh0C5IPg7hiTEll38VuGEyMc0FmtkkSzaK7q2HmgksD3+YcOofglO5T glrUM4EcHKNzjS2rWSn1ZjGgF/5idhr8P12mxn6Sx9T/d9WF95Z6ejHld4lHokkjUF0f NkpA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=YRuJup882/Wkr+Sk2Pe07JLV/UmeHk7XCeiAlXmlEfA=; fh=/zy0yt0KzF+qkC4gHsTYdCob2kK/uJSjP+aqRxoV5cE=; b=EgKk+WREQPvIIFBReDwCptUAEQdhcKuhgc4RJZ51M1atJxSrup/mNtAV4zI09U4j0y 1JGEq/tlWcLPZi4Xm17zDyHwC5SkqKasPLTWeRryS8+DmNlOA+67uusIiDt7Jg0XKFg4 PJgchFSOnqbMcwT3ucNppDd5MXLG7f1ZzAJ3IKvHRC8cnrQ7C/zvwL+H7NEgvRYCzwQa od+8JJu6OE0QO+y3RvPFlb9FVGP7T7YQq+L5CDvjKVsPfb28j6pgVhgWmSW/BmOgwLlU x2c+40GhDfufkHA76/Km1uTKelEWkJTVleO/CGkYhKV87PnwjiacINTs6FRSrGjjMRC0 dsiQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HNPUYaOP; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-196113-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-196113-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id 6a1803df08f44-6ae4b4021f2si9259926d6.214.2024.05.30.18.03.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 18:03:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-196113-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HNPUYaOP; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-196113-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-196113-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 C623A1C24442 for ; Fri, 31 May 2024 01:03:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 886E9DDA1; Fri, 31 May 2024 01:03:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="HNPUYaOP" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AFD847483; Fri, 31 May 2024 01:03:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717117416; cv=none; b=JboSYGK8XXab+gm5SdEmlzg1TXdeDJEr7zTF1FWH5ZKnCDlqLU1h1Hp9O9Ne7pBfbPt3wu3j/OSC7NADTsyTyIi1MKltnuGMaTFQiwdCqxs8fI57bHfzUPbRfIxpeNaPVo/GPclYhERTFimShYsn9Ox9pXQWNTAa0Vw7Aut8/0I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717117416; c=relaxed/simple; bh=MhZFv6QxVQ1ubVbKQDF07E67+FwUvci9ncljfLMfprc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=XgZMWiciCJK9dGLK0xt491eOpgeQwhyYRD1BRoYBl7bEcm95rD91XJ+MCMtv/a+3L5ghEIieaRTI+c3lbUibYSopy3t9ik1ysW6l6h6S6PIYyc9Y3GIeFR311+hpAZ8HglrCRsPBJ0RLOBIeBLiT514ejI5L1mIN0YHAtjeRwHk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=HNPUYaOP; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 19C31C2BBFC; Fri, 31 May 2024 01:03:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717117416; bh=MhZFv6QxVQ1ubVbKQDF07E67+FwUvci9ncljfLMfprc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=HNPUYaOPXEaNmxKOw0i9msGwW9I1KiIe95rvYMFVLnIcKLz0HDfZmgui6n3GuoNNO irs6OXRqyVteiTco2B0B1uKn4AuD8JXh22ScXG76/dk+t3njEUKloytgansoyzxitb CaJ5otOo4ixz7op7Pqvdi5Oq16auxhc1w10iJXEOaBmabVaVwNLRQlIlHtrNaLfBmD nPPT2xVILLc6PLEuWEBHNjTb7YwvjKDi38no6GyZXMadtr3wxQWFO3vSC/f/ivDds4 QGqn0ktcCsRNfApu8CHaEqLNjmS+YYPyNvmFCLIEq8qJaWFySDiWJE1jRSiXzrchMk 3eF07m6eVIT9Q== From: "Rob Herring (Arm)" Date: Thu, 30 May 2024 20:03:27 -0500 Subject: [PATCH 1/3] of: Add an iterator to walk up parent nodes Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240530-dt-interrupt-map-fix-v1-1-2331d8732f08@kernel.org> References: <20240530-dt-interrupt-map-fix-v1-0-2331d8732f08@kernel.org> In-Reply-To: <20240530-dt-interrupt-map-fix-v1-0-2331d8732f08@kernel.org> To: Saravana Kannan Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.14-dev Similar to other node iterators, add one for walking up parent nodes. The iterator starts on the current node, not the immediate parent as that seems to be the common case and starting with the parent node can be implemented like this: for_each_parent_of_node_scoped(parent, of_get_parent(node)) Signed-off-by: Rob Herring (Arm) --- include/linux/of.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/linux/of.h b/include/linux/of.h index a0bedd038a05..c322802dfc2b 100644 --- a/include/linux/of.h +++ b/include/linux/of.h @@ -1482,6 +1482,11 @@ static inline int of_property_read_s32(const struct device_node *np, child != NULL; \ child = of_get_next_available_child(parent, child)) +#define for_each_parent_of_node_scoped(parent, node) \ + for (struct device_node *parent __free(device_node) = \ + of_node_get(node) ; \ + parent; parent = of_get_next_parent(parent)) + #define for_each_of_cpu_node(cpu) \ for (cpu = of_get_next_cpu_node(NULL); cpu != NULL; \ cpu = of_get_next_cpu_node(cpu)) -- 2.43.0