From patchwork Wed Jan 11 15:06:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanjun Guo X-Patchwork-Id: 9510513 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 1DAB1606E1 for ; Wed, 11 Jan 2017 15:55:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 03B0528447 for ; Wed, 11 Jan 2017 15:55:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E882B285D0; Wed, 11 Jan 2017 15:55:20 +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 A221F28447 for ; Wed, 11 Jan 2017 15:55:19 +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 1cRLF8-0002AR-Hl; Wed, 11 Jan 2017 15:55:18 +0000 Received: from merlin.infradead.org ([2001:4978:20e::2]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cRLF6-0002AF-En for linux-arm-kernel@bombadil.infradead.org; Wed, 11 Jan 2017 15:55:16 +0000 Received: from mail-pf0-x233.google.com ([2607:f8b0:400e:c00::233]) by merlin.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cRKVu-0006Yp-3j for linux-arm-kernel@lists.infradead.org; Wed, 11 Jan 2017 15:08:34 +0000 Received: by mail-pf0-x233.google.com with SMTP id y143so42201529pfb.0 for ; Wed, 11 Jan 2017 07:08:13 -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=lb8oVx8vxrV2sYPYP8ZFWB3py2NMuJTHiLsdRLSd81s=; b=Lf0iMBd4j0ouwxuvDlKTfIWl3MhiotTglOCQkOKusxinCDO+cLIEM6PklF2Y5cc1Tc ADxc4HNmg4uRjvKWsdI3VZ8biExVlVE6GnVJJ0KAN62GdFF/mRo2jt+ShrAPfukX8LOF X4BHoeL4NooZyGrjQh7PZVvFpog80wDVwCgw8= 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=lb8oVx8vxrV2sYPYP8ZFWB3py2NMuJTHiLsdRLSd81s=; b=L2P6XgFF+SvhXm1dRlLB40B0B+skzSmZee0KD1sMXm46guLvf3rx/YydftbZBhI1Yi 0zalrKR+UFG2LSKsoV72tnzYwvK48tX5PrzZRBl/Ytm9Dbla65rzYxqJSvXG4lAcotBI mSbobfJZYpnCwn02eeeMFY91+ZQMQSbsTZout8+H4abuPNC6f9YuH8Dy/X1PniAZZnQa uNIpjQ0JmqAkvgSiBzGsV1sOFXtLA3twbq2mGWGkM0cCS1ccOjcxrRBoWzazpbFJQemM x3tE43g+zaBvX/xDnqFa6gY3yywAmpACDLEVi2qLCBOQkWs32GvutdrPa5BTQpocs/j9 t+QQ== X-Gm-Message-State: AIkVDXI/hqOgHnQd46Hr4ptOyfnraqNS3p+XV4IUSZcndPjukU8d5YhthbjPYEuOlJR0IyQL X-Received: by 10.99.163.18 with SMTP id s18mr11275735pge.87.1484147292994; Wed, 11 Jan 2017 07:08:12 -0800 (PST) Received: from localhost ([104.237.91.103]) by smtp.googlemail.com with ESMTPSA id u82sm13794445pfd.7.2017.01.11.07.08.11 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Wed, 11 Jan 2017 07:08:12 -0800 (PST) From: Hanjun Guo To: Marc Zyngier , "Rafael J. Wysocki" , Lorenzo Pieralisi Subject: [PATCH v7 05/15] irqchip: gicv3-its: platform-msi: refactor its_pmsi_prepare() Date: Wed, 11 Jan 2017 23:06:29 +0800 Message-Id: <1484147199-4267-6-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_100834_244392_0B394F26 X-CRM114-Status: GOOD ( 14.44 ) 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 Adding ACPI support for platform MSI, we need to retrieve the dev id in ACPI way instead of device tree, we already have a well formed function its_pmsi_prepare() to get the dev id but it's OF dependent, so collect OF related code and put them into a single function to make its_pmsi_prepare() more friendly to ACPI later. Signed-off-by: Hanjun Guo Reviewed-by: Matthias Brugger Cc: Marc Zyngier Cc: Lorenzo Pieralisi Cc: Tomasz Nowicki Cc: Thomas Gleixner --- drivers/irqchip/irq-gic-v3-its-platform-msi.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/drivers/irqchip/irq-gic-v3-its-platform-msi.c b/drivers/irqchip/irq-gic-v3-its-platform-msi.c index 470b4aa..3c94278 100644 --- a/drivers/irqchip/irq-gic-v3-its-platform-msi.c +++ b/drivers/irqchip/irq-gic-v3-its-platform-msi.c @@ -24,15 +24,11 @@ .name = "ITS-pMSI", }; -static int its_pmsi_prepare(struct irq_domain *domain, struct device *dev, - int nvec, msi_alloc_info_t *info) +static int of_pmsi_get_dev_id(struct irq_domain *domain, struct device *dev, + u32 *dev_id) { - struct msi_domain_info *msi_info; - u32 dev_id; int ret, index = 0; - msi_info = msi_get_domain_info(domain->parent); - /* Suck the DeviceID out of the msi-parent property */ do { struct of_phandle_args args; @@ -43,11 +39,24 @@ static int its_pmsi_prepare(struct irq_domain *domain, struct device *dev, if (args.np == irq_domain_get_of_node(domain)) { if (WARN_ON(args.args_count != 1)) return -EINVAL; - dev_id = args.args[0]; + *dev_id = args.args[0]; break; } } while (!ret); + return ret; +} + +static int its_pmsi_prepare(struct irq_domain *domain, struct device *dev, + int nvec, msi_alloc_info_t *info) +{ + struct msi_domain_info *msi_info; + u32 dev_id; + int ret; + + msi_info = msi_get_domain_info(domain->parent); + + ret = of_pmsi_get_dev_id(domain, dev, &dev_id); if (ret) return ret;