From patchwork Sat Oct 7 02:13:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13412155 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E8125E784AF for ; Sat, 7 Oct 2023 02:14:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:From:Subject:References:Mime-Version :Message-Id:In-Reply-To:Date:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=8Jvf3RDZVK5s2hKdkvacszBn1WRJoqT6bo6YktAFoS4=; b=EF01/bYPrPrS4M MCb53mfuxhGila5jb3EGKmVZA9kg5ERX8YruXcI3uJBfAPu1KWIaESfOOYmKULa+mE0oUq7eMRRW3 L4QP6X45stFIqOAPiq+xDo7D1WXOsdIZ0mZu77TsZMVXCiA/SdOPfqdTPMNKlfXQcPU6wlETcvbgo a2e+n7w9OioTpQIDmw4dAmSUme2tNoPq1BU4X4ptS41CEaTNqnMXhHiNHrT9ioSIFoUiLBgoBwIWZ ebBVu8bky4lbGIvML2Zf0Z7HKIDhxc5ApHhNsmUgwSw0ELAi1jIopKbutSZUaeoB0TOnOYtYiZRDP p1KUpQhIrkyHaP1cJtyA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qowpP-006nfM-04; Sat, 07 Oct 2023 02:14:03 +0000 Received: from mail-yb1-xb4a.google.com ([2607:f8b0:4864:20::b4a]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qowpM-006ndT-06 for linux-arm-kernel@lists.infradead.org; Sat, 07 Oct 2023 02:14:01 +0000 Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-d918aef0d0dso3888527276.3 for ; Fri, 06 Oct 2023 19:13:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1696644839; x=1697249639; darn=lists.infradead.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=FLkv57fF17zqRfpQp8SmIixiH1bpbCUPMZ8JZj8EM2M=; b=RtGEKDiU5Pzqb67DOWbv4xQ/JsvAjeZARD76dIkP4+UwN57hWd0O9IC7mEIDDrOy9w kOUAe5BHYO+8AATbpmtc1pLuIp5kj9T5TXF+xmpSKzvI7HZ1rpCjKE/+YYbEsS2X0106 3D0UrHQGUpW47betS+MpMO5jv3xSepJPPjuPxZBSUIprEXoAH4xLTXA+OF7K3CIjvWa1 ge70dOk4CpF/ana9uGldLTEi89g9lZ3eXt4imVrRd60iTxbrXyzF0wnx4J0wIKd9LRKO KizDN11J9ls9Rt5bbofdwIVcZy2GNzUK9sm/JzO5OdhtwKlldRBXzgsuBbQkn7+uAaMV aTXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696644839; x=1697249639; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=FLkv57fF17zqRfpQp8SmIixiH1bpbCUPMZ8JZj8EM2M=; b=aEQ0P/7T1D+5Tf8bNcN/P1EIJR+U470L12bvEkyEBiqlJzNLPNqPd/cF0511+/N/4S wuQtLyAT1IjK1bsh4KHrvvXs6WNmEZju99jpeUvYO5LJ7x+MJG5U8+m4vrIkrQih9hWu vPtbjG70HB6vqPubFjOQ3PsFtA0Uqd/m4yYCX6Av1HxA8P1yOwidk5WL+FhzXXUE8T3J 71fWSg4l/U05OFFRDaASQ1C01+7utScU01VbPog7wiL+lc4wUypI/6sREKvDNBONyEks 03mz4uvw9NBi9DRt4d+XwMJd6HuPhfImlVVxU+TEeuY+hnlFeKVmX30CAZmfJSUDFiwC TOQA== X-Gm-Message-State: AOJu0YxNs7qDaR/LNSLsrk9PXT0uevVoOAu/9MZM1Z5H7Yl6KXTEI5pn qBF4RuV4x6SVN7fA/QR427QDfvzhUd2w X-Google-Smtp-Source: AGHT+IFr63rp55RKJkbeuU4YrN+J9/EmAeZNALLBr+pqjB3TOHVhYPLvtNbiiLUo+VeXGDG6Gu0mRui9MaHH X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:7031:b36b:6c77:bfd0]) (user=irogers job=sendgmr) by 2002:a05:6902:990:b0:d89:4382:6d14 with SMTP id bv16-20020a056902099000b00d8943826d14mr156266ybb.6.1696644838851; Fri, 06 Oct 2023 19:13:58 -0700 (PDT) Date: Fri, 6 Oct 2023 19:13:24 -0700 In-Reply-To: <20231007021326.4156714-1-irogers@google.com> Message-Id: <20231007021326.4156714-6-irogers@google.com> Mime-Version: 1.0 References: <20231007021326.4156714-1-irogers@google.com> X-Mailer: git-send-email 2.42.0.609.gbb76f46606-goog Subject: [PATCH v1 5/7] perf pmu: Const-ify perf_pmu__config_terms From: Ian Rogers To: Suzuki K Poulose , Mike Leach , James Clark , Leo Yan , John Garry , Will Deacon , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , Thomas Richter , Ravi Bangoria , Kajol Jain , Jing Zhang , Kan Liang , Yang Jihong , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231006_191400_075872_3DB97620 X-CRM114-Status: GOOD ( 14.85 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add const to related APIs, this is so they can be used to default initialize a perf_event_attr from a const pmu. Signed-off-by: Ian Rogers Reviewed-by: Adrian Hunter --- tools/perf/util/pmu.c | 10 +++++----- tools/perf/util/pmu.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c index e11901c923d7..eb17f00bd0d2 100644 --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c @@ -156,7 +156,7 @@ static void __perf_pmu_format__load(struct perf_pmu_format *format, FILE *file) format->loaded = true; } -static void perf_pmu_format__load(struct perf_pmu *pmu, struct perf_pmu_format *format) +static void perf_pmu_format__load(const struct perf_pmu *pmu, struct perf_pmu_format *format) { char path[PATH_MAX]; FILE *file = NULL; @@ -1132,7 +1132,7 @@ void evsel__set_config_if_unset(struct perf_pmu *pmu, struct evsel *evsel, } static struct perf_pmu_format * -pmu_find_format(struct list_head *formats, const char *name) +pmu_find_format(const struct list_head *formats, const char *name) { struct perf_pmu_format *format; @@ -1230,7 +1230,7 @@ static int pmu_resolve_param_term(struct parse_events_term *term, return -1; } -static char *pmu_formats_string(struct list_head *formats) +static char *pmu_formats_string(const struct list_head *formats) { struct perf_pmu_format *format; char *str = NULL; @@ -1256,7 +1256,7 @@ static char *pmu_formats_string(struct list_head *formats) * Setup one of config[12] attr members based on the * user input data - term parameter. */ -static int pmu_config_term(struct perf_pmu *pmu, +static int pmu_config_term(const struct perf_pmu *pmu, struct perf_event_attr *attr, struct parse_events_term *term, struct parse_events_terms *head_terms, @@ -1379,7 +1379,7 @@ static int pmu_config_term(struct perf_pmu *pmu, return 0; } -int perf_pmu__config_terms(struct perf_pmu *pmu, +int perf_pmu__config_terms(const struct perf_pmu *pmu, struct perf_event_attr *attr, struct parse_events_terms *terms, bool zero, struct parse_events_error *err) diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h index 24af7297b522..5a05131aa4ce 100644 --- a/tools/perf/util/pmu.h +++ b/tools/perf/util/pmu.h @@ -193,7 +193,7 @@ void pmu_add_sys_aliases(struct perf_pmu *pmu); int perf_pmu__config(struct perf_pmu *pmu, struct perf_event_attr *attr, struct parse_events_terms *head_terms, struct parse_events_error *error); -int perf_pmu__config_terms(struct perf_pmu *pmu, +int perf_pmu__config_terms(const struct perf_pmu *pmu, struct perf_event_attr *attr, struct parse_events_terms *terms, bool zero, struct parse_events_error *error);