From: "majun (F)" <majun258@huawei.com> To: Marc Zyngier <marc.zyngier@arm.com>, Catalin Marinas <Catalin.Marinas@arm.com>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, "linux-arm-kernel@lists.infradead.org" <linux-arm-kernel@lists.infradead.org>, Will Deacon <Will.Deacon@arm.com>, Mark Rutland <Mark.Rutland@arm.com>, "jason@lakedaemon.net" <jason@lakedaemon.net>, "tglx@linutronix.de" <tglx@linutronix.de>, "lizefan@huawei.com" <lizefan@huawei.com>, "huxinwei@huawei.com" <huxinwei@huawei.com> Subject: Re: [PATCH v2 2/3] IRQ/Gic-V3: Change arm-gic-its to support the Mbigen interrupt Date: Fri, 26 Jun 2015 18:28:07 +0800 [thread overview] Message-ID: <558D2937.7060408@huawei.com> (raw) In-Reply-To: <558D10E1.8040701@arm.com> Hi Marc: 在 2015/6/26 16:44, Marc Zyngier 写道: > > You can then keep your MBI stuff in a separate file, and call into > its_msi_prepare. > Thanks for your good suggestion! I have two questions: Question 1: I found the ‘its_msi_preapare ' defined without static. So,I guess you mean I can call this fucntion directly from mbigen driver, right? or I need make the code likes below and leave these code in ITS? static struct mbigen_domain_ops its_mbigen_ops = { + .mbigen_prepare = its_msi_prepare, }; static struct mbigen_domain_info its_mbigen_domain_info = { .ops = &its_mbigen_ops, }; Question 2: @@ -1489,6 +1538,18 @@ static int its_probe(struct device_node *node, struct irq_domain *parent) err = of_pci_msi_chip_add(&its->msi_chip); if (err) goto out_free_domains; + + if (IS_ENABLED(CONFIG_MBIGEN_IRQ_DOMAIN)) { + its->mbi_chip.domain = its_mbigen_create_irq_domain(node, + &its_mbigen_domain_info, + its->domain); + + if (!its->mbi_chip.domain) { + err = -ENOMEM; + pr_warn_once("ITS:no mbigen chip found\n"); + goto out_free_mbigen; + } + } } spin_lock(&its_lock); @@ -1497,6 +1558,9 @@ static int its_probe(struct device_node *node, struct irq_domain *parent) return 0; +out_free_mbigen: + if (its->mbi_chip.domain) + irq_domain_remove(its->mbi_chip.domain); out_free_domains: if (its->msi_chip.domain) irq_domain_remove(its->msi_chip.domain); What's you opinion about the code above Leave it in ITS or create the mbi irq domain in mbigen driver? If I have to create mbi irq domain in mbigen driver, I need a pointer of its domain. For this problem, I think i can solve it by using its_nodes’ in mbigen driver *if* [1] add a member " struct device_node *node" in 'struct its_node' [2] in 'its_probe' function , add its->node = node; [3] remove the static definition from 'static LIST_HEAD(its_nodes);' How is you opinion? Thansks again! >> Now, all these functions and data structure are defined as static. >> to use them, I have to remove the 'static' definition and put them >> in a head file ( create a new head file). > > I don't want to see these functions and structure leaking out of the > ITS code unless we're absolutely forced to do so. The above code > shows you one possible way to solve the problem. >
WARNING: multiple messages have this Message-ID (diff)
From: majun258@huawei.com (majun (F)) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 2/3] IRQ/Gic-V3: Change arm-gic-its to support the Mbigen interrupt Date: Fri, 26 Jun 2015 18:28:07 +0800 [thread overview] Message-ID: <558D2937.7060408@huawei.com> (raw) In-Reply-To: <558D10E1.8040701@arm.com> Hi Marc: ? 2015/6/26 16:44, Marc Zyngier ??: > > You can then keep your MBI stuff in a separate file, and call into > its_msi_prepare. > Thanks for your good suggestion! I have two questions: Question 1: I found the ?its_msi_preapare ' defined without static. So,I guess you mean I can call this fucntion directly from mbigen driver, right? or I need make the code likes below and leave these code in ITS? static struct mbigen_domain_ops its_mbigen_ops = { + .mbigen_prepare = its_msi_prepare, }; static struct mbigen_domain_info its_mbigen_domain_info = { .ops = &its_mbigen_ops, }; Question 2: @@ -1489,6 +1538,18 @@ static int its_probe(struct device_node *node, struct irq_domain *parent) err = of_pci_msi_chip_add(&its->msi_chip); if (err) goto out_free_domains; + + if (IS_ENABLED(CONFIG_MBIGEN_IRQ_DOMAIN)) { + its->mbi_chip.domain = its_mbigen_create_irq_domain(node, + &its_mbigen_domain_info, + its->domain); + + if (!its->mbi_chip.domain) { + err = -ENOMEM; + pr_warn_once("ITS:no mbigen chip found\n"); + goto out_free_mbigen; + } + } } spin_lock(&its_lock); @@ -1497,6 +1558,9 @@ static int its_probe(struct device_node *node, struct irq_domain *parent) return 0; +out_free_mbigen: + if (its->mbi_chip.domain) + irq_domain_remove(its->mbi_chip.domain); out_free_domains: if (its->msi_chip.domain) irq_domain_remove(its->msi_chip.domain); What's you opinion about the code above Leave it in ITS or create the mbi irq domain in mbigen driver? If I have to create mbi irq domain in mbigen driver, I need a pointer of its domain. For this problem, I think i can solve it by using its_nodes? in mbigen driver *if* [1] add a member " struct device_node *node" in 'struct its_node' [2] in 'its_probe' function , add its->node = node; [3] remove the static definition from 'static LIST_HEAD(its_nodes);' How is you opinion? Thansks again! >> Now, all these functions and data structure are defined as static. >> to use them, I have to remove the 'static' definition and put them >> in a head file ? create a new head file). > > I don't want to see these functions and structure leaking out of the > ITS code unless we're absolutely forced to do so. The above code > shows you one possible way to solve the problem. >
next prev parent reply other threads:[~2015-06-26 10:28 UTC|newest] Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-06-12 2:49 [PATCH v2 0/3] IRQ/Gic-V3:Support Mbigen interrupt controller Ma Jun 2015-06-12 2:49 ` Ma Jun 2015-06-12 2:49 ` [PATCH v2 1/3] IRQ/Gic-V3: Add mbigen driver to support mbigen " Ma Jun 2015-06-12 2:49 ` Ma Jun 2015-06-12 2:49 ` [PATCH v2 2/3] IRQ/Gic-V3: Change arm-gic-its to support the Mbigen interrupt Ma Jun 2015-06-12 2:49 ` Ma Jun 2015-06-12 10:48 ` Thomas Gleixner 2015-06-12 10:48 ` Thomas Gleixner 2015-06-15 7:05 ` majun (F) 2015-06-15 7:05 ` majun (F) 2015-06-18 23:52 ` Thomas Gleixner 2015-06-18 23:52 ` Thomas Gleixner 2015-06-23 9:03 ` majun (F) 2015-06-23 9:03 ` majun (F) 2015-06-23 9:29 ` Thomas Gleixner 2015-06-23 9:29 ` Thomas Gleixner 2015-06-26 8:45 ` Marc Zyngier 2015-06-26 8:45 ` Marc Zyngier 2015-06-26 6:31 ` majun (F) 2015-06-26 6:31 ` majun (F) 2015-06-26 8:44 ` Marc Zyngier 2015-06-26 8:44 ` Marc Zyngier 2015-06-26 10:28 ` majun (F) [this message] 2015-06-26 10:28 ` majun (F) 2015-06-26 10:40 ` Marc Zyngier 2015-06-26 10:40 ` Marc Zyngier 2015-06-26 12:04 ` majun (F) 2015-06-26 12:04 ` majun (F) 2015-06-26 13:14 ` Marc Zyngier 2015-06-26 13:14 ` Marc Zyngier 2015-06-12 2:49 ` [PATCH v2 3/3] dt-binding:Documents the mbigen bindings Ma Jun 2015-06-12 2:49 ` Ma Jun
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=558D2937.7060408@huawei.com \ --to=majun258@huawei.com \ --cc=Catalin.Marinas@arm.com \ --cc=Mark.Rutland@arm.com \ --cc=Will.Deacon@arm.com \ --cc=huxinwei@huawei.com \ --cc=jason@lakedaemon.net \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=lizefan@huawei.com \ --cc=marc.zyngier@arm.com \ --cc=tglx@linutronix.de \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.