From patchwork Thu Sep 7 11:41:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 111885 Delivered-To: patch@linaro.org Received: by 10.140.94.239 with SMTP id g102csp680347qge; Thu, 7 Sep 2017 04:43:36 -0700 (PDT) X-Google-Smtp-Source: ADKCNb5UYQlGK0VQMhTvzx+MHWQqRnLjQhP/Z1fLcJPoTUblmFwQ1TpgChLG9dfaLJT5aMoUqkDI X-Received: by 10.98.34.149 with SMTP id p21mr2463763pfj.322.1504784616879; Thu, 07 Sep 2017 04:43:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504784616; cv=none; d=google.com; s=arc-20160816; b=D1EvzNV9/O5v0+StXCTi9ltkE1iv0xg86wZOfIN85UoAGjXYhk5roAWyzAz6ZDA+5A /Q6CoyQzLArBD44OJfYJGz2+2GIR7BSO4LTNKOjdIPy2K/S0Nm678qzUqmOJWp3GuqgW nzmLlWZRB3q/fxrT2DHU8HJKkIedww5JjNfP3HD9uuV34TPvs6MOKPjMffPOgqu433pm s4ggOnQRqD5Vc+tNMOWqtCxWy8OpMzHMdWor4oW7ET67zeD+ErAHxuvVivopBVZwGhIJ GzxyrZ6C9Nd0eWgoc0Jh4NLmv5eJQXOTXsi4q0PqG8wkmwRFscbRuI+gba3E3rzw3L2h 6PqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=xbUY1K0jjLo1OhZwHK13ZcLB/ioaTubS30TEIhi7Yu4=; b=GqLURfxIAvDsigaJhCQ2t5n5EW/rPqFfD/ox6FV8yvqVZpV0DL4E3pbqRYYGDnaLrW R8geyXsE062kQN/UOwVu5OVNDH7RikjKMKb7ajh+xGWfWtHon0/ese+y12E46qo26NP5 wL48wb/UOtryAPSpkm43hfu1+a3pLGToYreodfbaAd9lxlvGLeuIS+8wMM6pO4FKaIrb +Y1xRBztwKWkLyd43acxy5OnvTm5v1MUcIA84qjhqj5g+QhXW5kbtyw6FYHK0HDwrCu/ daz/iuUoIBnyLMd+z5Bx+vGk3SS1XPh5mINQrYhroepflqWTLABNpsMI0Cmy2PzCYJFf Bzog== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=quCzDmpm; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s63si1735160pfe.65.2017.09.07.04.43.36; Thu, 07 Sep 2017 04:43:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=quCzDmpm; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754249AbdIGLnf (ORCPT + 5 others); Thu, 7 Sep 2017 07:43:35 -0400 Received: from conuserg-09.nifty.com ([210.131.2.76]:16573 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754219AbdIGLnf (ORCPT ); Thu, 7 Sep 2017 07:43:35 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id v87BgcOx021413; Thu, 7 Sep 2017 20:42:40 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com v87BgcOx021413 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1504784561; bh=tBPDlEi/MQ8O4InvKEIaGbXb2RPhZP5Qd5bR8/KNE/s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=quCzDmpmGiKNftUaQJZkojEFSDqCOjMmsBCdBbiY2yRV63UTDcFNzeQDW49pUrvFD 6vstqV9VkdDBBuvVTmEhOUue/Oq6BstdtQx5Er4BFOdshcJE4KBopMYPjPMBBpiKD+ /4l9SZw1om5JoAlzbZm6MmwpadcpVnRHInZQ0ienexG//TZlQ3B77/0bnVkdrvWCIo NuL69p6tQQrG9PffXmEMBGPTiCV+nAd6bdzt4Tp6nOmWMTa+tK57mb5bWA36PlZzSe ew9ZFQkMiwqC8wDguhykJbLHDYjq090Y0Vt23ia2ygriz06kX7DyO5w1K/N7TBOYkP Va6dHupqNFfXA== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: Marc Zyngier , Thomas Gleixner , Linus Walleij , linux-gpio@vger.kernel.org, Rob Herring Cc: Jassi Brar , devicetree@vger.kernel.org, Jason Cooper , Masami Hiramatsu , David Daney , Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH v4 1/6] irqdomain: rename variables in irq_domain_{push, pop}_irq() Date: Thu, 7 Sep 2017 20:41:57 +0900 Message-Id: <1504784522-26841-2-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1504784522-26841-1-git-send-email-yamada.masahiro@socionext.com> References: <1504784522-26841-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org 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. To avoid confusion, flip the direction as follows: root_irq_data -> tail_irq_data child_irq_data -> parent_irq_data Signed-off-by: Masahiro Yamada --- Changes in v4: - Newly added kernel/irq/irqdomain.c | 68 +++++++++++++++++++++++++------------------------- 1 file changed, 34 insertions(+), 34 deletions(-) -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c index e84b705..da3e0b6 100644 --- a/kernel/irq/irqdomain.c +++ b/kernel/irq/irqdomain.c @@ -1467,20 +1467,20 @@ static void irq_domain_fix_revmap(struct irq_data *d) } /** - * irq_domain_push_irq() - Push a domain in to the top of a hierarchy. + * irq_domain_push_irq() - Push a domain in to the tail of a hierarchy. * @domain: Domain to push. * @virq: Irq to push the domain in to. * @arg: Passed to the irq_domain_ops alloc() function. * * For an already existing irqdomain hierarchy, as might be obtained * via a call to pci_enable_msix(), add an additional domain to the - * head of the processing chain. Must be called before request_irq() + * tail of the processing chain. Must be called before request_irq() * has been called. */ int irq_domain_push_irq(struct irq_domain *domain, int virq, void *arg) { - struct irq_data *child_irq_data; - struct irq_data *root_irq_data = irq_get_irq_data(virq); + struct irq_data *parent_irq_data; + struct irq_data *tail_irq_data = irq_get_irq_data(virq); struct irq_desc *desc; int rv = 0; @@ -1505,43 +1505,43 @@ int irq_domain_push_irq(struct irq_domain *domain, int virq, void *arg) if (WARN_ON(!irq_domain_is_hierarchy(domain))) return -EINVAL; - if (!root_irq_data) + if (!tail_irq_data) return -EINVAL; - if (domain->parent != root_irq_data->domain) + if (domain->parent != tail_irq_data->domain) return -EINVAL; - child_irq_data = kzalloc_node(sizeof(*child_irq_data), GFP_KERNEL, - irq_data_get_node(root_irq_data)); - if (!child_irq_data) + parent_irq_data = kzalloc_node(sizeof(*parent_irq_data), GFP_KERNEL, + irq_data_get_node(tail_irq_data)); + if (!parent_irq_data) return -ENOMEM; mutex_lock(&irq_domain_mutex); /* Copy the original irq_data. */ - *child_irq_data = *root_irq_data; + *parent_irq_data = *tail_irq_data; /* - * Overwrite the root_irq_data, which is embedded in struct + * Overwrite the tail_irq_data, which is embedded in struct * irq_desc, with values for this domain. */ - root_irq_data->parent_data = child_irq_data; - root_irq_data->domain = domain; - root_irq_data->mask = 0; - root_irq_data->hwirq = 0; - root_irq_data->chip = NULL; - root_irq_data->chip_data = NULL; + tail_irq_data->parent_data = parent_irq_data; + tail_irq_data->domain = domain; + tail_irq_data->mask = 0; + tail_irq_data->hwirq = 0; + tail_irq_data->chip = NULL; + tail_irq_data->chip_data = NULL; /* May (probably does) set hwirq, chip, etc. */ rv = irq_domain_alloc_irqs_hierarchy(domain, virq, 1, arg); if (rv) { /* Restore the original irq_data. */ - *root_irq_data = *child_irq_data; + *tail_irq_data = *parent_irq_data; goto error; } - irq_domain_fix_revmap(child_irq_data); - irq_domain_set_mapping(domain, root_irq_data->hwirq, root_irq_data); + irq_domain_fix_revmap(parent_irq_data); + irq_domain_set_mapping(domain, tail_irq_data->hwirq, tail_irq_data); error: mutex_unlock(&irq_domain_mutex); @@ -1551,7 +1551,7 @@ int irq_domain_push_irq(struct irq_domain *domain, int virq, void *arg) EXPORT_SYMBOL_GPL(irq_domain_push_irq); /** - * irq_domain_pop_irq() - Remove a domain from the top of a hierarchy. + * irq_domain_pop_irq() - Remove a domain from the tail of a hierarchy. * @domain: Domain to remove. * @virq: Irq to remove the domain from. * @@ -1560,8 +1560,8 @@ EXPORT_SYMBOL_GPL(irq_domain_push_irq); */ int irq_domain_pop_irq(struct irq_domain *domain, int virq) { - struct irq_data *root_irq_data = irq_get_irq_data(virq); - struct irq_data *child_irq_data; + struct irq_data *tail_irq_data = irq_get_irq_data(virq); + struct irq_data *parent_irq_data; struct irq_data *tmp_irq_data; struct irq_desc *desc; @@ -1583,37 +1583,37 @@ int irq_domain_pop_irq(struct irq_domain *domain, int virq) if (domain == NULL) return -EINVAL; - if (!root_irq_data) + if (!tail_irq_data) return -EINVAL; tmp_irq_data = irq_domain_get_irq_data(domain, virq); - /* We can only "pop" if this domain is at the top of the list */ - if (WARN_ON(root_irq_data != tmp_irq_data)) + /* We can only "pop" if this domain is at the tail of the list */ + if (WARN_ON(tail_irq_data != tmp_irq_data)) return -EINVAL; - if (WARN_ON(root_irq_data->domain != domain)) + if (WARN_ON(tail_irq_data->domain != domain)) return -EINVAL; - child_irq_data = root_irq_data->parent_data; - if (WARN_ON(!child_irq_data)) + parent_irq_data = tail_irq_data->parent_data; + if (WARN_ON(!parent_irq_data)) return -EINVAL; mutex_lock(&irq_domain_mutex); - root_irq_data->parent_data = NULL; + tail_irq_data->parent_data = NULL; - irq_domain_clear_mapping(domain, root_irq_data->hwirq); + irq_domain_clear_mapping(domain, tail_irq_data->hwirq); irq_domain_free_irqs_hierarchy(domain, virq, 1); /* Restore the original irq_data. */ - *root_irq_data = *child_irq_data; + *tail_irq_data = *parent_irq_data; - irq_domain_fix_revmap(root_irq_data); + irq_domain_fix_revmap(tail_irq_data); mutex_unlock(&irq_domain_mutex); - kfree(child_irq_data); + kfree(parent_irq_data); return 0; }