Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp1307027lqb; Thu, 30 May 2024 06:47:12 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXuFNUzkxOJNP9AVzVXJ4VAXUXwlXUlJjng69Mr4Ai+Ef6frraVK2bMtvS37z08RZDQwGK6xQw69NnzW8zUzbcGUsDgoeArces7sX4MYA== X-Google-Smtp-Source: AGHT+IHr3HxTfUHK8LEWGPwhhEDaSlqaUFVCvBOxgl/c654JXojImR3jNjnCcpXmIYhmzXfllIl6 X-Received: by 2002:ac8:59d5:0:b0:43a:dd9f:7aa8 with SMTP id d75a77b69052e-43fe92ac020mr25179321cf.9.1717076831883; Thu, 30 May 2024 06:47:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717076831; cv=pass; d=google.com; s=arc-20160816; b=gn78e2z4PJdKIkaVqxqUAsuaofAxHImdryMy7lIeRJuw62lDDGjC3PuG05Kj3ndZjl cAPk+HogsCp3oYr71erUBNPDvG29VDJilkgjjd10Oiy4DrK/10ITWnReV1Qr3clepOcU N62hAeRl40rxlO1i7DPCiuEqY3Thlqts9Cn0H88jjs7jTOoV6bqo2cqrmXcQCP48eNYH kbEWotjsRXgRpRJQk1MdzPxsSvaiScw1fh4CmYKI6uMxA93PJRACAcL3CKN4LeHfmx8C VEsDwT09RoghWSfWHPSWD4Sp3aiUp+K6QdIzB7T7AGKBU7yS4dL5gSFY367qumRncvmK ar+w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:references:in-reply-to:subject:cc:to:from:message-id :date:dkim-signature; bh=+jWpw+Pzx1vtPF1x7YmG5ZLks30Rmgc4oozkY11/RT8=; fh=c9VPDXwofGArHz1b2FhZTrjvBtzVrOJKaFDTO4qyW20=; b=pCsjc1EuK0k+Malkx8bxXddaBDaq2iA69Zumyt6lpQgFRYeKEEg0umf/FCFooL8vJ3 wrZlSPM7X08bFYgcdkD8bUqQD7fLgrgDYXX5LXxm7dqwsjgYod9IqxS6N2nnD1tpIZRg n6lhO8gQevzHRzbtzaKNyJ2W/IbETFvbSNk0LlaVjSFMv8Vbms2Y2Njs73E6sWpi4bo+ k6TZU+sI9wMHibUgNedm7JQ4veC5ZDR3zKKrOCe3Kr1/rJNGZ2L+53CoyIOwsammty0e 9Q3tj2F2sFtvD7DILJ/Nqmk4swlKVQQvQr8K7IWAO8gLH2/RqmiPdutgsFDrQ9W2o8nM zekw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=N6N7K8U1; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-195442-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-195442-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. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d75a77b69052e-43fe09644bfsi46233491cf.470.2024.05.30.06.47.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 06:47:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-195442-linux.lists.archive=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=@kernel.org header.s=k20201202 header.b=N6N7K8U1; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-195442-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-195442-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 9A10F1C229C4 for ; Thu, 30 May 2024 13:47:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0F45D18397C; Thu, 30 May 2024 13:46:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="N6N7K8U1" 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 3058318308D; Thu, 30 May 2024 13:46:13 +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=1717076774; cv=none; b=lSlA5jbChV/YMGV75c2UgBTFAKShXWnc9WM2XosTWNXja0VujNVi0xTwNiQyRdR3iJoYp5TJ1QUgiOTVmwdfATRUYUrolrvQllHpJ2ddkPNGun7jVuSCQqTp/p5z2OOZuZeJYZWEqfq7S+XyPkeJ+ecUUqSRUs0qnF305e6BywY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717076774; c=relaxed/simple; bh=rmN/CuQwtYSCBMHu0PjHZJZkczGNhMDmrCHhNf4781Y=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=iYwD5fi9ST78iWMcB6R91gKq2wg25TBA3ObnqZSlpO2nIFor1mRPbItn4CHiimaDQUvlqPWWtXLHpjf3AjdSkMk/0A+gtdZp9qYPUQhzpbR06FHjxBhcjQVBOrJDkJeA7VFKb2wo7AQdjyUPQpYdgx9/ojYZgVFaFk1C4wo0FEY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=N6N7K8U1; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA33CC32786; Thu, 30 May 2024 13:46:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717076773; bh=rmN/CuQwtYSCBMHu0PjHZJZkczGNhMDmrCHhNf4781Y=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=N6N7K8U1MYLtPsBvXFs4TMoPJIyyQYodKhzeKWKXvjBx6NnSqm1INEI5J2cr8vikJ VtxS0wca+ityVskAlyT+MKFjyA6a+eKjhLGTpvpFK6avUHBxTtppM/MtBIX9Kf2JW6 1cNHssEUfIxrmIu773b+YJgI8rx8eJPlxl3PfJ0GS0vytuc65B11gdqoHD5F0rfteU 2Pow+aOPjg9GKGIXfGdXH/Z2I5MoJPt19TYa0OpnaiRN+qrjNbLjCFa03IkHTMpkNL eoG5RDAmVlJ6hboF+ewwQXAt/Tcew5QW0uG5FhinzkhYw2gVlO48Jhg7GGaR90Lnhi AuqpdKi27HPng== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1sCg6d-00GuJ9-DW; Thu, 30 May 2024 14:46:11 +0100 Date: Thu, 30 May 2024 14:46:10 +0100 Message-ID: <86y17rl8f1.wl-maz@kernel.org> From: Marc Zyngier To: "Rob Herring (Arm)" Cc: Saravana Kannan , Anup Patel , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org Subject: Re: [PATCH v2 1/2] of/irq: Factor out parsing of interrupt-map parent phandle+args from of_irq_parse_raw() In-Reply-To: <20240529-dt-interrupt-map-fix-v2-1-ef86dc5bcd2a@kernel.org> References: <20240529-dt-interrupt-map-fix-v2-0-ef86dc5bcd2a@kernel.org> <20240529-dt-interrupt-map-fix-v2-1-ef86dc5bcd2a@kernel.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/29.2 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: robh@kernel.org, saravanak@google.com, apatel@ventanamicro.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false On Wed, 29 May 2024 20:59:20 +0100, "Rob Herring (Arm)" wrote: > > Factor out the parsing of interrupt-map interrupt parent phandle and its > arg cells to a separate function, of_irq_parse_imap_parent(), so that it > can be used in other parsing scenarios (e.g. fw_devlink). > > There was a refcount leak on non-matching entries when iterating thru > "interrupt-map" which is fixed. > > Signed-off-by: Rob Herring (Arm) > --- > drivers/of/irq.c | 127 +++++++++++++++++++++++++++++------------------- > drivers/of/of_private.h | 3 ++ > 2 files changed, 79 insertions(+), 51 deletions(-) > > diff --git a/drivers/of/irq.c b/drivers/of/irq.c > index 174900072c18..a7cdb892991e 100644 > --- a/drivers/of/irq.c > +++ b/drivers/of/irq.c > @@ -25,6 +25,8 @@ > #include > #include > > +#include "of_private.h" > + > /** > * irq_of_parse_and_map - Parse and map an interrupt into linux virq space > * @dev: Device node of the device whose interrupt is to be mapped > @@ -96,6 +98,59 @@ static const char * const of_irq_imap_abusers[] = { > NULL, > }; > > +const __be32 *of_irq_parse_imap_parent(const __be32 *imap, int len, struct of_phandle_args *out_irq) > +{ > + u32 intsize, addrsize; > + struct device_node *np; > + > + /* Get the interrupt parent */ > + if (of_irq_workarounds & OF_IMAP_NO_PHANDLE) > + np = of_node_get(of_irq_dflt_pic); > + else > + np = of_find_node_by_phandle(be32_to_cpup(imap)); > + imap++; > + > + /* Check if not found */ > + if (!np) { > + pr_debug(" -> imap parent not found !\n"); > + return NULL; > + } > + > + /* Get #interrupt-cells and #address-cells of new > + * parent > + */ nit: funky formatting. M. -- Without deviation from the norm, progress is not possible.