Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3765344pxj; Mon, 7 Jun 2021 20:39:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw3R3+1BpxZM3zK6E8HSiHNbenZZXPdl122HQSnWoljRjeaKVFTEia4JdR/1EPcTOWGKWSz X-Received: by 2002:a05:6402:214:: with SMTP id t20mr19507971edv.20.1623123553953; Mon, 07 Jun 2021 20:39:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623123553; cv=none; d=google.com; s=arc-20160816; b=oa6+zLHQ4YmmtOUN+uV1TZzLzUi/tVHw/PCB+rQBaU5ZSO35i1YD+tn56pOv22lLJu y64R66cijj0sw27XVKWtJwq99E/+BcB9IF3MaIdl5CztxnYj1pLtXR5vqu9I7KRHjyQE 1dha/D7IZoCPsQyhPxkLjpwNxVoJ3ikd5PJrDbAooU7PlVRVns5XLd9tY3bi9+DbfOsB QyhRbhoiP4UhtSwRcME3kC3EH+V2UETxD7/YyLNmD7K5LhqJu/c1J0ldwxyQDZf88GzZ +YqPIgOE7eS4UsEuf+LR4D2uYeNQv8khRgGWMcqcj2yh5HBuyfZw8WmxmIFsnFubekS7 C2Ow== 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=Daqv4szt2S2fthmxyHPHlKAbLSHlFEL1tTGTd0rTgdM=; b=hp7BNpv5DbmhMvv1KbRsLhwp3aTQFss6c4SqiAdE5IzSaAFqh6o2nLpzmv+7RSavqA 6XFcAVOMiK0+Y+gFPpee/Pctoc4QTkTh1ZQ9Lc6rU/RlUWVGDPxtg+pjacsiR6I0A2OS WLe4+ZND6g9BnkgO0VYMTm8SgfJjr+Rlbnj4LyO92f46oDAYRtXoHDERGa/0JVZtrIG/ wfRRZCzhRNs7lKERa8F6GsxUyG+YsQg302gQZDvNDHCfjUGwNXNLB+i/KMW+wE7ohiFR m2wq7lS6hTXxLnYAxdxM+WEaY4H+kF4tME9UY0jDjY21nKp44e2PP0FVL/Q6zmr9xMV4 snfw== 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 29si3694692ejf.673.2021.06.07.20.38.50; Mon, 07 Jun 2021 20:39:13 -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 S231283AbhFHDgP (ORCPT + 99 others); Mon, 7 Jun 2021 23:36:15 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:3099 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230410AbhFHDgM (ORCPT ); Mon, 7 Jun 2021 23:36:12 -0400 Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4FzbMD2kvhzWtTQ; Tue, 8 Jun 2021 11:29:28 +0800 (CST) Received: from dggema757-chm.china.huawei.com (10.1.198.199) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2176.2; Tue, 8 Jun 2021 11:33:42 +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, 8 Jun 2021 11:33:41 +0800 From: Qi Liu To: , CC: , Khuong Dinh , "Will Deacon" , Mark Rutland Subject: [PATCH v3 6/9] drivers/perf: Simplify EVENT ATTR macro in xgene_pmu.c Date: Tue, 8 Jun 2021 11:33:18 +0800 Message-ID: <1623123201-45634-7-git-send-email-liuqi115@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1623123201-45634-1-git-send-email-liuqi115@huawei.com> References: <1623123201-45634-1-git-send-email-liuqi115@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) 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 Use common macro PMU_EVENT_ATTR_ID to simplify XGENE_PMU_EVENT_ATTR. Cc: Khuong Dinh Cc: Will Deacon Cc: Mark Rutland Signed-off-by: Qi Liu --- drivers/perf/xgene_pmu.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/perf/xgene_pmu.c b/drivers/perf/xgene_pmu.c index ffe3bde..9b47bcd 100644 --- a/drivers/perf/xgene_pmu.c +++ b/drivers/perf/xgene_pmu.c @@ -278,17 +278,14 @@ static const struct attribute_group mc_pmu_v3_format_attr_group = { static ssize_t xgene_pmu_event_show(struct device *dev, struct device_attribute *attr, char *buf) { - struct dev_ext_attribute *eattr; + struct perf_pmu_events_attr *pmu_attr = + container_of(attr, struct perf_pmu_events_attr, attr); - eattr = container_of(attr, struct dev_ext_attribute, attr); - return sysfs_emit(buf, "config=0x%lx\n", (unsigned long) eattr->var); + return sysfs_emit(buf, "config=0x%llx\n", pmu_attr->id); } #define XGENE_PMU_EVENT_ATTR(_name, _config) \ - (&((struct dev_ext_attribute[]) { \ - { .attr = __ATTR(_name, S_IRUGO, xgene_pmu_event_show, NULL), \ - .var = (void *) _config, } \ - })[0].attr.attr) + PMU_EVENT_ATTR_ID(_name, xgene_pmu_event_show, _config) static struct attribute *l3c_pmu_events_attrs[] = { XGENE_PMU_EVENT_ATTR(cycle-count, 0x00), -- 2.7.4