Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754833AbdIHPGp (ORCPT ); Fri, 8 Sep 2017 11:06:45 -0400 Received: from conssluserg-04.nifty.com ([210.131.2.83]:21453 "EHLO conssluserg-04.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751941AbdIHPGm (ORCPT ); Fri, 8 Sep 2017 11:06:42 -0400 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-04.nifty.com v88F6UFb028464 X-Nifty-SrcIP: [209.85.161.175] X-Google-Smtp-Source: ADKCNb7w8YMzdKxoycSwKh2CxMXjkqkMuGwjnDrG6UJ0GvC8Ua/D4wi8MgR9+89+0ianra1WRwLdm+nCRnmexDoW0mA= MIME-Version: 1.0 In-Reply-To: References: <1504784522-26841-1-git-send-email-yamada.masahiro@socionext.com> <1504784522-26841-2-git-send-email-yamada.masahiro@socionext.com> From: Masahiro Yamada Date: Sat, 9 Sep 2017 00:05:49 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v4 1/6] irqdomain: rename variables in irq_domain_{push,pop}_irq() To: David Daney Cc: Marc Zyngier , Thomas Gleixner , Linus Walleij , linux-gpio@vger.kernel.org, Rob Herring , Jassi Brar , devicetree@vger.kernel.org, Jason Cooper , Masami Hiramatsu , David Daney , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3395 Lines: 105 Hi Marc, David, 2017-09-08 2:45 GMT+09:00 David Daney : > On 09/07/2017 05:47 AM, Marc Zyngier wrote: >> >> On 07/09/17 12:41, Masahiro Yamada wrote: >>> >>> The meaning of "root" in irq_domain_{push,pop} is opposite to the >>> documentation. Documentation/IRQ-domain.txt depicts the hierarchy >>> IRQ domain as follows: >>> >>> CPU Vector irq_domain (root irq_domain to manage CPU vectors) >>> ^ >>> | >>> Interrupt Remapping irq_domain (manage irq_remapping entries) >>> ^ >>> | >>> IOAPIC irq_domain (manage IOAPIC delivery entries/pins) >>> >>> From above, the inner-most domain (nearest to the CPU) is "root". >>> >>> The document also says, "When building irq_domain hierarchy, the >>> irq_domain near to the device is child and the irq_domain near to >>> CPU is parent." This is how irq_data->parent_data works. In >>> contrast, these function use a variable "child_irq_data" for that. >> >> The exact opposite argument could be used for the data structure. The >> irq_desc is the root of the list ordered with parent_data. >> >> Yes, this is confusing, but because we're using the same English words >> to describe two different things, we're bound to make one thing more >> difficult. I'm unconvinced that this change helps anything (it certainly >> confuses me more than anything else). >> > > There may be room for improvement here. > > Here is my recollection of how I choose the names: > > "root" is the thing embedded in the struct irq_desc, if you think about a > typical linked list structure like this, we can refer to the starting point > as the "root". Sometimes it might be referred to as the "head" of the list, > but usually not the "tail" > > "child" was used to indicate the thing we get to by traversing the link in > the list. The fact that ->parent is the name of the next pointer and that > it points to something called "child" is confusing here. > So what do I think should be done? This: > > Either > A) s/child_irq_data/parent_irq_data/g As this patch does, but leave the > root_irq_data name unchanged. Sounds better than the current situation. > B) Change the name of the ->parent in struct irq_data to ->next This is a bad idea. irq_data->parent_data corresponds to irq_domain->parent. We should not lose consistency/symmetry. irq_domain->parent originates in the "parent" argument passed to irq_domain_create_hierarchy(). If we change this, it will introduce horrible confusion. As the document says, when we talk about the hierarchy, "the irq_domain near to the device is child and the irq_domain near to CPU is parent" This is the original concept, and should not be changed. We can excuse that all the variables in these two helpers were named from the point of linked-list view, not talking about the hierarchy. However, what I thought more confusing was the comment block. /** * irq_domain_push_irq() - Push a domain in to the top of a hierarchy. This comment is talking about the "hierarchy" at first glance. So, what is my mind is the picture in Documentation/IRQ-domain.txt But, from the term "top", this is talking about the linked list here too. The linked list is just implementation detail... > But that is just my $0.02 > > I fear we risk a Bike Shedding type of discussion here. -- Best Regards Masahiro Yamada