From patchwork Wed May 19 09:51:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "liuqi (BA)" X-Patchwork-Id: 12266805 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 78023C433B4 for ; Wed, 19 May 2021 09:55:25 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 075BE60FF2 for ; Wed, 19 May 2021 09:55:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 075BE60FF2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=5Npz4YPc4bmgt8vw5FqiA/fjRYEH4sC1Awmncw+EFk0=; b=MrqqOed6xiOKXT3rrxJNpjRD8 hho9sirgnXXuCQHm0ASOCld+Kgrb425EVPCzDh+Unsf3lc0wQXE44fn1hd603OrqOkmtperIelds1 Ncw0PeuKi+vyskD7voCvsA5ks4ExrWBqq2Ovc8E402fN7vHF9319w0eoEmepZQQaYNKDnGTNWD9zy 60GFMbNsT7xpVl4Fi+30wIProX6R+nuacUyHgYfLhPRExsDULdIVBMWtU6kvpSBznsmyvfE/wG2yL BEaqagMiqSoLgKhaLH/uGbwKhETDBvDQIikrZhRzlWmWxRw3p8YF+JHb79ARE80OjTnpg0shm2WyK O2pnUOfvQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1ljIsg-003VzQ-Fz; Wed, 19 May 2021 09:52:46 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ljIsF-003VrO-Qh for linux-arm-kernel@desiato.infradead.org; Wed, 19 May 2021 09:52:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=Qp7le6xHBrAOc0VsciDMqcSADTz1wHR+KBjrnlquQvU=; b=aIJ7lLICopuU0bv2z2nD60R8aR BD6D5sAVSv/sHnlo5qyEzMrurIgaz8g6hWV4KdFp1QY5PpUwtm6dvB0vZObOUPVw9sqsdyMJHacqO BaWDpasMl1kidNAp+o/g2TSLtcCxQIUf1v4Nqsgf4sXUN65R+i5/VAIpbuqnZdsUpU5F1SPjGnw4v bf+Uc3QFKw8kQdsvlxc6/4fjgyyVGn4/jKvuQlboLHDafjMDNic8criES2xkzR9j2waXyAck3iwlD 9outctxAG9n7AMq263Su4sc8Re4ldoVig0e9usuxw+4dGgGwdaJ9PSimGUIOlio+bjfBUFmywLcDI 2ppC6tXA==; Received: from szxga05-in.huawei.com ([45.249.212.191]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ljIsC-00FKja-Ns for linux-arm-kernel@lists.infradead.org; Wed, 19 May 2021 09:52:18 +0000 Received: from dggems706-chm.china.huawei.com (unknown [172.30.72.59]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4FlSkx2jYzzsRD1; Wed, 19 May 2021 17:49:29 +0800 (CST) Received: from dggema757-chm.china.huawei.com (10.1.198.199) by dggems706-chm.china.huawei.com (10.3.19.183) 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:15 +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: , Will Deacon , Mark Rutland Subject: [PATCH v2 8/9] drivers/perf: Remove redundant macro and functions in arm_dsu_pmu.c Date: Wed, 19 May 2021 17:51:58 +0800 Message-ID: <1621417919-6632-9-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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210519_025216_967588_57D917E5 X-CRM114-Status: GOOD ( 10.81 ) 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 Cc: Will Deacon Cc: Mark Rutland Remove DSU_EVENT_ATTR and dsu_pmu_sysfs_event_show(), as there is a general function for this. Cc: Will Deacon Cc: Mark Rutland Signed-off-by: Qi Liu --- drivers/perf/arm_dsu_pmu.c | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/drivers/perf/arm_dsu_pmu.c b/drivers/perf/arm_dsu_pmu.c index 196faea..33bb97e 100644 --- a/drivers/perf/arm_dsu_pmu.c +++ b/drivers/perf/arm_dsu_pmu.c @@ -81,9 +81,6 @@ } \ })[0].attr.attr) -#define DSU_EVENT_ATTR(_name, _config) \ - DSU_EXT_ATTR(_name, dsu_pmu_sysfs_event_show, (unsigned long)_config) - #define DSU_FORMAT_ATTR(_name, _config) \ DSU_EXT_ATTR(_name, dsu_pmu_sysfs_format_show, (char *)_config) @@ -130,15 +127,6 @@ static inline struct dsu_pmu *to_dsu_pmu(struct pmu *pmu) return container_of(pmu, struct dsu_pmu, pmu); } -static ssize_t dsu_pmu_sysfs_event_show(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - struct dev_ext_attribute *eattr = container_of(attr, - struct dev_ext_attribute, attr); - return sysfs_emit(buf, "event=0x%lx\n", (unsigned long)eattr->var); -} - static ssize_t dsu_pmu_sysfs_format_show(struct device *dev, struct device_attribute *attr, char *buf) @@ -183,14 +171,14 @@ static const struct attribute_group dsu_pmu_format_attr_group = { }; static struct attribute *dsu_pmu_event_attrs[] = { - DSU_EVENT_ATTR(cycles, 0x11), - DSU_EVENT_ATTR(bus_access, 0x19), - DSU_EVENT_ATTR(memory_error, 0x1a), - DSU_EVENT_ATTR(bus_cycles, 0x1d), - DSU_EVENT_ATTR(l3d_cache_allocate, 0x29), - DSU_EVENT_ATTR(l3d_cache_refill, 0x2a), - DSU_EVENT_ATTR(l3d_cache, 0x2b), - DSU_EVENT_ATTR(l3d_cache_wb, 0x2c), + PMU_EVENT_ATTR_ID(cycles, 0x11), + PMU_EVENT_ATTR_ID(bus_access, 0x19), + PMU_EVENT_ATTR_ID(memory_error, 0x1a), + PMU_EVENT_ATTR_ID(bus_cycles, 0x1d), + PMU_EVENT_ATTR_ID(l3d_cache_allocate, 0x29), + PMU_EVENT_ATTR_ID(l3d_cache_refill, 0x2a), + PMU_EVENT_ATTR_ID(l3d_cache, 0x2b), + PMU_EVENT_ATTR_ID(l3d_cache_wb, 0x2c), NULL, };