Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp1073507pxy; Thu, 22 Apr 2021 22:38:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwU9P7FamzYNUI0xjuCb3HODxpRKSKUra0E5ncrstEGlpWlBu209BEfHBtN0aH2nFHMKb9r X-Received: by 2002:aa7:d9cf:: with SMTP id v15mr2355596eds.358.1619156297536; Thu, 22 Apr 2021 22:38:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619156297; cv=none; d=google.com; s=arc-20160816; b=tZSXIvC3kPFknPXEvot2GLDq0M0xqw7B0Sd5swxaprQOeLM7Ki5YuIRbND0uXggjGF a5KEV07TZl4Vo+Lsve83ymfVjza4bg5X+kB4FK6X1e27XzOGLm7nYepfJaa/FY/inAJp yYnhq01QHFG7Fki4CEc16jyR2lWeXRVPmSPSTbDkn3eGIX3DvT2Jomj3moMXiIACZ3jv XQIWYjW1M7QNkJPwT666fQ5Lqvl0iX46D1LQZrRa9Kc/2V9hp/FQP+RYj0GL++uIoAfw kNpor2dqDXttZ82/GrnGqBDtrvpmKMFuAeXyI9EVDBwv2wuBxtDoBp/8LTBp9oIT/kK4 U6/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:ironport-sdr:ironport-sdr; bh=UDjDAQSnIggyLXb/WKkdTm4JyWJwddjEQlx/mIxcjqk=; b=yVnt4hyGYs+onBs9n7RsizHS+7+DpB7c2DX35egraTLVHC1tz4LLJwPK8dNTHipLo1 3gKLrSDy+hNQAvCOXdAuapMJs2qHRE/+dok5MRsALjyB46AtX0WPgwBquuIFOlwGwYQ9 Yror8IUmv93BycqDjzC14/rpmFSEPrmUqAwD3CmYnSTBp4thVCOQ5Ue/zIjk/PGx92ij LEeJvasDwP/T/0kUr9gQM6HLn6Gp00MiRdm6csnP4SmTi+a4BhTqthhRo1+sqzk5FBlF YxLU8uWLkkIwCTHH6PK17v7otdPeLkmsUd2YRCruwbeNzeSjaLy0ulc7WW8cePCIQ11b ByJg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l16si4481641edb.221.2021.04.22.22.37.54; Thu, 22 Apr 2021 22:38:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240550AbhDWFhZ (ORCPT + 99 others); Fri, 23 Apr 2021 01:37:25 -0400 Received: from mga18.intel.com ([134.134.136.126]:9279 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240420AbhDWFhU (ORCPT ); Fri, 23 Apr 2021 01:37:20 -0400 IronPort-SDR: ER7mvz/fXFi+YL0dsz9OQTh3ZMTAeJas0PZ8ZtN1rJuvhvdNmznDmK+HBGQ0q90YA/xV9Wv8h9 384Z9JBrMFMA== X-IronPort-AV: E=McAfee;i="6200,9189,9962"; a="183501774" X-IronPort-AV: E=Sophos;i="5.82,244,1613462400"; d="scan'208";a="183501774" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Apr 2021 22:36:44 -0700 IronPort-SDR: +yb4NceJTOLFxmZ2EbP6lPSxsI5+ZgSQ7UmQf7b3Csi0A1fQ7jEP3ApUnNrismBcU8DHGLbm70 HJEaIOQ4IUog== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,244,1613462400"; d="scan'208";a="386293534" Received: from kbl-ppc.sh.intel.com ([10.239.159.163]) by orsmga006.jf.intel.com with ESMTP; 22 Apr 2021 22:36:42 -0700 From: Jin Yao To: acme@kernel.org, jolsa@kernel.org, peterz@infradead.org, mingo@redhat.com, alexander.shishkin@linux.intel.com Cc: Linux-kernel@vger.kernel.org, ak@linux.intel.com, kan.liang@intel.com, yao.jin@intel.com, Jin Yao Subject: [PATCH v5 03/26] perf pmu: Simplify arguments of __perf_pmu__new_alias Date: Fri, 23 Apr 2021 13:35:18 +0800 Message-Id: <20210423053541.12521-4-yao.jin@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210423053541.12521-1-yao.jin@linux.intel.com> References: <20210423053541.12521-1-yao.jin@linux.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Simplify the arguments of __perf_pmu__new_alias() by passing the whole 'struct pme_event' pointer. Signed-off-by: Jin Yao --- v5: - No change. tools/perf/util/pmu.c | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c index 286d5e415bdc..8214def7b0f0 100644 --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c @@ -306,18 +306,25 @@ static bool perf_pmu_merge_alias(struct perf_pmu_alias *newalias, } static int __perf_pmu__new_alias(struct list_head *list, char *dir, char *name, - char *desc, char *val, - char *long_desc, char *topic, - char *unit, char *perpkg, - char *metric_expr, - char *metric_name, - char *deprecated) + char *desc, char *val, struct pmu_event *pe) { struct parse_events_term *term; struct perf_pmu_alias *alias; int ret; int num; char newval[256]; + char *long_desc = NULL, *topic = NULL, *unit = NULL, *perpkg = NULL, + *metric_expr = NULL, *metric_name = NULL, *deprecated = NULL; + + if (pe) { + long_desc = (char *)pe->long_desc; + topic = (char *)pe->topic; + unit = (char *)pe->unit; + perpkg = (char *)pe->perpkg; + metric_expr = (char *)pe->metric_expr; + metric_name = (char *)pe->metric_name; + deprecated = (char *)pe->deprecated; + } alias = malloc(sizeof(*alias)); if (!alias) @@ -406,8 +413,7 @@ static int perf_pmu__new_alias(struct list_head *list, char *dir, char *name, FI /* Remove trailing newline from sysfs file */ strim(buf); - return __perf_pmu__new_alias(list, dir, name, NULL, buf, NULL, NULL, NULL, - NULL, NULL, NULL, NULL); + return __perf_pmu__new_alias(list, dir, name, NULL, buf, NULL); } static inline bool pmu_alias_info_file(char *name) @@ -798,11 +804,7 @@ void pmu_add_cpu_aliases_map(struct list_head *head, struct perf_pmu *pmu, /* need type casts to override 'const' */ __perf_pmu__new_alias(head, NULL, (char *)pe->name, (char *)pe->desc, (char *)pe->event, - (char *)pe->long_desc, (char *)pe->topic, - (char *)pe->unit, (char *)pe->perpkg, - (char *)pe->metric_expr, - (char *)pe->metric_name, - (char *)pe->deprecated); + pe); } } @@ -869,13 +871,7 @@ static int pmu_add_sys_aliases_iter_fn(struct pmu_event *pe, void *data) (char *)pe->name, (char *)pe->desc, (char *)pe->event, - (char *)pe->long_desc, - (char *)pe->topic, - (char *)pe->unit, - (char *)pe->perpkg, - (char *)pe->metric_expr, - (char *)pe->metric_name, - (char *)pe->deprecated); + pe); } return 0; -- 2.17.1