From patchwork Wed Jan 11 15:06:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanjun Guo X-Patchwork-Id: 90907 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1166301qgi; Wed, 11 Jan 2017 07:08:43 -0800 (PST) X-Received: by 10.99.106.200 with SMTP id f191mr11255295pgc.143.1484147323614; Wed, 11 Jan 2017 07:08:43 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a184si6049863pgc.229.2017.01.11.07.08.43; Wed, 11 Jan 2017 07:08: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 sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1764532AbdAKPIY (ORCPT + 25 others); Wed, 11 Jan 2017 10:08:24 -0500 Received: from mail-pg0-f46.google.com ([74.125.83.46]:36611 "EHLO mail-pg0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1764474AbdAKPIU (ORCPT ); Wed, 11 Jan 2017 10:08:20 -0500 Received: by mail-pg0-f46.google.com with SMTP id f188so282340760pgc.3 for ; Wed, 11 Jan 2017 07:08:19 -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=3N6UPeWUHJ7ZdrCCp6WIUXFpqw14c6nRdqXjEjChJwA=; b=UVxNG5cvxQE5LPIHH/oOw9z29AjhXkDotT1pg/cdhS217Tn9fHTkLln8HJm+67ESG5 UC8XyDEB1hbDlgwDovIjU5OHZBxb8ZCJ7L9T4LPLV7iMG8ZcecALizBTRdrjB78a+Ar3 YH8iu5ABWg1JxBsNjXBkaSl+v7ae4KpKfUrh0= 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=3N6UPeWUHJ7ZdrCCp6WIUXFpqw14c6nRdqXjEjChJwA=; b=oSjXFB71BmNKzCnSvJTgp+kOdtxBXvRa1DmQhB+IcdvWVorNuHosdHGbcLb1zep/zw dnXF/ilpbPK9+uP16LeKmXRC5DIyMyrGrixSuA4jSZbR2d5L1qlIKesp2iuJoSV9DHDA 8DtxE/j3LuO3vx4ZSRipgKjkvArCunMeovmX0E/+1rqXuFIweG2ymHnJzZ0/ESW2eqPq VQiSMrGmpPP1mrZqKch8IT91LWnp3sdOBeeMXbl891GXzVfMHbCjFDt3Q4fmbH00RWT1 GxQUGvfTxEWUwuuWdVCiksfln/0nsUobzyvXSXl1hCItnUKzkpyFt/3kIS7MkFLRXckF 61HA== X-Gm-Message-State: AIkVDXJbmmOZ93O+m/htPzqrgJNbtE6lU2jsqK/C0BIgBu00dQ5T3oMsGxN2gLMMzFW0Eucg X-Received: by 10.84.194.37 with SMTP id g34mr13912458pld.105.1484147299508; Wed, 11 Jan 2017 07:08:19 -0800 (PST) Received: from localhost ([104.237.91.103]) by smtp.googlemail.com with ESMTPSA id s136sm14696868pgc.38.2017.01.11.07.08.17 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Wed, 11 Jan 2017 07:08:19 -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 , huxinwei@huawei.com, yimin@huawei.com, Jon Masters , Matthias Brugger , Xinwei Kong , Hanjun Guo Subject: [PATCH v7 06/15] irqchip: gicv3-its: platform-msi: refactor its_pmsi_init() to prepare for ACPI Date: Wed, 11 Jan 2017 23:06:30 +0800 Message-Id: <1484147199-4267-7-git-send-email-hanjun.guo@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1484147199-4267-1-git-send-email-hanjun.guo@linaro.org> References: <1484147199-4267-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 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 Reviewed-by: Matthias Brugger diff --git a/drivers/irqchip/irq-gic-v3-its-platform-msi.c b/drivers/irqchip/irq-gic-v3-its-platform-msi.c index 3c94278..3d9efd1 100644 --- a/drivers/irqchip/irq-gic-v3-its-platform-msi.c +++ b/drivers/irqchip/irq-gic-v3-its-platform-msi.c @@ -82,34 +82,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);