Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933444AbcCNGpy (ORCPT ); Mon, 14 Mar 2016 02:45:54 -0400 Received: from szxga01-in.huawei.com ([58.251.152.64]:39516 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751525AbcCNGph (ORCPT ); Mon, 14 Mar 2016 02:45:37 -0400 From: MaJun To: , , , , , , , , , , , , , , Subject: [PATCH v2 2/2] Irq/mbigen:Change the mbigen driver based on the new mbigen node definition. Date: Mon, 14 Mar 2016 14:45:07 +0800 Message-ID: <1457937907-14008-3-git-send-email-majun258@huawei.com> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1457937907-14008-1-git-send-email-majun258@huawei.com> References: <1457937907-14008-1-git-send-email-majun258@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.177.235.245] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020201.56E65DFF.006E,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: d67b988107137a13cc1a1cb4c910cdd7 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2145 Lines: 71 From: Ma Jun To fix the IO remap problem, change the mbigen driver based on the new mbigen node definition. Signed-off-by: Ma Jun --- drivers/irqchip/irq-mbigen.c | 30 +++++++++++++++++++++--------- 1 files changed, 21 insertions(+), 9 deletions(-) diff --git a/drivers/irqchip/irq-mbigen.c b/drivers/irqchip/irq-mbigen.c index 4dd3eb8..4d413bc 100644 --- a/drivers/irqchip/irq-mbigen.c +++ b/drivers/irqchip/irq-mbigen.c @@ -242,6 +242,8 @@ static int mbigen_device_probe(struct platform_device *pdev) struct resource *res; struct irq_domain *domain; u32 num_pins; + struct platform_device *child_pdev; + struct device_node *np; mgn_chip = devm_kzalloc(&pdev->dev, sizeof(*mgn_chip), GFP_KERNEL); if (!mgn_chip) @@ -251,25 +253,35 @@ static int mbigen_device_probe(struct platform_device *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); - if (of_property_read_u32(pdev->dev.of_node, "num-pins", &num_pins) < 0) { - dev_err(&pdev->dev, "No num-pins property\n"); - return -EINVAL; - } + for_each_child_of_node(pdev->dev.of_node, np) { + if (!of_property_read_bool(np, "interrupt-controller")) + continue; + + child_pdev = of_platform_device_create(np, NULL, platform_bus_type.dev_root); + if (IS_ERR(child_pdev)) + return PTR_ERR(child_pdev); + + if (of_property_read_u32(child_pdev->dev.of_node, "num-pins", &num_pins) < 0) { + dev_err(&pdev->dev, "No num-pins property\n"); + return -EINVAL; + } - domain = platform_msi_create_device_domain(&pdev->dev, num_pins, + domain = platform_msi_create_device_domain(&child_pdev->dev, num_pins, mbigen_write_msg, &mbigen_domain_ops, mgn_chip); - if (!domain) - return -ENOMEM; + if (!domain) + return -ENOMEM; - platform_set_drvdata(pdev, mgn_chip); + dev_info(&child_pdev->dev, "Allocated %d MSIs\n", num_pins); + } - dev_info(&pdev->dev, "Allocated %d MSIs\n", num_pins); + platform_set_drvdata(pdev, mgn_chip); return 0; } -- 1.7.1