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: 9493633 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 41A2362AB4 for ; Mon, 2 Jan 2017 13:35:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3292B1FF35 for ; Mon, 2 Jan 2017 13:35:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 26ABD266F3; Mon, 2 Jan 2017 13:35:43 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C4F1D1FF35 for ; Mon, 2 Jan 2017 13:35:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933086AbdABNd2 (ORCPT ); Mon, 2 Jan 2017 08:33:28 -0500 Received: from mail-pf0-f170.google.com ([209.85.192.170]:36207 "EHLO mail-pf0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933084AbdABNd0 (ORCPT ); Mon, 2 Jan 2017 08:33:26 -0500 Received: by mail-pf0-f170.google.com with SMTP id 189so73235380pfz.3 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=Z/G/BrIxorjj7fDWkytyMh0ImYEj7HVdKrt24ShFzDHPZ8GiJS5fIJ39Hj9NxxuDkv vmJ1VQ8PzdiX4YVftzyym2OsP/0S470kyCHPSJaVwTzmwgT+W1BRTmRNsH6fISCdpq7V sfuS0fCLcZFWCTU3tdMMNeQVW4jfUnuCshjPmP2QTcyBxm9jGJVwHYHY4AmvO9kt0VeF z0YX7it2cfkKk3iYQnkv19e3f1N61Nn8KaZzTuE3b4cI5G0ijburrP+VTwBDetoGP69d 8SIPP90toS1qrp1VGAi4Fbu03TG3EY8McIPA80aqr5y4yyV+l6G2VMXwcqNWEYyS7m8C lntQ== X-Gm-Message-State: AIkVDXI1CNk6dgjcNH1wNZPlxdO0XEdETfHo/AcRI8dBqkzI23IrCEu4wFReMXW6q+HpkQs0 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 Cc: linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linuxarm@huawei.com, Thomas Gleixner , Greg KH , Tomasz Nowicki , Ma Jun , Kefeng Wang , Agustin Vega-Frias , Sinan Kaya , charles.garcia-tobin@arm.com, huxinwei@huawei.com, yimin@huawei.com, Jon Masters , Hanjun Guo 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> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.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);