From patchwork Thu Jul 27 15:10:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suzuki K Poulose X-Patchwork-Id: 9867105 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 4981B60382 for ; Thu, 27 Jul 2017 15:12:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3AB7C28735 for ; Thu, 27 Jul 2017 15:12:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2F22328766; Thu, 27 Jul 2017 15:12:16 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A9DFB28735 for ; Thu, 27 Jul 2017 15:12:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=fBtYJGfLHOQsJ1QoN0skpNojB4eSSUmOWCsJ8WkS5Ng=; b=Atq3ikP4UAI9Qn31aZaqqkH9Do HO4GFN9ea/m50ydGL7/1saDD8JFX9PbSO91AIbFPNLITqnQH2MQ9m5FkjsCfTV/RHMowWlIDNR/8N HAnFcb0d/7W2Tp7ATvf3lMSL7HFxAx9g8tMLgDPI9mHlj9r5IvgWk/vImk5RSYrKPZ24WJ1RnaxWI o6LMVhUHWiyIffDO6xJ6c8f929xwujZ+jiCjPYweZ1S+DWOIEbtmAQtK8UjzG5VD2k8UedE/ZopOp PEBtmRt7T7NoZxdpcxSmtrO5UIFRz8hi/8pYWo2CgP7OyUaqs2XjgishCoX6A6goEnkLQUm+zGUv6 zEMK87iw==; 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 1dakSS-0001UY-28; Thu, 27 Jul 2017 15:12:12 +0000 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70] helo=foss.arm.com) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dakRR-0000d6-Nm for linux-arm-kernel@lists.infradead.org; Thu, 27 Jul 2017 15:11:13 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C51AC1610; Thu, 27 Jul 2017 08:10:51 -0700 (PDT) Received: from e107814-lin.cambridge.arm.com (e107814-lin.cambridge.arm.com [10.1.206.28]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 4B7A63F577; Thu, 27 Jul 2017 08:10:50 -0700 (PDT) From: Suzuki K Poulose To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v3 4/6] irqchip: gic-v3: Use of_device_node_get_cpu helper Date: Thu, 27 Jul 2017 16:10:16 +0100 Message-Id: <1501168218-26741-5-git-send-email-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.7.5 In-Reply-To: <1501168218-26741-1-git-send-email-suzuki.poulose@arm.com> References: <1501168218-26741-1-git-send-email-suzuki.poulose@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170727_081110_095581_64043FDC X-CRM114-Status: GOOD ( 10.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: mark.rutland@arm.com, mathieu.poirier@linaro.org, Suzuki K Poulose , marc.zyngier@arm.com, Jonathan.Cameron@huawei.com, will.deacon@arm.com, linux-kernel@vger.kernel.org, sudeep.holla@arm.com 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 Use the new generic helper of_device_node_get_cpu() instead of using our own version to map a device node to logical CPU number. Acked-by: Marc Zyngier Signed-off-by: Suzuki K Poulose --- drivers/irqchip/irq-gic-v3.c | 30 +++--------------------------- 1 file changed, 3 insertions(+), 27 deletions(-) diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c index dbffb7a..b7ce12b 100644 --- a/drivers/irqchip/irq-gic-v3.c +++ b/drivers/irqchip/irq-gic-v3.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -978,31 +979,6 @@ static int __init gic_validate_dist_version(void __iomem *dist_base) return 0; } -static int get_cpu_number(struct device_node *dn) -{ - const __be32 *cell; - u64 hwid; - int i; - - cell = of_get_property(dn, "reg", NULL); - if (!cell) - return -1; - - hwid = of_read_number(cell, of_n_addr_cells(dn)); - - /* - * Non affinity bits must be set to 0 in the DT - */ - if (hwid & ~MPIDR_HWID_BITMASK) - return -1; - - for (i = 0; i < num_possible_cpus(); i++) - if (cpu_logical_map(i) == hwid) - return i; - - return -1; -} - /* Create all possible partitions at boot time */ static void __init gic_populate_ppi_partitions(struct device_node *gic_node) { @@ -1053,8 +1029,8 @@ static void __init gic_populate_ppi_partitions(struct device_node *gic_node) if (WARN_ON(!cpu_node)) continue; - cpu = get_cpu_number(cpu_node); - if (WARN_ON(cpu == -1)) + cpu = of_device_node_get_cpu(cpu_node); + if (WARN_ON(cpu >= nr_cpu_ids)) continue; pr_cont("%s[%d] ", cpu_node->full_name, cpu);