{"id":810977,"url":"http://patchwork.ozlabs.org/api/patches/810977/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-gpio/patch/1504784522-26841-2-git-send-email-yamada.masahiro@socionext.com/","project":{"id":42,"url":"http://patchwork.ozlabs.org/api/projects/42/?format=json","name":"Linux GPIO development","link_name":"linux-gpio","list_id":"linux-gpio.vger.kernel.org","list_email":"linux-gpio@vger.kernel.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<1504784522-26841-2-git-send-email-yamada.masahiro@socionext.com>","list_archive_url":null,"date":"2017-09-07T11:41:57","name":"[v4,1/6] irqdomain: rename variables in irq_domain_{push,pop}_irq()","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"6232e59992d2cb1873f120da4fc5fd6a59175114","submitter":{"id":65882,"url":"http://patchwork.ozlabs.org/api/people/65882/?format=json","name":"Masahiro Yamada","email":"yamada.masahiro@socionext.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-gpio/patch/1504784522-26841-2-git-send-email-yamada.masahiro@socionext.com/mbox/","series":[{"id":1983,"url":"http://patchwork.ozlabs.org/api/series/1983/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-gpio/list/?series=1983","date":"2017-09-07T11:41:57","name":"irqdomain, gpio: expand irq_domain_push_irq() for DT use and use it for GPIO","version":4,"mbox":"http://patchwork.ozlabs.org/series/1983/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/810977/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/810977/checks/","tags":{},"related":[],"headers":{"Return-Path":"<linux-gpio-owner@vger.kernel.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=linux-gpio-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=nifty.com header.i=@nifty.com\n\theader.b=\"quCzDmpm\"; dkim-atps=neutral"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xnz9h5m0Fz9sRY\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu,  7 Sep 2017 21:43:36 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1754249AbdIGLnf (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tThu, 7 Sep 2017 07:43:35 -0400","from conuserg-09.nifty.com ([210.131.2.76]:16573 \"EHLO\n\tconuserg-09.nifty.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1754219AbdIGLnf (ORCPT\n\t<rfc822; linux-gpio@vger.kernel.org>); Thu, 7 Sep 2017 07:43:35 -0400","from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp\n\t[153.142.97.92]) (authenticated)\n\tby conuserg-09.nifty.com with ESMTP id v87BgcOx021413;\n\tThu, 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;\n\ts=dec2015msa; t=1504784561;\n\tbh=tBPDlEi/MQ8O4InvKEIaGbXb2RPhZP5Qd5bR8/KNE/s=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=quCzDmpmGiKNftUaQJZkojEFSDqCOjMmsBCdBbiY2yRV63UTDcFNzeQDW49pUrvFD\n\t6vstqV9VkdDBBuvVTmEhOUue/Oq6BstdtQx5Er4BFOdshcJE4KBopMYPjPMBBpiKD+\n\t/4l9SZw1om5JoAlzbZm6MmwpadcpVnRHInZQ0ienexG//TZlQ3B77/0bnVkdrvWCIo\n\tNuL69p6tQQrG9PffXmEMBGPTiCV+nAd6bdzt4Tp6nOmWMTa+tK57mb5bWA36PlZzSe\n\tew9ZFQkMiwqC8wDguhykJbLHDYjq090Y0Vt23ia2ygriz06kX7DyO5w1K/N7TBOYkP\n\tVa6dHupqNFfXA==","X-Nifty-SrcIP":"[153.142.97.92]","From":"Masahiro Yamada <yamada.masahiro@socionext.com>","To":"Marc Zyngier <marc.zyngier@arm.com>,\n\tThomas Gleixner <tglx@linutronix.de>,\n\tLinus Walleij <linus.walleij@linaro.org>,\n\tlinux-gpio@vger.kernel.org, Rob Herring <robh+dt@kernel.org>","Cc":"Jassi Brar <jaswinder.singh@linaro.org>,\n\tdevicetree@vger.kernel.org, Jason Cooper <jason@lakedaemon.net>,\n\tMasami Hiramatsu <mhiramat@kernel.org>,\n\tDavid Daney <david.daney@cavium.com>,\n\tMasahiro Yamada <yamada.masahiro@socionext.com>,\n\tlinux-kernel@vger.kernel.org","Subject":"[PATCH v4 1/6] irqdomain: rename variables in irq_domain_{push,\n\tpop}_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":"<linux-gpio.vger.kernel.org>","X-Mailing-List":"linux-gpio@vger.kernel.org"},"content":"The meaning of \"root\" in irq_domain_{push,pop} is opposite to the\ndocumentation.  Documentation/IRQ-domain.txt depicts the hierarchy\nIRQ domain as follows:\n\n    CPU Vector irq_domain (root irq_domain to manage CPU vectors)\n            ^\n            |\n    Interrupt Remapping irq_domain (manage irq_remapping entries)\n            ^\n            |\n    IOAPIC irq_domain (manage IOAPIC delivery entries/pins)\n\nFrom above, the inner-most domain (nearest to the CPU) is \"root\".\n\nThe document also says, \"When building irq_domain hierarchy, the\nirq_domain near to the device is child and the irq_domain near to\nCPU is parent.\"  This is how irq_data->parent_data works.  In\ncontrast, these function use a variable \"child_irq_data\" for that.\n\nTo avoid confusion, flip the direction as follows:\n\n  root_irq_data  -> tail_irq_data\n  child_irq_data -> parent_irq_data\n\nSigned-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>\n---\n\nChanges in v4:\n - Newly added\n\n\n kernel/irq/irqdomain.c | 68 +++++++++++++++++++++++++-------------------------\n 1 file changed, 34 insertions(+), 34 deletions(-)","diff":"diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c\nindex e84b705..da3e0b6 100644\n--- a/kernel/irq/irqdomain.c\n+++ b/kernel/irq/irqdomain.c\n@@ -1467,20 +1467,20 @@ static void irq_domain_fix_revmap(struct irq_data *d)\n }\n \n /**\n- * irq_domain_push_irq() - Push a domain in to the top of a hierarchy.\n+ * irq_domain_push_irq() - Push a domain in to the tail of a hierarchy.\n  * @domain:\tDomain to push.\n  * @virq:\tIrq to push the domain in to.\n  * @arg:\tPassed to the irq_domain_ops alloc() function.\n  *\n  * For an already existing irqdomain hierarchy, as might be obtained\n  * via a call to pci_enable_msix(), add an additional domain to the\n- * head of the processing chain.  Must be called before request_irq()\n+ * tail of the processing chain.  Must be called before request_irq()\n  * has been called.\n  */\n int irq_domain_push_irq(struct irq_domain *domain, int virq, void *arg)\n {\n-\tstruct irq_data *child_irq_data;\n-\tstruct irq_data *root_irq_data = irq_get_irq_data(virq);\n+\tstruct irq_data *parent_irq_data;\n+\tstruct irq_data *tail_irq_data = irq_get_irq_data(virq);\n \tstruct irq_desc *desc;\n \tint rv = 0;\n \n@@ -1505,43 +1505,43 @@ int irq_domain_push_irq(struct irq_domain *domain, int virq, void *arg)\n \tif (WARN_ON(!irq_domain_is_hierarchy(domain)))\n \t\treturn -EINVAL;\n \n-\tif (!root_irq_data)\n+\tif (!tail_irq_data)\n \t\treturn -EINVAL;\n \n-\tif (domain->parent != root_irq_data->domain)\n+\tif (domain->parent != tail_irq_data->domain)\n \t\treturn -EINVAL;\n \n-\tchild_irq_data = kzalloc_node(sizeof(*child_irq_data), GFP_KERNEL,\n-\t\t\t\t      irq_data_get_node(root_irq_data));\n-\tif (!child_irq_data)\n+\tparent_irq_data = kzalloc_node(sizeof(*parent_irq_data), GFP_KERNEL,\n+\t\t\t\t      irq_data_get_node(tail_irq_data));\n+\tif (!parent_irq_data)\n \t\treturn -ENOMEM;\n \n \tmutex_lock(&irq_domain_mutex);\n \n \t/* Copy the original irq_data. */\n-\t*child_irq_data = *root_irq_data;\n+\t*parent_irq_data = *tail_irq_data;\n \n \t/*\n-\t * Overwrite the root_irq_data, which is embedded in struct\n+\t * Overwrite the tail_irq_data, which is embedded in struct\n \t * irq_desc, with values for this domain.\n \t */\n-\troot_irq_data->parent_data = child_irq_data;\n-\troot_irq_data->domain = domain;\n-\troot_irq_data->mask = 0;\n-\troot_irq_data->hwirq = 0;\n-\troot_irq_data->chip = NULL;\n-\troot_irq_data->chip_data = NULL;\n+\ttail_irq_data->parent_data = parent_irq_data;\n+\ttail_irq_data->domain = domain;\n+\ttail_irq_data->mask = 0;\n+\ttail_irq_data->hwirq = 0;\n+\ttail_irq_data->chip = NULL;\n+\ttail_irq_data->chip_data = NULL;\n \n \t/* May (probably does) set hwirq, chip, etc. */\n \trv = irq_domain_alloc_irqs_hierarchy(domain, virq, 1, arg);\n \tif (rv) {\n \t\t/* Restore the original irq_data. */\n-\t\t*root_irq_data = *child_irq_data;\n+\t\t*tail_irq_data = *parent_irq_data;\n \t\tgoto error;\n \t}\n \n-\tirq_domain_fix_revmap(child_irq_data);\n-\tirq_domain_set_mapping(domain, root_irq_data->hwirq, root_irq_data);\n+\tirq_domain_fix_revmap(parent_irq_data);\n+\tirq_domain_set_mapping(domain, tail_irq_data->hwirq, tail_irq_data);\n \n error:\n \tmutex_unlock(&irq_domain_mutex);\n@@ -1551,7 +1551,7 @@ int irq_domain_push_irq(struct irq_domain *domain, int virq, void *arg)\n EXPORT_SYMBOL_GPL(irq_domain_push_irq);\n \n /**\n- * irq_domain_pop_irq() - Remove a domain from the top of a hierarchy.\n+ * irq_domain_pop_irq() - Remove a domain from the tail of a hierarchy.\n  * @domain:\tDomain to remove.\n  * @virq:\tIrq to remove the domain from.\n  *\n@@ -1560,8 +1560,8 @@ EXPORT_SYMBOL_GPL(irq_domain_push_irq);\n  */\n int irq_domain_pop_irq(struct irq_domain *domain, int virq)\n {\n-\tstruct irq_data *root_irq_data = irq_get_irq_data(virq);\n-\tstruct irq_data *child_irq_data;\n+\tstruct irq_data *tail_irq_data = irq_get_irq_data(virq);\n+\tstruct irq_data *parent_irq_data;\n \tstruct irq_data *tmp_irq_data;\n \tstruct irq_desc *desc;\n \n@@ -1583,37 +1583,37 @@ int irq_domain_pop_irq(struct irq_domain *domain, int virq)\n \tif (domain == NULL)\n \t\treturn -EINVAL;\n \n-\tif (!root_irq_data)\n+\tif (!tail_irq_data)\n \t\treturn -EINVAL;\n \n \ttmp_irq_data = irq_domain_get_irq_data(domain, virq);\n \n-\t/* We can only \"pop\" if this domain is at the top of the list */\n-\tif (WARN_ON(root_irq_data != tmp_irq_data))\n+\t/* We can only \"pop\" if this domain is at the tail of the list */\n+\tif (WARN_ON(tail_irq_data != tmp_irq_data))\n \t\treturn -EINVAL;\n \n-\tif (WARN_ON(root_irq_data->domain != domain))\n+\tif (WARN_ON(tail_irq_data->domain != domain))\n \t\treturn -EINVAL;\n \n-\tchild_irq_data = root_irq_data->parent_data;\n-\tif (WARN_ON(!child_irq_data))\n+\tparent_irq_data = tail_irq_data->parent_data;\n+\tif (WARN_ON(!parent_irq_data))\n \t\treturn -EINVAL;\n \n \tmutex_lock(&irq_domain_mutex);\n \n-\troot_irq_data->parent_data = NULL;\n+\ttail_irq_data->parent_data = NULL;\n \n-\tirq_domain_clear_mapping(domain, root_irq_data->hwirq);\n+\tirq_domain_clear_mapping(domain, tail_irq_data->hwirq);\n \tirq_domain_free_irqs_hierarchy(domain, virq, 1);\n \n \t/* Restore the original irq_data. */\n-\t*root_irq_data = *child_irq_data;\n+\t*tail_irq_data = *parent_irq_data;\n \n-\tirq_domain_fix_revmap(root_irq_data);\n+\tirq_domain_fix_revmap(tail_irq_data);\n \n \tmutex_unlock(&irq_domain_mutex);\n \n-\tkfree(child_irq_data);\n+\tkfree(parent_irq_data);\n \n \treturn 0;\n }\n","prefixes":["v4","1/6"]}