Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3764443pxj; Mon, 7 Jun 2021 20:36:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyFo470c3AxhdqqEOI4IQ8yzb5Y3ousdgOS9DRJh+Aoh8mOVvs5SyyXrvGkp+3kTUotkSIU X-Received: by 2002:a17:906:1912:: with SMTP id a18mr21209881eje.117.1623123419518; Mon, 07 Jun 2021 20:36:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623123419; cv=none; d=google.com; s=arc-20160816; b=gHvkBFRW7Cwu0CLaq7jJaaV69Ydc8qV5/zdE6DG8Gww3Itz/QSg9OJ4TstwoP1L+KP LCGYKgfrE5mXzdpp4r8QbBtDwKC+B83NPxvp8ZSfjzGXwUt+Z+TNDLUXuqvM9ITJhOsH OR2iDf40PlzWXofkQT0I6eFb0CEQGPqI/ISAGjUQCtVHONkp81hJ0MnrMchpCJtQJp8A cmMQki6jowQzoHEaAZibefIHdD7hKTC1opOeXcI1zU7GvHMKOqw36vXoqXD2n2q/p2m7 sCXeZuMLGcBc7znjFgJce6Botayt6gb8JJyZ3nlPn+napMBPbMsiAEBx/hVyGA/iCZhG BR9w== 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=o8j4Dwco9LsNrXpt9f/lFkoIsPmOw7fpMwch95yi6Lc=; b=nxME2nzeWiNtC5DbSMDmT/R6yQortkb3a1AFK6xou5eu+dSnpVJEn3186B93HAlJ9X zpYcYm5wAujJi1tqocn/V9W+8x+ztw0Qr/6aO/m+lGSE2fHgOFP/G6crC1Gqu1rFnCzq b4UN1Z1U2pEFIpxrHI9Rz4mYq9j6WcxOV55LtGpZ42Ou3biIx/RuTbTI8aAovHd2p2kU W5QOuyRSI7I3MjnQEPZ55jqK1ubxAaFRJ3jbAMtMpCW2tgaa3pPmHetb/DEVBwwxibLB P7dLzKimdcgK0/7U+9VOcDaMnmOX/vYHSlo5LwRhTnXcPn0YETgz9GkyCbnVqkjiQJF/ WsJw== 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 v5si13407871edj.446.2021.06.07.20.36.36; Mon, 07 Jun 2021 20:36:59 -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 S231262AbhFHDfn (ORCPT + 99 others); Mon, 7 Jun 2021 23:35:43 -0400 Received: from szxga03-in.huawei.com ([45.249.212.189]:4391 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230481AbhFHDfi (ORCPT ); Mon, 7 Jun 2021 23:35:38 -0400 Received: from dggemv711-chm.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4FzbMk1tlcz6vTs; Tue, 8 Jun 2021 11:29:54 +0800 (CST) Received: from dggema757-chm.china.huawei.com (10.1.198.199) by dggemv711-chm.china.huawei.com (10.1.198.66) 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:41 +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: , Shaokun Zhang , "Will Deacon" , Mark Rutland Subject: [PATCH v3 2/9] drivers/perf: hisi: Simplify EVENT ATTR macro in HiSilicon PMU driver Date: Tue, 8 Jun 2021 11:33:14 +0800 Message-ID: <1623123201-45634-3-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 HISI_PMU_EVENT_ATTR. Cc: Shaokun Zhang Cc: Will Deacon Cc: Mark Rutland Signed-off-by: Qi Liu --- drivers/perf/hisilicon/hisi_uncore_pmu.c | 7 +++---- drivers/perf/hisilicon/hisi_uncore_pmu.h | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/perf/hisilicon/hisi_uncore_pmu.c b/drivers/perf/hisilicon/hisi_uncore_pmu.c index 13c68b5..52e3bcb 100644 --- a/drivers/perf/hisilicon/hisi_uncore_pmu.c +++ b/drivers/perf/hisilicon/hisi_uncore_pmu.c @@ -43,11 +43,10 @@ EXPORT_SYMBOL_GPL(hisi_format_sysfs_show); ssize_t hisi_event_sysfs_show(struct device *dev, struct device_attribute *attr, char *page) { - struct dev_ext_attribute *eattr; - - eattr = container_of(attr, struct dev_ext_attribute, attr); + struct perf_pmu_events_attr *pmu_attr = + container_of(attr, struct perf_pmu_events_attr, attr); - return sysfs_emit(page, "config=0x%lx\n", (unsigned long)eattr->var); + return sysfs_emit(page, "config=0x%llx\n", pmu_attr->id); } EXPORT_SYMBOL_GPL(hisi_event_sysfs_show); diff --git a/drivers/perf/hisilicon/hisi_uncore_pmu.h b/drivers/perf/hisilicon/hisi_uncore_pmu.h index ea9d89b..b2504d4 100644 --- a/drivers/perf/hisilicon/hisi_uncore_pmu.h +++ b/drivers/perf/hisilicon/hisi_uncore_pmu.h @@ -35,7 +35,7 @@ #define HISI_PMU_FORMAT_ATTR(_name, _config) \ HISI_PMU_ATTR(_name, hisi_format_sysfs_show, (void *)_config) #define HISI_PMU_EVENT_ATTR(_name, _config) \ - HISI_PMU_ATTR(_name, hisi_event_sysfs_show, (unsigned long)_config) + PMU_EVENT_ATTR_ID(_name, hisi_event_sysfs_show, _config) #define HISI_PMU_EVENT_ATTR_EXTRACTOR(name, config, hi, lo) \ static inline u32 hisi_get_##name(struct perf_event *event) \ -- 2.7.4