From patchwork Mon Aug 7 14:20:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Clark X-Patchwork-Id: 132177 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp1530148vqr; Mon, 7 Aug 2023 08:32:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGpghXKzWVPBnu+kQtEff/qoMiVtLc+2HCWzmZyoW8aQXOlSINboHZK88XeRcYp80M9TiXY X-Received: by 2002:a2e:87d9:0:b0:2b9:54e1:6711 with SMTP id v25-20020a2e87d9000000b002b954e16711mr6254561ljj.7.1691422339866; Mon, 07 Aug 2023 08:32:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691422339; cv=none; d=google.com; s=arc-20160816; b=MrIO6sw2z4N06SXYFgAbNW6ZcjmwzMjTbL717oS9SRtE3/PGMQ+8oyTQ7r1isLheSe vLzVKy6ASYPArE4AlsmYiZJDV7Xf3gdmJ6KQ1P7Ptvfm3JpPL09AXmn0o3AVi7Gv1UDI ZYrwL0b1x1quUgb6hrLuucNwyDe5H2QJKYPvOQwLQaPz0QHPVDIJzYK/tl8Mwt+Co6f4 78W53dgP2AM3+g/Dkytq1YMkVPNVeKmEg4WBN7j9WZPZ179+pT5H4zHUjOGxQSCzP+7w Pnst1oCTywid4Z/dmMymRBnWgWF8L8jXe2XJgBOC4SurUmX2u9S47MCmQRjlparAKfUZ 6hkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=WiEpmCUruzViw8kEX55FHMjCFqBIIoNsdRnD2qkZfdo=; fh=oDU8Pc4+R2wj11rKo7aEM+pOPsjB1pNjm32VOscFVcA=; b=x2asfV7gloCYXLQOhVgk3DnPKZSZ4AQaH0gVwZ4MCdcR5O7bkx6bDW2nvQ0KyX+Xwz zagO3KwtDVbryLqMj88AX62z00G6UlUWUyRS2GiocFjtKJLOoBA0F4HfG2k9WPIPziQm jA9Lad+nOQi037LqPRxc76IGPrCnB7uAiAwMZ6VAYvk9Fa1Tnbr46zwso1uwbYl7lxrn Np2VGskc4AH+ZqVS66Ycmn9oQHgHA9SRAaOUdq3wQSEEzFQO8DK6pmyh9uY0R0yH8NSP BGymZ/6gpdiAmq+LU68we7uxdhdGB3g1iSQJtMb2W3tTaUp3gXDruDwKezBgvWNaHC4Q tP1g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d2-20020a170906344200b00993ebae9927si5830627ejb.784.2023.08.07.08.31.55; Mon, 07 Aug 2023 08:32:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232156AbjHGOXD (ORCPT + 99 others); Mon, 7 Aug 2023 10:23:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233518AbjHGOWx (ORCPT ); Mon, 7 Aug 2023 10:22:53 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D2E09C2; Mon, 7 Aug 2023 07:22:52 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7B6E71FB; Mon, 7 Aug 2023 07:23:35 -0700 (PDT) Received: from localhost.localdomain (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 711BD3F64C; Mon, 7 Aug 2023 07:22:49 -0700 (PDT) From: James Clark To: linux-perf-users@vger.kernel.org, irogers@google.com, john.g.garry@oracle.com, renyu.zj@linux.alibaba.com Cc: James Clark , Will Deacon , Mike Leach , Leo Yan , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Adrian Hunter , Suzuki K Poulose , Kan Liang , Kajol Jain , Nick Forrington , Eduard Zingerman , Rob Herring , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org Subject: [PATCH v4 1/6] perf: cs-etm: Don't duplicate FIELD_GET() Date: Mon, 7 Aug 2023 15:20:45 +0100 Message-Id: <20230807142138.288713-2-james.clark@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230807142138.288713-1-james.clark@arm.com> References: <20230807142138.288713-1-james.clark@arm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773584871367063763 X-GMAIL-MSGID: 1773584871367063763 linux/bitfield.h can be included as long as linux/kernel.h is included first, so change the order of the includes and drop the duplicate macro. Signed-off-by: James Clark Reviewed-by: John Garry --- tools/perf/util/cs-etm.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c index 1419b40dfbe8..9729d006550d 100644 --- a/tools/perf/util/cs-etm.c +++ b/tools/perf/util/cs-etm.c @@ -6,10 +6,11 @@ * Author: Mathieu Poirier */ +#include +#include #include #include #include -#include #include #include #include @@ -281,17 +282,6 @@ static int cs_etm__metadata_set_trace_id(u8 trace_chan_id, u64 *cpu_metadata) return 0; } -/* - * FIELD_GET (linux/bitfield.h) not available outside kernel code, - * and the header contains too many dependencies to just copy over, - * so roll our own based on the original - */ -#define __bf_shf(x) (__builtin_ffsll(x) - 1) -#define FIELD_GET(_mask, _reg) \ - ({ \ - (typeof(_mask))(((_reg) & (_mask)) >> __bf_shf(_mask)); \ - }) - /* * Get a metadata for a specific cpu from an array. *