summaryrefslogtreecommitdiffstats
path: root/drivers/perf/cxl_pmu.c
diff options
context:
space:
mode:
authorLukas Wunner <lukas@wunner.de>2024-04-20 22:00:04 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-05-04 17:37:03 +0200
commitb91b73a43822566930490e5aa421ccb1900a2124 (patch)
tree63663bca2c8789cac302c3a19475bd8594d0557f /drivers/perf/cxl_pmu.c
parentIB/qib: Use device_show_string() helper for sysfs attributes (diff)
downloadlinux-b91b73a43822566930490e5aa421ccb1900a2124.tar.xz
linux-b91b73a43822566930490e5aa421ccb1900a2124.zip
perf: Use device_show_string() helper for sysfs attributes
Deduplicate sysfs ->show() callbacks which expose a string at a static memory location. Use the newly introduced device_show_string() helper in the driver core instead by declaring those sysfs attributes with DEVICE_STRING_ATTR_RO(). No functional change intended. Signed-off-by: Lukas Wunner <lukas@wunner.de> Link: https://lore.kernel.org/r/3a297850312b4ecb62d6872121de04496900f502.1713608122.git.lukas@wunner.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/perf/cxl_pmu.c')
-rw-r--r--drivers/perf/cxl_pmu.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/drivers/perf/cxl_pmu.c b/drivers/perf/cxl_pmu.c
index 308c9969642e..c41263c7fe5c 100644
--- a/drivers/perf/cxl_pmu.c
+++ b/drivers/perf/cxl_pmu.c
@@ -208,21 +208,10 @@ static int cxl_pmu_parse_caps(struct device *dev, struct cxl_pmu_info *info)
return 0;
}
-static ssize_t cxl_pmu_format_sysfs_show(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- struct dev_ext_attribute *eattr;
-
- eattr = container_of(attr, struct dev_ext_attribute, attr);
-
- return sysfs_emit(buf, "%s\n", (char *)eattr->var);
-}
-
#define CXL_PMU_FORMAT_ATTR(_name, _format)\
(&((struct dev_ext_attribute[]) { \
{ \
- .attr = __ATTR(_name, 0444, \
- cxl_pmu_format_sysfs_show, NULL), \
+ .attr = __ATTR(_name, 0444, device_show_string, NULL), \
.var = (void *)_format \
} \
})[0].attr.attr)