2021-05-28 06:36:08

by Yue Haibing

[permalink] [raw]
Subject: [PATCH v2 -next] perf: arm_spe: use DEVICE_ATTR_RO macro

Use DEVICE_ATTR_RO() helper instead of plain DEVICE_ATTR(),
which makes the code a bit shorter and easier to read.

Signed-off-by: YueHaibing <[email protected]>
---
v2: Fix build error

drivers/perf/arm_spe_pmu.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/perf/arm_spe_pmu.c b/drivers/perf/arm_spe_pmu.c
index e3711cb4c1b5..773285dd539f 100644
--- a/drivers/perf/arm_spe_pmu.c
+++ b/drivers/perf/arm_spe_pmu.c
@@ -231,15 +231,14 @@ static const struct attribute_group arm_spe_pmu_format_group = {
.attrs = arm_spe_pmu_formats_attr,
};

-static ssize_t arm_spe_pmu_get_attr_cpumask(struct device *dev,
- struct device_attribute *attr,
- char *buf)
+static ssize_t cpumask_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
{
struct arm_spe_pmu *spe_pmu = dev_get_drvdata(dev);

return cpumap_print_to_pagebuf(true, buf, &spe_pmu->supported_cpus);
}
-static DEVICE_ATTR(cpumask, S_IRUGO, arm_spe_pmu_get_attr_cpumask, NULL);
+static DEVICE_ATTR_RO(cpumask);

static struct attribute *arm_spe_pmu_attrs[] = {
&dev_attr_cpumask.attr,
--
2.17.1


2021-06-01 18:23:30

by Will Deacon

[permalink] [raw]
Subject: Re: [PATCH v2 -next] perf: arm_spe: use DEVICE_ATTR_RO macro

On Fri, 28 May 2021 14:17:38 +0800, YueHaibing wrote:
> Use DEVICE_ATTR_RO() helper instead of plain DEVICE_ATTR(),
> which makes the code a bit shorter and easier to read.

Applied to will (for-next/perf), thanks!

[1/1] perf: arm_spe: use DEVICE_ATTR_RO macro
https://git.kernel.org/will/c/f9e36b388a32

Cheers,
--
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev