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: 90905 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1166101qgi; Wed, 11 Jan 2017 07:08:24 -0800 (PST) X-Received: by 10.84.205.69 with SMTP id o5mr13754771plh.70.1484147304203; Wed, 11 Jan 2017 07:08:24 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h24si6057826pfk.166.2017.01.11.07.08.23; Wed, 11 Jan 2017 07:08:24 -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 S1764487AbdAKPIQ (ORCPT + 25 others); Wed, 11 Jan 2017 10:08:16 -0500 Received: from mail-pf0-f180.google.com ([209.85.192.180]:36260 "EHLO mail-pf0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1764451AbdAKPIN (ORCPT ); Wed, 11 Jan 2017 10:08:13 -0500 Received: by mail-pf0-f180.google.com with SMTP id 189so50727266pfu.3 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=mYjUFcu7r1/YcP06xi9+1iP+Dt+n6nN42jEIEBl4WY8ByDWabssd0ujSIjlpVwkkdv wtf6Xn9ar5Gc8uv2ciCgL2ORHw70Z9EYEqDxzzqSNlOmn5oVv+OGZT0SJ+AtIYexORku G5G332IPy4EHcNgV0EyNBJsItzmrTleHNkg131bJ4ChzOH84Od5eAM81kqPaFsZfW5nu vFkbEjE4PQHkqsRhfho+TjUW/OnPrNF8Zm/lcTpSfXwAgZ/ZiC1UnHd3VP7DaXJ9Fabr 24p4qmqYmAHebdAuWVT74w1otrXosSmnJbORR+AsLB+Cx21BIzQ7lradUl8En/L96uo4 tjdg== X-Gm-Message-State: AIkVDXJF8GH2p/j1p8csjee48bpclf59msOqkxPvTWDaASBETttUcs/S6YDg5GVfaTzyz1To 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 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 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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) -- 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 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;