From patchwork Thu Dec 17 11:52:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Nowicki X-Patchwork-Id: 7872621 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9FB5B9F1C2 for ; Thu, 17 Dec 2015 11:59:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 26266202AE for ; Thu, 17 Dec 2015 11:59:02 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 621FE202A1 for ; Thu, 17 Dec 2015 11:58:56 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1a9XBB-0005uv-6c; Thu, 17 Dec 2015 11:57:05 +0000 Received: from mail-wm0-x235.google.com ([2a00:1450:400c:c09::235]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1a9X7H-0001I5-51 for linux-arm-kernel@lists.infradead.org; Thu, 17 Dec 2015 11:53:07 +0000 Received: by mail-wm0-x235.google.com with SMTP id p187so19684857wmp.0 for ; Thu, 17 Dec 2015 03:52:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=GbGCyFLchUIIlwxLuZELYwQQhIIwucPxx2afYlBSy4w=; b=tE/Q8/g+RB1KZV70fOv696kQJ2V5AQJW97U2PB10kS46vuWnxXuccNzszomkL4xqLZ zWJUacOh/EoX8KsxylvWhywTA0o7ICJC4VcLd0yIIUv1R9e8gr8VP+GIUk8yZAdo+kZr nfwSQ4hQB5OsmWZPim8fxLZivTcYhKRdgEKGNWtUtpnT5Wg24FX5u1Zx+hvwPxlSY8Dm jSF+nwdLBQe2/Fvf9MOxUpvI/+067DfCiPecSYPmooJcAoTgKrLHEjwEpKYs6d5TCTgV JTGGzkvp4kpDEKq2E8r0sf1bGrh6dBGfpeb/iQomrkHv7HBcHdnAOvUFpSiPtWF+WLrp 1RpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=GbGCyFLchUIIlwxLuZELYwQQhIIwucPxx2afYlBSy4w=; b=KakALVuA3t0yXfo126MFLIxNEwwL7FmsNPTkcLr91i90Z58H+RQvVHnm+GmwZKslJt yDCDp3AOmXtYsnoHpXyyTsDH/4n6sS6q2rsctJ9I2G4pVYOxj6f3OjQnlgJKe8yjDcLq TwCX4t2/RezprEYqQOXgmDizLJ2oSVZS/ROFEKnNMbfyhamTPPfhvs/ksb6ot4Ah+3lu vLDFs6t1vm7qqhW8U0m7zrIEtGvBPbpZJscGnxIwzIRAH4LZlsmp8CKHEHK64JNVXE2/ ssgxvxuWJctlx3QiKq8qXoIAaHTasaHfZLB/G6IXN16DICGbgr1XFesozHeZIXZBCTZb ueVQ== X-Gm-Message-State: ALoCoQnFmlllIKdQTO+UE4o/ejYhr7Q09CkYgBt04qQstKU7VY9XIHum5imGexw1S+myFIE8i5LtHyhF6595dsGqzdG4+dRXEw== X-Received: by 10.194.134.102 with SMTP id pj6mr62590804wjb.23.1450353164865; Thu, 17 Dec 2015 03:52:44 -0800 (PST) Received: from tn-HP-4.semihalf.local (cardhu.semihalf.com. [213.17.239.108]) by smtp.gmail.com with ESMTPSA id kb5sm10137208wjc.20.2015.12.17.03.52.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 17 Dec 2015 03:52:44 -0800 (PST) From: Tomasz Nowicki To: marc.zyngier@arm.com, tglx@linutronix.de, jason@lakedaemon.net, rjw@rjwysocki.net, lorenzo.pieralisi@arm.com, robert.richter@caviumnetworks.com, shijie.huang@arm.com, guohanjun@huawei.com, Suravee.Suthikulpanit@amd.com Subject: [PATCH V2 09/10] acpi, gicv3, msi: Factor out code that might be reused for ACPI equivalent. Date: Thu, 17 Dec 2015 12:52:12 +0100 Message-Id: <1450353133-15992-10-git-send-email-tn@semihalf.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1450353133-15992-1-git-send-email-tn@semihalf.com> References: <1450353133-15992-1-git-send-email-tn@semihalf.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151217_035303_628191_D56996FA X-CRM114-Status: GOOD ( 13.45 ) X-Spam-Score: -2.6 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: graeme.gregory@linaro.org, Catalin.Marinas@arm.com, will.deacon@arm.com, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, hanjun.guo@linaro.org, ddaney.cavm@gmail.com, Tomasz Nowicki , mw@semihalf.com, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Firmware agnostic code lands in separate function which do necessary domain initialization based on unique domain handler. Signed-off-by: Tomasz Nowicki --- drivers/irqchip/irq-gic-v3-its-pci-msi.c | 43 +++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/drivers/irqchip/irq-gic-v3-its-pci-msi.c b/drivers/irqchip/irq-gic-v3-its-pci-msi.c index aee60ed..06165cb 100644 --- a/drivers/irqchip/irq-gic-v3-its-pci-msi.c +++ b/drivers/irqchip/irq-gic-v3-its-pci-msi.c @@ -106,34 +106,47 @@ static struct of_device_id its_device_id[] = { {}, }; -static int __init its_pci_msi_init(void) +static int __init its_pci_msi_init_one(struct fwnode_handle *handle) { - struct device_node *np; struct irq_domain *parent; + parent = irq_find_matching_fwnode(handle, DOMAIN_BUS_NEXUS); + if (!parent || !msi_get_domain_info(parent)) { + pr_err("Unable to locate ITS domain\n"); + return -ENXIO; + } + + if (!pci_msi_create_irq_domain(handle, &its_pci_msi_domain_info, + parent)) { + pr_err("Unable to create PCI domain\n"); + return -ENOMEM; + } + + return 0; +} + +static int __init its_pci_of_msi_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); + if (its_pci_msi_init_one(of_node_to_fwnode(np))) continue; - } - - if (!pci_msi_create_irq_domain(of_node_to_fwnode(np), - &its_pci_msi_domain_info, - parent)) { - pr_err("%s: unable to create PCI domain\n", - np->full_name); - continue; - } pr_info("PCI/MSI: %s domain created\n", np->full_name); } return 0; } + +static int __init its_pci_msi_init(void) +{ + its_pci_of_msi_init(); + return 0; +} + early_initcall(its_pci_msi_init);