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: 9510519 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 A0C3B606E1 for ; Wed, 11 Jan 2017 15:56:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8462828447 for ; Wed, 11 Jan 2017 15:56:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 78F44285D6; Wed, 11 Jan 2017 15:56:02 +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 AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1DCE728447 for ; Wed, 11 Jan 2017 15:55:52 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cRLFf-000350-4D; Wed, 11 Jan 2017 15:55:51 +0000 Received: from merlin.infradead.org ([2001:4978:20e::2]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cRLF9-0002AF-Qq for linux-arm-kernel@bombadil.infradead.org; Wed, 11 Jan 2017 15:55:19 +0000 Received: from mail-pg0-x234.google.com ([2607:f8b0:400e:c05::234]) by merlin.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cRKW0-0006Z8-Jb for linux-arm-kernel@lists.infradead.org; Wed, 11 Jan 2017 15:08:41 +0000 Received: by mail-pg0-x234.google.com with SMTP id f188so282340759pgc.3 for ; Wed, 11 Jan 2017 07:08:20 -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=J3TomCUgKr4hg66mFbcj/rOLcKjt30eulmdWMBtDqBKFISbMvh+HcFKHH/6eARl5S4 8uGpho+7XuTmsHfn2Rbf9e0PNMsQ4dmulUrszmVpvKIdtEGzPEuZ2iI7Osu9v3MSv/tX PBRBOVK59LVPnfaWiQslvSP6pBNVIb5sg5LgfvfEeQhZQBtxD3wNfJrfABUUPwzET+sF yMSdhkd151St7Ht5oaZ6Cw5P4yTFTE68hwPTNRdnD35Px/fYOfvM8EbPSZcdCmbTHqCl LsILvFxq+KJehVZ3qWkNl2epkKdPTwA4vMpyGry9kfJdGx6RqiEB8LHQiPhQwvORz0bg 59tw== X-Gm-Message-State: AIkVDXIzsTk4azKxOSXbEtaNTrtHseu6x4svdF7+fPggA24BPfiNcFwjLxK+YEG+L3IH24mt 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170111_100840_748733_2463C951 X-CRM114-Status: GOOD ( 14.41 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: huxinwei@huawei.com, Kefeng Wang , Matthias Brugger , Jon Masters , yimin@huawei.com, Greg KH , linux-kernel@vger.kernel.org, linuxarm@huawei.com, Sinan Kaya , linux-acpi@vger.kernel.org, Xinwei Kong , 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 Cc: Marc Zyngier Cc: Tomasz Nowicki Cc: Thomas Gleixner Reviewed-by: Matthias Brugger --- 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 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);