Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp127520pxf; Wed, 10 Mar 2021 23:10:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJweuv1wY3cAR5TF1UM5wooL9RugCVTScaC70gsDC0xk53q5miR8xLXetqXE/+pbh8fpPdbq X-Received: by 2002:a17:906:d291:: with SMTP id ay17mr1653659ejb.308.1615446642906; Wed, 10 Mar 2021 23:10:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615446642; cv=none; d=google.com; s=arc-20160816; b=Jo5ATXbwJnaHZD2mXlrjMKJ8qr3cbCJkkPdidzh6MuzP99m/DNv0xX1warjSbbs3SB V1kNMFKvkbdzxWWyB+XmtePxLadpc9YQorU+q2wGlvMZzrl4HpYvWp5tICq1k9wTOBNP fsuqucD89hVSZ0YmKHABVV6or92rb/iANsheN+UF2O9Pu7Ey5bywat1dqJuYr3C6mmTp iDwLknJ++Vkxk5bJixa5ACfiME68FaK9NCw+GUmWHBVKubAlqQlr54/YIH0kWY50kDFF UPhrjMO6z6uJrL3cqZDWVvpTSQNJTQHk2X3IDlxJZUo0QYwhPAesbD3xwcUEg4Dag+/N qIpg== 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=86LHVK7Iupln9K3TDkZ2eX3OjCx/MJU0QVAfaBnWnbU=; b=b4eFlrWQODBVrwejgELcYsbcTDl0KokCABboL3ALkTVo0AZCXTW8LwuT5waBUCC0C5 DogjyN+JD3iMH+I80E/CagE8SHzLV2Js7oQTjSPinAO9t/wQ5jF7TkDPtw7j6vsGagxm VizJuasFb8n52WQxplOkqrejPmTRkiyazTn7+P6YxRYWNboST/oeaJkYD+MK+sZuSgvR row2k6M5HXfoBE+qlFX+UZ+8LoHIOvQKwuCIN9gX4bTjNG7i5FcxA8CGdY6A6VQD8Pv3 58p4ITRYNdr+BzOD9yLpDcAwXdXkDWM+VTFxOnG/Kggv3ex1TkcnYNw7X1z9aHMt4VJ8 MSYw== 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 bc10si1267721edb.235.2021.03.10.23.10.20; Wed, 10 Mar 2021 23:10:42 -0800 (PST) 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 S231687AbhCKHI6 (ORCPT + 99 others); Thu, 11 Mar 2021 02:08:58 -0500 Received: from mga04.intel.com ([192.55.52.120]:22599 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231615AbhCKHI1 (ORCPT ); Thu, 11 Mar 2021 02:08:27 -0500 IronPort-SDR: y5WbVO4gJLtKeePWf8OYHLgMONrj2ZZpm4wE7nO2JUxOMVSiXCMT2g6Pw3vO/oKuWVDxtTfVm4 pTfnZTF1TiDw== X-IronPort-AV: E=McAfee;i="6000,8403,9919"; a="186246015" X-IronPort-AV: E=Sophos;i="5.81,239,1610438400"; d="scan'208";a="186246015" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Mar 2021 23:08:27 -0800 IronPort-SDR: jDQcB7XC1jpWy5IBslzOT+24KKgotw5c6eqo8tJP5WuSQsEwc0zpaOmW+bp8tyuyAffzuOPuNZ F9fz72pWJh6A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,239,1610438400"; d="scan'208";a="509937819" Received: from kbl-ppc.sh.intel.com ([10.239.159.163]) by fmsmga001.fm.intel.com with ESMTP; 10 Mar 2021 23:08:24 -0800 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 v2 03/27] perf pmu: Simplify arguments of __perf_pmu__new_alias Date: Thu, 11 Mar 2021 15:07:18 +0800 Message-Id: <20210311070742.9318-4-yao.jin@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210311070742.9318-1-yao.jin@linux.intel.com> References: <20210311070742.9318-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 --- 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 44ef28302fc7..54e586bf19a5 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) @@ -793,11 +799,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); } } @@ -864,13 +866,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