From patchwork Mon Jan 2 13:31:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanjun Guo X-Patchwork-Id: 9493627 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9A3F962AB4 for ; Mon, 2 Jan 2017 13:35:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 885481FF35 for ; Mon, 2 Jan 2017 13:35:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7940D266F3; Mon, 2 Jan 2017 13:35:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=unavailable version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id 2FC4E1FF35 for ; Mon, 2 Jan 2017 13:35:28 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1cO2kR-0005p9-N9; Mon, 02 Jan 2017 13:33:59 +0000 Received: from mail-pf0-x22f.google.com ([2607:f8b0:400e:c00::22f]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1cO2kG-0005X6-Fo for linux-arm-kernel@lists.infradead.org; Mon, 02 Jan 2017 13:33:52 +0000 Received: by mail-pf0-x22f.google.com with SMTP id c4so73072088pfb.1 for ; Mon, 02 Jan 2017 05:33:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=IFAEyP/90GZNp5PldcALNfFjkBMNFEHRU3nzhFD341A=; b=In6/IBdJgDtmh+n4LAMr8QbtTVjKslKptXHPwGFL5HN0BjUx0lXKKhiMqlzS2rUIUL K2zmaL9U32NzO4z7pEDYaGQthuZiKQkblDzipMlrj/uPbVwQJhnGYLHpJwiPLq6NjRB4 6zuQjoSGwJoRQXy1EIj+CZjVvQAzSEiUnkwhU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=IFAEyP/90GZNp5PldcALNfFjkBMNFEHRU3nzhFD341A=; b=pfcdAigplt4pwxkY6FmOeeWmy0W39VxOHJwbeqv4JNsWn+OGmORqZIx0QhYEKjcFk4 B9m+vO6g+rAdDzEhw+1I1fHNMtCMawRVtYiE/h7J6M2VMjVlCcCqvqaMnm0EPbi4AsCE 0+O8DbTxdcI02OcGbBuE5RxOjYGKy0X+TUYwo7dRGq2Ppxib27D8S9c+BmJT4h/dCRck JvUZ6eeDeqBX5T32FJ1KwYJKPjVF0yuTQD5X2Izl3xqaOql/k0VX9NGkFuG+U7G7JnDc 1SJGJ3oVlxM1fXfPHICxD81fOMZYs0Ii0fBZSMfnylR2qngqd1UzCXBLKNKNWLPEhYna VXnA== X-Gm-Message-State: AIkVDXJIW2ff/q1LBwJc5ONl62C9JjudRgg/zVLaHvivPgQS9JpTQMFzqECIVWk1f+B2FVhc X-Received: by 10.98.99.197 with SMTP id x188mr53191705pfb.179.1483364005654; Mon, 02 Jan 2017 05:33:25 -0800 (PST) Received: from localhost ([104.237.91.251]) by smtp.googlemail.com with ESMTPSA id d15sm132665724pfl.46.2017.01.02.05.33.23 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Mon, 02 Jan 2017 05:33:25 -0800 (PST) From: Hanjun Guo To: Marc Zyngier , "Rafael J. Wysocki" , Lorenzo Pieralisi Subject: [PATCH v6 06/14] irqchip: gicv3-its: platform-msi: refactor its_pmsi_init() to prepare for ACPI Date: Mon, 2 Jan 2017 21:31:37 +0800 Message-Id: <1483363905-2806-7-git-send-email-hanjun.guo@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1483363905-2806-1-git-send-email-hanjun.guo@linaro.org> References: <1483363905-2806-1-git-send-email-hanjun.guo@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170102_053348_904264_04738783 X-CRM114-Status: GOOD ( 11.86 ) 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: huxinwei@huawei.com, Kefeng Wang , charles.garcia-tobin@arm.com, Jon Masters , yimin@huawei.com, Greg KH , linux-kernel@vger.kernel.org, linuxarm@huawei.com, Sinan Kaya , linux-acpi@vger.kernel.org, Hanjun Guo , Tomasz Nowicki , Thomas Gleixner , Agustin Vega-Frias , linux-arm-kernel@lists.infradead.org, Ma Jun MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Introduce its_pmsi_init_one() to refactor the code to isolate ACPI&DT common code to prepare for ACPI later. Signed-off-by: Hanjun Guo Tested-by: Sinan Kaya Tested-by: Majun Tested-by: Xinwei Kong Cc: Marc Zyngier Cc: Tomasz Nowicki Cc: Thomas Gleixner --- drivers/irqchip/irq-gic-v3-its-platform-msi.c | 45 ++++++++++++++++----------- 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/drivers/irqchip/irq-gic-v3-its-platform-msi.c b/drivers/irqchip/irq-gic-v3-its-platform-msi.c index 16587a9..ff72704 100644 --- a/drivers/irqchip/irq-gic-v3-its-platform-msi.c +++ b/drivers/irqchip/irq-gic-v3-its-platform-msi.c @@ -84,34 +84,43 @@ static int its_pmsi_prepare(struct irq_domain *domain, struct device *dev, {}, }; -static int __init its_pmsi_init(void) +static int __init its_pmsi_init_one(struct fwnode_handle *fwnode, + const char *name) { - struct device_node *np; struct irq_domain *parent; + parent = irq_find_matching_fwnode(fwnode, DOMAIN_BUS_NEXUS); + if (!parent || !msi_get_domain_info(parent)) { + pr_err("%s: unable to locate ITS domain\n", name); + return -ENXIO; + } + + if (!platform_msi_create_irq_domain(fwnode, &its_pmsi_domain_info, + parent)) { + pr_err("%s: unable to create platform domain\n", name); + return -ENXIO; + } + + pr_info("Platform MSI: %s domain created\n", name); + return 0; +} + +static void __init its_pmsi_of_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); - continue; - } - - if (!platform_msi_create_irq_domain(of_node_to_fwnode(np), - &its_pmsi_domain_info, - parent)) { - pr_err("%s: unable to create platform domain\n", - np->full_name); - continue; - } - - pr_info("Platform MSI: %s domain created\n", np->full_name); + its_pmsi_init_one(of_node_to_fwnode(np), np->full_name); } +} +static int __init its_pmsi_init(void) +{ + its_pmsi_of_init(); return 0; } early_initcall(its_pmsi_init);