From patchwork Fri Apr 8 10:33:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 65392 Delivered-To: patch@linaro.org Received: by 10.112.43.237 with SMTP id z13csp592364lbl; Fri, 8 Apr 2016 03:34:50 -0700 (PDT) X-Received: by 10.67.6.36 with SMTP id cr4mr11732289pad.146.1460111690141; Fri, 08 Apr 2016 03:34:50 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q14si208570pfi.166.2016.04.08.03.34.49; Fri, 08 Apr 2016 03:34:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758064AbcDHKem (ORCPT + 29 others); Fri, 8 Apr 2016 06:34:42 -0400 Received: from szxga01-in.huawei.com ([58.251.152.64]:7460 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753638AbcDHKel (ORCPT ); Fri, 8 Apr 2016 06:34:41 -0400 Received: from 172.24.1.36 (EHLO szxeml427-hub.china.huawei.com) ([172.24.1.36]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id DII59268; Fri, 08 Apr 2016 18:33:19 +0800 (CST) Received: from [127.0.0.1] (10.177.19.180) by szxeml427-hub.china.huawei.com (10.82.67.182) with Microsoft SMTP Server id 14.3.235.1; Fri, 8 Apr 2016 18:33:09 +0800 Subject: Re: [PATCH] irqchip/mbigen: Display message of MBIGEN domain created To: Marc Zyngier References: <1460099762-51497-1-git-send-email-wangkefeng.wang@huawei.com> <20160408090935.4ec95aa8@arm.com> <57076B2D.8050006@huawei.com> <20160408095325.49aaf6b0@arm.com> CC: Jason Cooper , , , , From: Kefeng Wang Message-ID: <570788E3.3080901@huawei.com> Date: Fri, 8 Apr 2016 18:33:07 +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: <20160408095325.49aaf6b0@arm.com> X-Originating-IP: [10.177.19.180] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020204.570788F1.0038, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=512, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: f15d1ae93e3710825d0dbe2907f5e20e Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2016/4/8 16:53, Marc Zyngier wrote: > On Fri, 8 Apr 2016 16:26:21 +0800 > Kefeng Wang wrote: >>> Overall, this doesn't look like a critical patch to me. I think Ma Jun >>> is working on separate series reworking the way the mgigen is getting >>> probed, so I'd advise you to work with him in order to integrate this >>> patch in his series, as it would make a lot more sense. >> >> When try to enable hip06 d03 board[1], we met following error log, so I add >> some debug message. The mbigen driver use module_platform_driver, the driver >> initialization is too late, and it is without any message, we don't know >> about any info of mbigen. I think we should show something about the mbigen >> domain creation at least. What's your option? >> >> Is there a way to solve this improper print? >> ----------- >> [ 1.345945] irq: no irq domain found for /mbigen_pcie@a0080000/intc_usb ! >> [ 1.353660] irq: no irq domain found for /mbigen_pcie@a0080000/intc_usb ! > > How can printing anything solve this issue? Furthermore, the error > message you quote is pretty explicit: no mbigen for you, move along. > > There is a long standing dependency issue for interrupt controllers > that are also platform devices, and until you resolve (or help > resolving) that issue, you will get that kind of problem. As I > mentioned countless times (both on list and in person), you only have > two options: > > - either you defer probing devices behind the mbigen until the mbigen > itself is up and running > - or you solve the generic dependency problem. > Ok,got it,thanks for your explanation. > I feel a bit like a stuck record here. But there is still one issue in the for_each_child_of_node loop of mbigen_device_probe. Assume that there are 3+ child node(mbigen_gmac, mbigen_i2c, mbigen_xxx, etc) in mbigen_chip_dsa, if one of them with incorrect configuration, then the loop will end, but we still need parse the left child node. we should consider this situation, right? How about split that part into a new mbigen_create_domain(), shown below, and display the result of mbigen domain creation in it. Thanks, Kefeng > > Thanks, > > M. > diff --git a/drivers/irqchip/irq-mbigen.c b/drivers/irqchip/irq-mbigen.c index d67baa2..9c1d22e 100644 --- a/drivers/irqchip/irq-mbigen.c +++ b/drivers/irqchip/irq-mbigen.c @@ -236,15 +236,41 @@ static struct irq_domain_ops mbigen_domain_ops = { .free = irq_domain_free_irqs_common, }; -static int mbigen_device_probe(struct platform_device *pdev) +static void mbigen_create_domain(struct mbigen_device *mgn_dev, struct device_node *np) { - struct mbigen_device *mgn_chip; + struct device *parent = platform_bus_type.dev_root; + struct device *dev = &mgn_dev->pdev->dev; struct platform_device *child; struct irq_domain *domain; + u32 num_pins; + + if (!of_property_read_bool(np, "interrupt-controller")) + goto err; + + if (of_property_read_u32(np, "num-pins", &num_pins)) + goto err; + + child = of_platform_device_create(np, NULL, parent); + if (IS_ERR(child)) + goto err; + + domain = platform_msi_create_device_domain(&child->dev, num_pins, + mbigen_write_msg, + &mbigen_domain_ops, + mgn_dev); + if (!domain) + goto err; + + dev_info(dev, "%s domain created\n", np->full_name); +err: + dev_err(dev, "unable to create %s domain\n", np->full_name); +} + +static int mbigen_device_probe(struct platform_device *pdev) +{ + struct mbigen_device *mgn_chip; 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) @@ -257,28 +283,8 @@ static int mbigen_device_probe(struct platform_device *pdev) 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; - - parent = platform_bus_type.dev_root; - child = of_platform_device_create(np, NULL, parent); - if (IS_ERR(child)) - return PTR_ERR(child); - - if (of_property_read_u32(child->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(&child->dev, num_pins, - mbigen_write_msg, - &mbigen_domain_ops, - mgn_chip); - if (!domain) - return -ENOMEM; - } + for_each_child_of_node(pdev->dev.of_node, np) + mbigen_create_domain(mgn_chip, np); platform_set_drvdata(pdev, mgn_chip);