From patchwork Tue Jan 19 13:11:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Nowicki X-Patchwork-Id: 8061821 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 42C18BEEE5 for ; Tue, 19 Jan 2016 13:16:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6F5F120386 for ; Tue, 19 Jan 2016 13:16:24 +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 A3EE820138 for ; Tue, 19 Jan 2016 13:16:23 +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 1aLW7Q-0005zO-DM; Tue, 19 Jan 2016 13:14:44 +0000 Received: from mail-wm0-x22e.google.com ([2a00:1450:400c:c09::22e]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aLW4m-0003H1-Du for linux-arm-kernel@lists.infradead.org; Tue, 19 Jan 2016 13:12:01 +0000 Received: by mail-wm0-x22e.google.com with SMTP id b14so170273412wmb.1 for ; Tue, 19 Jan 2016 05:11:40 -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=MKxPMqZInFhvp9zTpYIS1SeuEXw7so8QmJFwzacfnNok8fVuKv/X9TL/w9gj10K2iG ynCFll33OAdBJHCAfBE3j6vgLrdO7C9swluF3gG299Wbq1pGL7zRxho7sNzueeZJe3tL EkT07vhfpar1Ns59gwy2AOB9SukCgGsOKBC9xlYN5SuJe2exAkhsjTymfFvKB8HpSNfl XhD4888KXXaqh1DWNQI7BBLxnrW4naNADijweGMs446kDHY0EsaLmW3nOLo2FiXZGpLU ohXIC6L3drsOMwQSj89bettOPmngYs/q8qtt4iXSLiXMTxOd8u5USqQuKW5R0WYtEYJX P/Eg== 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=UZTGzS8t6wyEJKkO6QcHdmQdV5uDdZCdwMMJGOWD16yVc96A80ugRTNJAOv6ILjqnJ YJOo0Sf6UXWh5FDEIUnJ7BqZ6GPZX5gyUYMSUu9Jv4kz/dQ0AQbLbWE6S8IyVq06sYzd +8RyM+GFplKjWq9pDP1jk/aJTakGbf6wzKJ4jVgOHTG/qKw4nvJRDnOkbD0xuj7STAHv n5AEwfHs9Q2T7a5SM0vo1BXMRZ9gZ8OIiiV2cv6H7vgXvDz09UYdhJ6KyTgikdSutktv ViW4Oy8RwxU7Oy9HuaBWeT5lhaQFqM/RJ8W8RqK5zZaHldWmG6hXKHGB7YXJeLrejtB3 5YYw== X-Gm-Message-State: ALoCoQmVIeAqh1HMnSmefFJwt6E3c/MvG6M9YptyeUr6NkPbpXXVskilebFiXawcYq3ID8IzaaTWvA2sbfFoTXeVfzqEmtQhMA== X-Received: by 10.194.123.167 with SMTP id mb7mr35528647wjb.0.1453209098716; Tue, 19 Jan 2016 05:11:38 -0800 (PST) Received: from tn-HP-4.semihalf.local ([80.82.22.190]) by smtp.gmail.com with ESMTPSA id w194sm17762623wmd.0.2016.01.19.05.11.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 19 Jan 2016 05:11:38 -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 V3 09/10] acpi, gicv3, msi: Factor out code that might be reused for ACPI equivalent. Date: Tue, 19 Jan 2016 14:11:22 +0100 Message-Id: <1453209083-3358-10-git-send-email-tn@semihalf.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1453209083-3358-1-git-send-email-tn@semihalf.com> References: <1453209083-3358-1-git-send-email-tn@semihalf.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160119_051200_757438_B2087F9D X-CRM114-Status: GOOD ( 13.49 ) 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,RP_MATCHES_RCVD,T_DKIM_INVALID,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);