From patchwork Mon Aug 21 17:55:06 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: 9913435 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 988CA600C8 for ; Mon, 21 Aug 2017 17:57:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8DE4128614 for ; Mon, 21 Aug 2017 17:57:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 80EA7286EF; Mon, 21 Aug 2017 17:57:45 +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=-2.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW 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 0D4CA28614 for ; Mon, 21 Aug 2017 17:57:45 +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=X7wDf7H3r3tU/aVRUU6vgXzobscAO1ncpzlNYJnKW+s=; b=EjQoO6YR8VXG142TiEexP0dnAN t3koKSTVVmVRSwF+rolKunkopCny2E0waxavyUVpXzFH20Kb6RuCj5dHuCW5cxJb4oDZgwzcgKi+w oSAQmttkCTZqI1zO3lw2k7ebfJ82UAi1pNdKQ6svjtYIggtQ8RZ64S75i0t7hgI0o6sfMbUViggi+ 2BotCkmilW8hkXJipE5khsn71BhcYMpNLxU58yShsvZ9mct3j8d/7pociREcjFYpSjxmbJjJiNa0g yUnqq/N55M/7YLEJyWrDRcKxvdyifekhFFPUJ93k1VPKSlsp6rIMmHb3/k5uVGQS4kP9nyzeACi7g tY48VuoA==; 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 1djqxJ-0002Ri-Ac; Mon, 21 Aug 2017 17:57:41 +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 1djqwB-0001fl-7E for linux-arm-kernel@lists.infradead.org; Mon, 21 Aug 2017 17:56:38 +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 992031610; Mon, 21 Aug 2017 10:56:12 -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 62DB23F540; Mon, 21 Aug 2017 10:56:10 -0700 (PDT) From: Suzuki K Poulose To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v6 3/6] coresight: of: Use of_cpu_node_to_id helper Date: Mon, 21 Aug 2017 18:55:06 +0100 Message-Id: <1503338109-32540-4-git-send-email-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.7.5 In-Reply-To: <1503338109-32540-1-git-send-email-suzuki.poulose@arm.com> References: <1503338109-32540-1-git-send-email-suzuki.poulose@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170821_105631_645785_6714D408 X-CRM114-Status: UNSURE ( 8.42 ) X-CRM114-Notice: Please train this message. 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, robh@kernel.org, mathieu.poirier@linaro.org, devicetree@vger.kernel.org, marc.zyngier@arm.com, Suzuki K Poulose , will.deacon@arm.com, linux-kernel@vger.kernel.org, peterz@infradead.org, Jonathan.Cameron@huawei.com, frowand.list@gmail.com, Leo Yan 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 Reuse the new generic helper, of_cpu_node_to_id() to map a given CPU phandle to a logical CPU number. Cc: Leo Yan Acked-by: Mathieu Poirier Signed-off-by: Suzuki K Poulose --- Changes since V4: - Fix a regression introduced in v4, reported by bugrobot Changes since V3: - Reflect the renaming of the helper and return value changes --- drivers/hwtracing/coresight/of_coresight.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/drivers/hwtracing/coresight/of_coresight.c b/drivers/hwtracing/coresight/of_coresight.c index a187941..7c37544 100644 --- a/drivers/hwtracing/coresight/of_coresight.c +++ b/drivers/hwtracing/coresight/of_coresight.c @@ -104,26 +104,17 @@ static int of_coresight_alloc_memory(struct device *dev, int of_coresight_get_cpu(const struct device_node *node) { int cpu; - bool found; - struct device_node *dn, *np; + struct device_node *dn; dn = of_parse_phandle(node, "cpu", 0); - /* Affinity defaults to CPU0 */ if (!dn) return 0; - - for_each_possible_cpu(cpu) { - np = of_cpu_device_node_get(cpu); - found = (dn == np); - of_node_put(np); - if (found) - break; - } + cpu = of_cpu_node_to_id(dn); of_node_put(dn); /* Affinity to CPU0 if no cpu nodes are found */ - return found ? cpu : 0; + return (cpu < 0) ? 0 : cpu; } EXPORT_SYMBOL_GPL(of_coresight_get_cpu);