Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752482AbcL3Jqm (ORCPT ); Fri, 30 Dec 2016 04:46:42 -0500 Received: from szxga01-in.huawei.com ([58.251.152.64]:2068 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750830AbcL3Jqk (ORCPT ); Fri, 30 Dec 2016 04:46:40 -0500 Subject: Re: [PATCH v5 13/14] irqchip: mbigen: introduce mbigen_of_create_domain() To: Hanjun Guo , Marc Zyngier , "Rafael J. Wysocki" , Lorenzo Pieralisi References: <1482384922-21507-1-git-send-email-guohanjun@huawei.com> <1482384922-21507-14-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: <586621D6.3060705@hisilicon.com> Date: Fri, 30 Dec 2016 16:59:02 +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-14-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.58662BA2.0022,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: 4adac9dcc43d536fb1dd883d4393a833 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2647 Lines: 82 On 2016/12/22 13:35, Hanjun Guo wrote: > From: Kefeng Wang > > Introduce mbigen_of_create_domain() to consolidate OF related > code and prepare for ACPI later, no funtional change. > > Signed-off-by: Kefeng Wang > Signed-off-by: Hanjun Guo > Cc: Marc Zyngier > Cc: Thomas Gleixner > Cc: Ma Jun > --- > drivers/irqchip/irq-mbigen.c | 42 +++++++++++++++++++++++++++--------------- > 1 file changed, 27 insertions(+), 15 deletions(-) > > diff --git a/drivers/irqchip/irq-mbigen.c b/drivers/irqchip/irq-mbigen.c > index c01ab41..4e11da5 100644 > --- a/drivers/irqchip/irq-mbigen.c > +++ b/drivers/irqchip/irq-mbigen.c > @@ -236,27 +236,15 @@ static int mbigen_irq_domain_alloc(struct irq_domain *domain, > .free = irq_domain_free_irqs_common, > }; > > -static int mbigen_device_probe(struct platform_device *pdev) > +static int mbigen_of_create_domain(struct platform_device *pdev, > + struct mbigen_device *mgn_chip) > { > - struct mbigen_device *mgn_chip; > + struct device *parent; > struct platform_device *child; > struct irq_domain *domain; > struct device_node *np; > - struct device *parent; > - struct resource *res; > u32 num_pins; > > - mgn_chip = devm_kzalloc(&pdev->dev, sizeof(*mgn_chip), GFP_KERNEL); > - if (!mgn_chip) > - return -ENOMEM; > - > - mgn_chip->pdev = pdev; > - > - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > - mgn_chip->base = devm_ioremap_resource(&pdev->dev, res); > - if (IS_ERR(mgn_chip->base)) > - return PTR_ERR(mgn_chip->base); > - > for_each_child_of_node(pdev->dev.of_node, np) { > if (!of_property_read_bool(np, "interrupt-controller")) > continue; > @@ -280,6 +268,30 @@ static int mbigen_device_probe(struct platform_device *pdev) > return -ENOMEM; > } > > + return 0; > +} > + > +static int mbigen_device_probe(struct platform_device *pdev) > +{ > + struct mbigen_device *mgn_chip; > + struct resource *res; > + int err; > + > + mgn_chip = devm_kzalloc(&pdev->dev, sizeof(*mgn_chip), GFP_KERNEL); > + if (!mgn_chip) > + return -ENOMEM; > + > + mgn_chip->pdev = pdev; > + > + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > + mgn_chip->base = devm_ioremap(&pdev->dev, res->start, resource_size(res)); > + if (IS_ERR(mgn_chip->base)) > + return PTR_ERR(mgn_chip->base); > + > + err = mbigen_of_create_domain(pdev, mgn_chip); > + if (err) > + return err; > + > platform_set_drvdata(pdev, mgn_chip); > return 0; > } Tested-by: Xinwei Kong