Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1727794pxj; Wed, 19 May 2021 12:27:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy44fN4STMqTxSiyAKko/rDrYE6QNo0uzmOw71kkioqqYM2s1Oy5jZ8SGfNhEcpyhESzSq9 X-Received: by 2002:a6b:630b:: with SMTP id p11mr1210379iog.133.1621452449262; Wed, 19 May 2021 12:27:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621452449; cv=none; d=google.com; s=arc-20160816; b=neuTvTDAsBpw7FMtsA/qofZVBfbPY/7f05cODA1Yq4b5BkdkRlmfLUEmgtzUSNygj0 2TuJFGbMLF/1d+QUJUOFMcuSQqpONkKYd1y9aC/Uh+vRvOlhgFjUUXc8JQI+Y/3NOdDm vpVloZZRY6Fmv7ZF174JA4FkYEk7OWobmv7K1AE4pJOy/aH8SXjenUji+pTLdXz6/nMB GfNZuqNCdO2Vs8Bz17LDqj0v7WwpWV8+OVhZCuCksepLvztqGm17pJHjQ0DBWZQV7KjP +jpdSEmtz54zZXklNU6y6DaUD51usgDgITHHmIGRQPgngYi0BHEZu6ixHthEDLPk0Myh tJRA== 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=k8Nps3mpDxxqc9k1lj9qVXBOuhXVK1luv71a6WK8f2c=; b=y9Z7FVqJ6+KH870HKPTzf//05/adIH3WOcp3Op2MUHYcSm9JNAiT8z/n/kg3G8px91 k6KFkD++9X+BY/oeeT08gDNeTx4WahBR3ZKGQ6FXewUygGPfr90q0y1bx6Y2W/HFWI6S 5vF5gbPoZm/z94wIQamU+BXGqW+Cm27SwNrnAPRE/lkJboltXhzN8wvCZWjHbjQ4ydtm b0OcuCm2XBAffeXC4T5jfoU6IT1yBpM1ed7Zsvn333Q/JMxYkw6mNLp8Ga+1FupU30wN 6sDHrqFHFGKI0jKhBtCFKx6KITu7SfXLHYfbyjw9CnskEK1YPcIOrFQJ/xDYA69i9/EL Laxg== 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 x9si319275ilo.119.2021.05.19.12.27.16; Wed, 19 May 2021 12:27: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 S1346596AbhESJxo (ORCPT + 99 others); Wed, 19 May 2021 05:53:44 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:4531 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346640AbhESJxg (ORCPT ); Wed, 19 May 2021 05:53:36 -0400 Received: from dggems706-chm.china.huawei.com (unknown [172.30.72.60]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4FlSkx1mmZzsS4h; 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: , Frank Li , Will Deacon , Mark Rutland Subject: [PATCH v2 7/9] drivers/perf: Remove redundant macro and functions in fsl_imx8_ddr_perf.c Date: Wed, 19 May 2021 17:51:57 +0800 Message-ID: <1621417919-6632-8-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 IMX8_DDR_PMU_EVENT_ATTR and ddr_pmu_event_show(), as there is a general function for this. Cc: Frank Li Cc: Will Deacon Cc: Mark Rutland Signed-off-by: Qi Liu --- drivers/perf/fsl_imx8_ddr_perf.c | 80 ++++++++++++++++------------------------ 1 file changed, 32 insertions(+), 48 deletions(-) diff --git a/drivers/perf/fsl_imx8_ddr_perf.c b/drivers/perf/fsl_imx8_ddr_perf.c index 2bbb931..8f2c4dd 100644 --- a/drivers/perf/fsl_imx8_ddr_perf.c +++ b/drivers/perf/fsl_imx8_ddr_perf.c @@ -212,55 +212,39 @@ static const struct attribute_group ddr_perf_cpumask_attr_group = { .attrs = ddr_perf_cpumask_attrs, }; -static ssize_t -ddr_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 IMX8_DDR_PMU_EVENT_ATTR(_name, _id) \ - (&((struct perf_pmu_events_attr[]) { \ - { .attr = __ATTR(_name, 0444, ddr_pmu_event_show, NULL),\ - .id = _id, } \ - })[0].attr.attr) - static struct attribute *ddr_perf_events_attrs[] = { - IMX8_DDR_PMU_EVENT_ATTR(cycles, EVENT_CYCLES_ID), - IMX8_DDR_PMU_EVENT_ATTR(selfresh, 0x01), - IMX8_DDR_PMU_EVENT_ATTR(read-accesses, 0x04), - IMX8_DDR_PMU_EVENT_ATTR(write-accesses, 0x05), - IMX8_DDR_PMU_EVENT_ATTR(read-queue-depth, 0x08), - IMX8_DDR_PMU_EVENT_ATTR(write-queue-depth, 0x09), - IMX8_DDR_PMU_EVENT_ATTR(lp-read-credit-cnt, 0x10), - IMX8_DDR_PMU_EVENT_ATTR(hp-read-credit-cnt, 0x11), - IMX8_DDR_PMU_EVENT_ATTR(write-credit-cnt, 0x12), - IMX8_DDR_PMU_EVENT_ATTR(read-command, 0x20), - IMX8_DDR_PMU_EVENT_ATTR(write-command, 0x21), - IMX8_DDR_PMU_EVENT_ATTR(read-modify-write-command, 0x22), - IMX8_DDR_PMU_EVENT_ATTR(hp-read, 0x23), - IMX8_DDR_PMU_EVENT_ATTR(hp-req-nocredit, 0x24), - IMX8_DDR_PMU_EVENT_ATTR(hp-xact-credit, 0x25), - IMX8_DDR_PMU_EVENT_ATTR(lp-req-nocredit, 0x26), - IMX8_DDR_PMU_EVENT_ATTR(lp-xact-credit, 0x27), - IMX8_DDR_PMU_EVENT_ATTR(wr-xact-credit, 0x29), - IMX8_DDR_PMU_EVENT_ATTR(read-cycles, 0x2a), - IMX8_DDR_PMU_EVENT_ATTR(write-cycles, 0x2b), - IMX8_DDR_PMU_EVENT_ATTR(read-write-transition, 0x30), - IMX8_DDR_PMU_EVENT_ATTR(precharge, 0x31), - IMX8_DDR_PMU_EVENT_ATTR(activate, 0x32), - IMX8_DDR_PMU_EVENT_ATTR(load-mode, 0x33), - IMX8_DDR_PMU_EVENT_ATTR(perf-mwr, 0x34), - IMX8_DDR_PMU_EVENT_ATTR(read, 0x35), - IMX8_DDR_PMU_EVENT_ATTR(read-activate, 0x36), - IMX8_DDR_PMU_EVENT_ATTR(refresh, 0x37), - IMX8_DDR_PMU_EVENT_ATTR(write, 0x38), - IMX8_DDR_PMU_EVENT_ATTR(raw-hazard, 0x39), - IMX8_DDR_PMU_EVENT_ATTR(axid-read, 0x41), - IMX8_DDR_PMU_EVENT_ATTR(axid-write, 0x42), + PMU_EVENT_ATTR_ID(cycles, EVENT_CYCLES_ID), + PMU_EVENT_ATTR_ID(selfresh, 0x01), + PMU_EVENT_ATTR_ID(read-accesses, 0x04), + PMU_EVENT_ATTR_ID(write-accesses, 0x05), + PMU_EVENT_ATTR_ID(read-queue-depth, 0x08), + PMU_EVENT_ATTR_ID(write-queue-depth, 0x09), + PMU_EVENT_ATTR_ID(lp-read-credit-cnt, 0x10), + PMU_EVENT_ATTR_ID(hp-read-credit-cnt, 0x11), + PMU_EVENT_ATTR_ID(write-credit-cnt, 0x12), + PMU_EVENT_ATTR_ID(read-command, 0x20), + PMU_EVENT_ATTR_ID(write-command, 0x21), + PMU_EVENT_ATTR_ID(read-modify-write-command, 0x22), + PMU_EVENT_ATTR_ID(hp-read, 0x23), + PMU_EVENT_ATTR_ID(hp-req-nocredit, 0x24), + PMU_EVENT_ATTR_ID(hp-xact-credit, 0x25), + PMU_EVENT_ATTR_ID(lp-req-nocredit, 0x26), + PMU_EVENT_ATTR_ID(lp-xact-credit, 0x27), + PMU_EVENT_ATTR_ID(wr-xact-credit, 0x29), + PMU_EVENT_ATTR_ID(read-cycles, 0x2a), + PMU_EVENT_ATTR_ID(write-cycles, 0x2b), + PMU_EVENT_ATTR_ID(read-write-transition, 0x30), + PMU_EVENT_ATTR_ID(precharge, 0x31), + PMU_EVENT_ATTR_ID(activate, 0x32), + PMU_EVENT_ATTR_ID(load-mode, 0x33), + PMU_EVENT_ATTR_ID(perf-mwr, 0x34), + PMU_EVENT_ATTR_ID(read, 0x35), + PMU_EVENT_ATTR_ID(read-activate, 0x36), + PMU_EVENT_ATTR_ID(refresh, 0x37), + PMU_EVENT_ATTR_ID(write, 0x38), + PMU_EVENT_ATTR_ID(raw-hazard, 0x39), + PMU_EVENT_ATTR_ID(axid-read, 0x41), + PMU_EVENT_ATTR_ID(axid-write, 0x42), NULL, }; -- 2.7.4