From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.0 required=3.0 tests=BAYES_00,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90D82C433E0 for ; Sat, 2 Jan 2021 11:38:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5A74F20866 for ; Sat, 2 Jan 2021 11:38:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726486AbhABLho (ORCPT ); Sat, 2 Jan 2021 06:37:44 -0500 Received: from mail.kernel.org ([198.145.29.99]:48824 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726327AbhABLhn (ORCPT ); Sat, 2 Jan 2021 06:37:43 -0500 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9BE2A20866; Sat, 2 Jan 2021 11:37:02 +0000 (UTC) Received: from 78.163-31-62.static.virginmediabusiness.co.uk ([62.31.163.78] helo=wait-a-minute.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94) (envelope-from ) id 1kvfDQ-004w8O-GP; Sat, 02 Jan 2021 11:37:00 +0000 Date: Sat, 02 Jan 2021 11:36:54 +0000 Message-ID: <877dovlgdl.wl-maz@kernel.org> From: Marc Zyngier To: Rob Herring Cc: Saravana Kannan , Greg Kroah-Hartman , Frank Rowand , Kevin Hilman , kernel-team@android.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] of: property: Add device link support for interrupts In-Reply-To: <20201231211240.GA2333246@robh.at.kernel.org> References: <20201218210750.3455872-1-saravanak@google.com> <2a6dbcc83d5aca7a3340e0cf4d751cdc@kernel.org> <20201231211240.GA2333246@robh.at.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 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 62.31.163.78 X-SA-Exim-Rcpt-To: robh@kernel.org, saravanak@google.com, gregkh@linuxfoundation.org, frowand.list@gmail.com, khilman@baylibre.com, kernel-team@android.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org On Thu, 31 Dec 2020 21:12:40 +0000, Rob Herring wrote: > > On Mon, Dec 21, 2020 at 09:30:45AM +0000, Marc Zyngier wrote: > > On 2020-12-18 21:07, Saravana Kannan wrote: > > > Add support for creating device links out of interrupts property. > > > > > > Cc: Marc Zyngier > > > Cc: Kevin Hilman > > > Signed-off-by: Saravana Kannan > > > --- > > > Rob/Greg, > > > > > > This might need to go into driver-core to avoid conflict > > > due to fw_devlink refactor series that merged there. > > > > > > Thanks, > > > Saravana > > > > > > > > > drivers/of/property.c | 17 +++++++++++++++++ > > > 1 file changed, 17 insertions(+) > > > > > > diff --git a/drivers/of/property.c b/drivers/of/property.c > > > index 5f9eed79a8aa..e56a5eae0a0b 100644 > > > --- a/drivers/of/property.c > > > +++ b/drivers/of/property.c > > > @@ -1271,6 +1271,22 @@ static struct device_node > > > *parse_iommu_maps(struct device_node *np, > > > return of_parse_phandle(np, prop_name, (index * 4) + 1); > > > } > > > > > > +static struct device_node *parse_interrupts(struct device_node *np, > > > + const char *prop_name, int index) > > > +{ > > > + struct device_node *sup; > > > + > > > + if (strcmp(prop_name, "interrupts") || index) > > > + return NULL; > > > + > > > + of_node_get(np); > > > + while (np && !(sup = of_parse_phandle(np, "interrupt-parent", 0))) > > > + np = of_get_next_parent(np); > > > + of_node_put(np); > > > + > > > + return sup; > > > +} > > > + > > > static const struct supplier_bindings of_supplier_bindings[] = { > > > { .parse_prop = parse_clocks, }, > > > { .parse_prop = parse_interconnects, }, > > > @@ -1296,6 +1312,7 @@ static const struct supplier_bindings > > > of_supplier_bindings[] = { > > > { .parse_prop = parse_pinctrl6, }, > > > { .parse_prop = parse_pinctrl7, }, > > > { .parse_prop = parse_pinctrl8, }, > > > + { .parse_prop = parse_interrupts, }, > > > { .parse_prop = parse_regulators, }, > > > { .parse_prop = parse_gpio, }, > > > { .parse_prop = parse_gpios, }, > > > > You don't really describe what this is for so I'm only guessing > > from the context. If you want to follow the interrupt hierarchy, > > "interrupt-parent" isn't enough. You also need to track > > things like interrupt-map, or anything that carries a phandle > > to an interrupt controller. > > We don't need to follow the hierarchy, we just need the immediate > dependencies. Indeed. I also wonder why this isn't just a irq_find_parent() call, TBH. > But you are right that 'interrupt-map' also needs to be tracked. And 'interrupts-extended', while we're at it. > > I also noticed that we define 'interrupt-parent' as a dependency to > parse, but that's wrong. The dependency is where 'interrupts' appears > and where 'interrupt-parent' appears is irrelevant. Agreed. Though you need the object the dependency is on, I guess, if you want to be able to have the dependency edge between the device and the interrupt controller. But since the commit message doesn't say much about what this is trying to achieve, I'm only guessing the purpose of this patch. M. -- Without deviation from the norm, progress is not possible.