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: 89498 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp7592723qgi; Mon, 2 Jan 2017 05:33:43 -0800 (PST) X-Received: by 10.84.232.197 with SMTP id x5mr91208099plm.102.1483364023514; Mon, 02 Jan 2017 05:33:43 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d85si65764390pfb.163.2017.01.02.05.33.43; Mon, 02 Jan 2017 05:33:43 -0800 (PST) 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; dkim=pass header.i=@linaro.org; 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; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933100AbdABNd3 (ORCPT + 25 others); Mon, 2 Jan 2017 08:33:29 -0500 Received: from mail-pf0-f169.google.com ([209.85.192.169]:34622 "EHLO mail-pf0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933059AbdABNd0 (ORCPT ); Mon, 2 Jan 2017 08:33:26 -0500 Received: by mail-pf0-f169.google.com with SMTP id c4so73072085pfb.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=CYSX9jfvB+YQnVH/cNCwusy0QBymytXEDvWnoPdiknveLxvwI1u3tZM8DmkQiMBlug AFUshvIAiA4RlshCP/1xRPd3qWSxhNpCQYR6gvzSTmtFJoOVBsiEGg9l8vklFHzmV9GM 7IbAbRv5R7tIePLdnJiXhxCN/h25ng9j9WBWnec/A5WW08FIG7GzlV9ieGH9UMLoGEgN Zfbe8REQYxKIwRsF2MHeH7CKEyDkUpYhjMea0TRJm+FpYn9PmF+49bJ+3b/P5TSw/F37 8S/NeaiLUacqRXbqCQY2boxK/64hzn1zd4U8petF7jKyQI+6sIQRPgFZ7s9VdwpYEg6t WJqQ== X-Gm-Message-State: AIkVDXKiTdOf+ETEFzVZFqHKFVpOOImsvCTtfvdOeE3ZWbBBiefNoaOfckL9TXz7vLpRYVVj 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) -- 1.9.1 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);