From patchwork Mon Jan 2 13:31:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanjun Guo X-Patchwork-Id: 9493621 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 EDE9C62AB4 for ; Mon, 2 Jan 2017 13:35:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DEEB52015F for ; Mon, 2 Jan 2017 13:35:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D37B7266F3; Mon, 2 Jan 2017 13:35:08 +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 AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 81D972015F for ; Mon, 2 Jan 2017 13:35:08 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1cO2k7-0005cv-TX; Mon, 02 Jan 2017 13:33:39 +0000 Received: from mail-pf0-x22e.google.com ([2607:f8b0:400e:c00::22e]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1cO2k0-0005St-AI for linux-arm-kernel@lists.infradead.org; Mon, 02 Jan 2017 13:33:34 +0000 Received: by mail-pf0-x22e.google.com with SMTP id i88so72926881pfk.2 for ; Mon, 02 Jan 2017 05:33:11 -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=BKBxUX8WvrGg9LhQCFYtPZqgnoYPoho7Cy4hpMlZuKU=; b=jRPGFi40OdCEgAUv2OrBeTgDIMTuG1DSO8cmQoEgyry969I/J2uKX7Tf1YPNdg4oYX +p0HYiqnnHhBrW8937K56kqwQ5utp0ahUy4ivnldbQA431E0db6yBbjBGp8H6dF1Q69M 1xILkjS7m23T1Ohjqz1/LcliyuQLjQR4va3qM= 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=BKBxUX8WvrGg9LhQCFYtPZqgnoYPoho7Cy4hpMlZuKU=; b=eI/kABGI5tfUJv6jy/ML7GAvve3qKN7IVTC9E1Y+s1MkAaJg2I0a8agA3UxnoQbnxM 0/v2HH2/DeadqS3LDt0ZqbObT4SOE9kQG1CnB2z1/bsEfB6b96fdFSLmy1lrSVQXJWgH 7R5ebZHKmyQ9LYHvF/C56/F1T192eW0upSKdjRtsJeCEKaeuyEzuYXAH00qZcIqUs8K0 tExngaUGa7DpB//VXKs/g1muZlM+fv+jJFdIND5AC4J+qCNO6dGHht+ycMjQJI6c6+IQ g3DnY774CDB3XV4xBwn5x/lwoQCrNee2GuvGiK5od/ZRKioGY0p0MQqC8QFmct00sN4m BA+g== X-Gm-Message-State: AIkVDXLw5/NsYcpRa+3Op+V34Hdf554++E8WAVruB9LHe9GoKm1il3NX1PQYAcrApUtaESgf X-Received: by 10.99.115.76 with SMTP id d12mr105335925pgn.56.1483363991203; Mon, 02 Jan 2017 05:33:11 -0800 (PST) Received: from localhost ([104.237.91.251]) by smtp.googlemail.com with ESMTPSA id b71sm132571173pfj.62.2017.01.02.05.33.09 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Mon, 02 Jan 2017 05:33:10 -0800 (PST) From: Hanjun Guo To: Marc Zyngier , "Rafael J. Wysocki" , Lorenzo Pieralisi Subject: [PATCH v6 04/14] irqchip: gicv3-its: platform-msi: refactor its_pmsi_prepare() Date: Mon, 2 Jan 2017 21:31:35 +0800 Message-Id: <1483363905-2806-5-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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170102_053332_436227_A79B10BD X-CRM114-Status: GOOD ( 12.80 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: huxinwei@huawei.com, Kefeng Wang , charles.garcia-tobin@arm.com, Jon Masters , yimin@huawei.com, Greg KH , linux-kernel@vger.kernel.org, linuxarm@huawei.com, Sinan Kaya , linux-acpi@vger.kernel.org, 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 Tested-by: Sinan Kaya Tested-by: Majun Tested-by: Xinwei Kong Cc: Marc Zyngier Cc: Lorenzo Pieralisi Cc: Tomasz Nowicki Cc: Thomas Gleixner Reviewed-by: Matthias Brugger --- 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;