Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753441AbcL3Jvt (ORCPT ); Fri, 30 Dec 2016 04:51:49 -0500 Received: from szxga01-in.huawei.com ([58.251.152.64]:4442 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753795AbcL3Jvs (ORCPT ); Fri, 30 Dec 2016 04:51:48 -0500 Subject: Re: [PATCH v5 06/14] irqchip: gicv3-its: platform-msi: refactor its_pmsi_init() to prepare for ACPI To: Hanjun Guo , Marc Zyngier , "Rafael J. Wysocki" , Lorenzo Pieralisi References: <1482384922-21507-1-git-send-email-guohanjun@huawei.com> <1482384922-21507-7-git-send-email-guohanjun@huawei.com> CC: Charles Garcia-Tobin , , , Tomasz Nowicki , , , Sinan Kaya , , Hanjun Guo , Greg KH , "Thomas Gleixner" , Agustin Vega-Frias , From: Xinwei Kong Message-ID: <58662181.2010409@hisilicon.com> Date: Fri, 30 Dec 2016 16:57:37 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <1482384922-21507-7-git-send-email-guohanjun@huawei.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.57.64.103] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090201.58662B17.00C9,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: f702d2f8739e69cbe375c0cb2ce8d74c Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2668 Lines: 82 On 2016/12/22 13:35, Hanjun Guo wrote: > From: Hanjun Guo > > Introduce its_pmsi_init_one() to refactor the code to isolate > ACPI&DT common code to prepare for ACPI later. > > Signed-off-by: Hanjun Guo > Tested-by: Sinan Kaya > Cc: Marc Zyngier > Cc: Tomasz Nowicki > Cc: Thomas Gleixner > --- > drivers/irqchip/irq-gic-v3-its-platform-msi.c | 45 ++++++++++++++++----------- > 1 file changed, 27 insertions(+), 18 deletions(-) > > diff --git a/drivers/irqchip/irq-gic-v3-its-platform-msi.c b/drivers/irqchip/irq-gic-v3-its-platform-msi.c > index 16587a9..ff72704 100644 > --- a/drivers/irqchip/irq-gic-v3-its-platform-msi.c > +++ b/drivers/irqchip/irq-gic-v3-its-platform-msi.c > @@ -84,34 +84,43 @@ static int its_pmsi_prepare(struct irq_domain *domain, struct device *dev, > {}, > }; > > -static int __init its_pmsi_init(void) > +static int __init its_pmsi_init_one(struct fwnode_handle *fwnode, > + const char *name) > { > - struct device_node *np; > struct irq_domain *parent; > > + parent = irq_find_matching_fwnode(fwnode, DOMAIN_BUS_NEXUS); > + if (!parent || !msi_get_domain_info(parent)) { > + pr_err("%s: unable to locate ITS domain\n", name); > + return -ENXIO; > + } > + > + if (!platform_msi_create_irq_domain(fwnode, &its_pmsi_domain_info, > + parent)) { > + pr_err("%s: unable to create platform domain\n", name); > + return -ENXIO; > + } > + > + pr_info("Platform MSI: %s domain created\n", name); > + return 0; > +} > + > +static void __init its_pmsi_of_init(void) > +{ > + struct device_node *np; > + > for (np = of_find_matching_node(NULL, its_device_id); np; > np = of_find_matching_node(np, its_device_id)) { > if (!of_property_read_bool(np, "msi-controller")) > continue; > > - parent = irq_find_matching_host(np, DOMAIN_BUS_NEXUS); > - if (!parent || !msi_get_domain_info(parent)) { > - pr_err("%s: unable to locate ITS domain\n", > - np->full_name); > - continue; > - } > - > - if (!platform_msi_create_irq_domain(of_node_to_fwnode(np), > - &its_pmsi_domain_info, > - parent)) { > - pr_err("%s: unable to create platform domain\n", > - np->full_name); > - continue; > - } > - > - pr_info("Platform MSI: %s domain created\n", np->full_name); > + its_pmsi_init_one(of_node_to_fwnode(np), np->full_name); > } > +} > > +static int __init its_pmsi_init(void) > +{ > + its_pmsi_of_init(); > return 0; > } > early_initcall(its_pmsi_init); Tested-by: Xinwei Kong