Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp5146417pxj; Wed, 9 Jun 2021 10:09:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyPi8Qwi+EcfVIBtkRZW4k6t7gkc37/KF5uq+Uw+oHQMay48OILCOB3sFsNqIwflIwIEHIw X-Received: by 2002:a17:906:2b85:: with SMTP id m5mr856207ejg.141.1623258584810; Wed, 09 Jun 2021 10:09:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623258584; cv=none; d=google.com; s=arc-20160816; b=HBDRdENGXbhYUkgBVClix8RDtfeuEUF6PuN4tlVw5KFQZL2ZJ1WVHJNZ3TdfK1OxNf BRFS+jhFQ6tOtc4nG5uxpFgqz5N5D46TbtSvHY5AX5+ihBkPMgwZB0+Af069LDDr3JBK Ukk2zlLkXpefZcUvenChqOv63hYIuSqBnfSr9iTlx+npBYOyGiQFT28jp4kBoDI9pXre nVDnIE6TODdkX4vNJXWxOhlMb4cucEKztl5KAE8kfS64DjZa70io3jpXfCLrJsKcC2rA zGaw42DLrjaOfvG5F5OvEccd9/rrteGi/Nqek9lZJ42ObZnmoK9JXiGAolYePyZsPbx1 wBvg== 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=IRTZ2WhKE3gDpDCQ+uDBdI9sQG4kO+33ReGsMLPCahQ=; b=jhVxEd8xWJPdRXqPAkWZ+oBrURPJxe5bDyLZZg/p7XHBt9bHOLH9MGzvqEjeORXswB ubkkO782m1DATlwdVVtIjBNFB8lXpqH9WtVCCue6Tzs7aKdO4Iygdn6Kq+i3MvT3TINJ GBoniEebKxifuF3OUWeKDFtjf3UDLEnK6QdAMj2A4NYA4hKisbuamdj8pIma9Y7Ua4Bu QSDqVPCJHUWnEXOlUZyowvKcaVuUbk8LONQYekP0TxGwW3N9EvAv+Jubf+uTdD9XsKfh EQSczHFpzuBKwRkFrm5mQwYB1euiz/9w/G/zGH1EN9WMPQQF0WSzt0JRQ8XV7jFte5gi KH6A== 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 r12si217368edo.370.2021.06.09.10.09.21; Wed, 09 Jun 2021 10:09:44 -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 S236862AbhFIGoI (ORCPT + 99 others); Wed, 9 Jun 2021 02:44:08 -0400 Received: from szxga03-in.huawei.com ([45.249.212.189]:5342 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235339AbhFIGn4 (ORCPT ); Wed, 9 Jun 2021 02:43:56 -0400 Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.54]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4G0HVS4Vbmz6vQM; Wed, 9 Jun 2021 14:38:08 +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; Wed, 9 Jun 2021 14:42:00 +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, 9 Jun 2021 14:41:59 +0800 From: Qi Liu To: , , CC: , Khuong Dinh , "Mark Rutland" Subject: [PATCH v4 5/7] drivers/perf: Simplify EVENT ATTR macro in xgene_pmu.c Date: Wed, 9 Jun 2021 14:41:01 +0800 Message-ID: <1623220863-58233-6-git-send-email-liuqi115@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1623220863-58233-1-git-send-email-liuqi115@huawei.com> References: <1623220863-58233-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 62d9425..2b6d476 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