Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1727566pxj; Wed, 19 May 2021 12:27:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzt/GYMkpSrZavuO/+nTomYpvOekb2FbFWzYOR7NQiu9R3RTQQzIbEOfuMA/7CYdvJQDnKn X-Received: by 2002:a17:906:4c8c:: with SMTP id q12mr752784eju.254.1621452426809; Wed, 19 May 2021 12:27:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621452426; cv=none; d=google.com; s=arc-20160816; b=JC8WKyPJ9Cec4On7gqzP4NqWlgwebHeBOJR6XSnfRHApR7GZcoGu0fbP/gore4zkkG qTcIlL0+gdFY9RsL4yCJkobZOrDcuJAphPaoC57Ux6bu9SCSqWAxPDyd2Z1SVY7ARkQC tzasKIyBT9yrvsErYZk77t+Y74dF3kjCyKP/34dRlHis/HMBmC+JC7ZkmU2HNbpQBSkb 7O+I8GiPAkJBxPjWnBYZgAwrq92mMH4lZ0+VlasHAfzrYSmepDJ/qerwBtj5Liqh78SG WQ2YwNkSFOeq26/6o7YngI9A64ZCuOK2zk+ISqH3I6pLg4Z7I7ElreEeZiQrPz8I90aV iNZA== 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=02p/7W1zy3RqSGWPSAtxmtGKlN4izXZ2/0R9GkO8k8k=; b=jOk/SGF/e++HlBEBzdv4/RIQdjLoPJuzrE9e+ZcdjH2pi2vsXvwpYpXPI8JiNTxREm Oq+yBlrB/yv5o3wUw36nG+5Pkyb0FHFvVe9DjBhGAHDXIzZi3NhjeLABiQI7E0R5+ggh FN7pK1Ix+JQcoIJHrct2wnxogmJO735w/PKo9nk5B2cwYPAqj20yxvIOCdi6V80e1n5g bxHdeEtzaJfZbByDcgt9tkQgtnPGmrq7VWQwcvT7zlz0hTpWsqgYglBqT2+AZ1Iq+Dvd T/obtWod7Z+WRjfAY1Bp2lA5gWt/2xCW+wJtsm3VkAvT4cTD7I+/J02S+1o7AgGVBi/g RK9Q== 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 cx5si82465edb.473.2021.05.19.12.26.40; Wed, 19 May 2021 12:27:06 -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 S1347131AbhESJx6 (ORCPT + 99 others); Wed, 19 May 2021 05:53:58 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:4533 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346749AbhESJxh (ORCPT ); Wed, 19 May 2021 05:53:37 -0400 Received: from dggems705-chm.china.huawei.com (unknown [172.30.72.60]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4FlSkz4rHDzsSgV; Wed, 19 May 2021 17:49:31 +0800 (CST) Received: from dggema757-chm.china.huawei.com (10.1.198.199) by dggems705-chm.china.huawei.com (10.3.19.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2176.2; Wed, 19 May 2021 17:52:14 +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; Wed, 19 May 2021 17:52:14 +0800 From: Qi Liu To: , CC: , Andy Gross , Will Deacon , Mark Rutland Subject: [PATCH v2 5/9] drivers/perf: Remove redundant macro and functions in qcom_l3_pmu.c Date: Wed, 19 May 2021 17:51:55 +0800 Message-ID: <1621417919-6632-6-git-send-email-liuqi115@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1621417919-6632-1-git-send-email-liuqi115@huawei.com> References: <1621417919-6632-1-git-send-email-liuqi115@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) 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. Cc: Andy Gross Cc: Will Deacon Cc: Mark Rutland 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