From patchwork Tue May 18 07:23:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "liuqi (BA)" X-Patchwork-Id: 12264011 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,USER_AGENT_GIT autolearn=ham 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 8D2B5C433B4 for ; Tue, 18 May 2021 07:30:51 +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 1B71F61166 for ; Tue, 18 May 2021 07:30:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1B71F61166 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=j/DJBcZ2UWfMZSkJ1Y3HA7GGZgmbTRfXeN42SgbU5WQ=; b=WPZMOgamKR1z3dugSPJch9j2i g8kh7T5aBZteO4o3yKzdToL+gx+r1LjzhIDQt2KdudkDH4LDH0aSSCt4tf8Em2t2nkk2i2PIAqd1w uwOl0qFHXIkJEeb8KkUNlY7zQdKfusdvScgABae1lxPUXAWX62jKUmMkQ//29W5DSZcbK3Mb6UQk4 B8LAGltem+qxdHFfMVof7cu6P0eTmTLzgn8Zz5/ZsArlzCABAciCh8XwrRc17IafQlaLM/5lT6Y5Z wMJtxsckjFyeCChLNK//BRcKr9uWqVfry7V79r5Z6LFS8MdG4GgY/4MIOPcFRqGvK92c9B/RQGj1l n+8ztmI7w==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1liuAC-00HLt7-87; Tue, 18 May 2021 07:29:12 +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 1liu5H-00HJlu-O9 for linux-arm-kernel@desiato.infradead.org; Tue, 18 May 2021 07:24:07 +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=+3wU1J8Liho9sDXYkIGBRERHXPlCdRjGdF7F51i40u4=; b=j41AfQmhY8VENZzycnzaw902dP dEsp7vCusxjrUWCSAYsNjmbG4fmHhK1P1WX8OzisFfhBpAOVgc/glgVAwrpRxb7BPP/tsPHTwiuu9 E92iOFDmgkMreqlz+WcfJcsfFLyKkCsCmzLOtOf9RKd5W2SxgrKKQwmlsS8zFeqHMJuVQXbRlqc0X 8O5VGS0n2YjBB3F9fJFr8TFnIeEAsusiTZA+aHqoy9wF7/zCDs2J5/Gxa1u6aUCjg0YCKPdfL9XMC 6SengM0F61UtwRvpc1SgFO88Xq73J3ZAN4e03kbcOI1oKXlanAm74mn74DE+K4IgdyqVmrlYkDhqY o2j356Vw==; Received: from szxga04-in.huawei.com ([45.249.212.190]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1liu5C-00EPND-9O for linux-arm-kernel@lists.infradead.org; Tue, 18 May 2021 07:24:06 +0000 Received: from dggems706-chm.china.huawei.com (unknown [172.30.72.58]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4FknTQ3mKFzmjCq; Tue, 18 May 2021 15:20:26 +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; 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 8/9] drivers/perf: Remove redundant macro and functions in arm_dsu_pmu.c Date: Tue, 18 May 2021 15:23:47 +0800 Message-ID: <1621322628-9945-9-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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210518_002402_589100_FF819320 X-CRM114-Status: UNSURE ( 9.81 ) X-CRM114-Notice: Please train this message. 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 Remove DSU_EVENT_ATTR and dsu_pmu_sysfs_event_show(), as there is a general function for this. 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, };