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: 89496 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp7592586qgi; Mon, 2 Jan 2017 05:33:16 -0800 (PST) X-Received: by 10.99.158.18 with SMTP id s18mr107534754pgd.88.1483363996439; Mon, 02 Jan 2017 05:33:16 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t6si65761802pfa.280.2017.01.02.05.33.16; Mon, 02 Jan 2017 05:33:16 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-acpi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-acpi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-acpi-owner@vger.kernel.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933048AbdABNdN (ORCPT + 7 others); Mon, 2 Jan 2017 08:33:13 -0500 Received: from mail-pf0-f173.google.com ([209.85.192.173]:34616 "EHLO mail-pf0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933047AbdABNdL (ORCPT ); Mon, 2 Jan 2017 08:33:11 -0500 Received: by mail-pf0-f173.google.com with SMTP id c4so73071670pfb.1 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=HqqBQODyCNM5nFp3Pm9Jrg/rAOWmG/RyVKsVTu8sqlFYn2grSd0KP9xe0Ges12T9OE xt0dSPjsgHo3/bu1VAyrTRTxPTzWB4qYskgtmCU5cGfgGZLOf3cXsYGcqGZeHgGylWqQ 9xp6oG5taiqOYulA9Vpv5xTwBHpWqaZpm1lZ2d1tF4hWFa7ObIqUVZK0kdcyJmwwmQJL XKVjEs8gcXpGK2TqV2SUT388N54MyOxLloZr1Y/J3VpxSyn+SZg4TPl22D7J0dha6o+G Rtuv+KKeyg5pCiBstxUMOj+zkkujzV1OZuRk0ntQQZ69c6X8KFkIrkX0WQ8qu9l5ZufH yhkA== X-Gm-Message-State: AIkVDXKrSvNlLvXi+RotC8OmfwKap/sBA7K+GH8mgtHDGxhCPv92lET9Lo2w7uMyOQjzf+Kq 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 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 , charles.garcia-tobin@arm.com, huxinwei@huawei.com, yimin@huawei.com, Jon Masters , Hanjun Guo 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> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@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 Tested-by: Sinan Kaya Tested-by: Majun Tested-by: Xinwei Kong 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 -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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 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;