Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1574000pxj; Wed, 19 May 2021 08:57:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy7PV5Q3GG7SwE/7cfwYyOEtmY+AOIIzOPFi24NNs5En/0QG2Y0t9ypzeHc7qQMIk/qTmLH X-Received: by 2002:aa7:c548:: with SMTP id s8mr15593927edr.114.1621439849384; Wed, 19 May 2021 08:57:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621439849; cv=none; d=google.com; s=arc-20160816; b=OoRzfX6wXX/YEw0AiHUbtuvoFay767uBvIvnjnS9Vd3fIqU8odiQN+Qh3RBBAWLMQO WYcLsJjlEqE9mFJD1Dwmx6QX7xPR5t7ptHUuoMhcnF1tFPAwp3YINMY6l4Xl14jNBFFl 25f/LT3TPvQ2X7kuMrg++ch07vAuxUdaBgQT2tRhm/IrPEeXhxwoS56pk93i4J8ESj4q LTSnVUDwdOiVqGWTSYBfprWeWCcpPhsx8/MkTYonv3flZgSFvaJB24wJfn4BvhkKSejV 8VnXVL2GVJBOfNYVtbvp4edy1OkmmqKhVvXPc95lRhZ7UQA1DQJcsPiAwWonfM+UYtmb 9i3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=V6PX1jxySA7i+qgPHxKxAEmBlywokfTiUvqGGExkuNk=; b=iGIfS+nGh4mgwD5eIZpZHkwmsdq49T4iLi8cAZ4yNtVU+WaF9GLLyUy5SZpWbNS2MY D10QK6Rc1UeI/fQUclLkCZpTGqj0GakUhHc6yLzC5u0DnPNaxYI6UTu5hBpjky6r+w4C EgCpRrtmrwRVBDkkF6WTAXr4ajiUuqmTcm+jeM4TMsFqjYem/+q7xaqh0KuU98975aYc H1mxKvwj8s43kPW/dRgXFXJa8ARauAvUIwSnDk5FWNsWJ1LK3XlbUgFv9W1TQAwcTBQ6 LoiSaFH6sAJQfD3LGGMWZkL0BezJhCz/gfEqbGYYcu81J9EXap88uhsS3O/fiRcJ6x5I /NdA== 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=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gl11si64711ejb.533.2021.05.19.08.57.05; Wed, 19 May 2021 08:57:29 -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=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242203AbhERHZa (ORCPT + 99 others); Tue, 18 May 2021 03:25:30 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:2965 "EHLO szxga07-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240132AbhERHZO (ORCPT ); Tue, 18 May 2021 03:25:14 -0400 Received: from dggems703-chm.china.huawei.com (unknown [172.30.72.58]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4FknVD6FmhzCtlk; Tue, 18 May 2021 15:21:08 +0800 (CST) Received: from dggema757-chm.china.huawei.com (10.1.198.199) by dggems703-chm.china.huawei.com (10.3.19.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2176.2; Tue, 18 May 2021 15:23:54 +0800 Received: from localhost.localdomain (10.69.192.56) by dggema757-chm.china.huawei.com (10.1.198.199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Tue, 18 May 2021 15:23:54 +0800 From: Qi Liu To: , , CC: , , , Subject: [PATCH 5/9] drivers/perf: Remove redundant macro and functions in qcom_l3_pmu.c Date: Tue, 18 May 2021 15:23:44 +0800 Message-ID: <1621322628-9945-6-git-send-email-liuqi115@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1621322628-9945-1-git-send-email-liuqi115@huawei.com> References: <1621322628-9945-1-git-send-email-liuqi115@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggema757-chm.china.huawei.com (10.1.198.199) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Remove L3CACHE_EVENT_ATTR and l3cache_pmu_event_show(), as there is a general function for this. Signed-off-by: Qi Liu --- drivers/perf/qcom_l3_pmu.c | 30 +++++++----------------------- 1 file changed, 7 insertions(+), 23 deletions(-) diff --git a/drivers/perf/qcom_l3_pmu.c b/drivers/perf/qcom_l3_pmu.c index bba0780..a163c9a 100644 --- a/drivers/perf/qcom_l3_pmu.c +++ b/drivers/perf/qcom_l3_pmu.c @@ -636,30 +636,14 @@ static const struct attribute_group qcom_l3_cache_pmu_format_group = { }; /* events */ - -static ssize_t l3cache_pmu_event_show(struct device *dev, - struct device_attribute *attr, char *page) -{ - struct perf_pmu_events_attr *pmu_attr; - - pmu_attr = container_of(attr, struct perf_pmu_events_attr, attr); - return sysfs_emit(page, "event=0x%02llx\n", pmu_attr->id); -} - -#define L3CACHE_EVENT_ATTR(_name, _id) \ - (&((struct perf_pmu_events_attr[]) { \ - { .attr = __ATTR(_name, 0444, l3cache_pmu_event_show, NULL), \ - .id = _id, } \ - })[0].attr.attr) - static struct attribute *qcom_l3_cache_pmu_events[] = { - L3CACHE_EVENT_ATTR(cycles, L3_EVENT_CYCLES), - L3CACHE_EVENT_ATTR(read-hit, L3_EVENT_READ_HIT), - L3CACHE_EVENT_ATTR(read-miss, L3_EVENT_READ_MISS), - L3CACHE_EVENT_ATTR(read-hit-d-side, L3_EVENT_READ_HIT_D), - L3CACHE_EVENT_ATTR(read-miss-d-side, L3_EVENT_READ_MISS_D), - L3CACHE_EVENT_ATTR(write-hit, L3_EVENT_WRITE_HIT), - L3CACHE_EVENT_ATTR(write-miss, L3_EVENT_WRITE_MISS), + PMU_EVENT_ATTR_ID(cycles, L3_EVENT_CYCLES), + PMU_EVENT_ATTR_ID(read-hit, L3_EVENT_READ_HIT), + PMU_EVENT_ATTR_ID(read-miss, L3_EVENT_READ_MISS), + PMU_EVENT_ATTR_ID(read-hit-d-side, L3_EVENT_READ_HIT_D), + PMU_EVENT_ATTR_ID(read-miss-d-side, L3_EVENT_READ_MISS_D), + PMU_EVENT_ATTR_ID(write-hit, L3_EVENT_WRITE_HIT), + PMU_EVENT_ATTR_ID(write-miss, L3_EVENT_WRITE_MISS), NULL }; -- 2.7.4