aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Sébastien Pédron <dumbbell@FreeBSD.org>2023-12-08 21:57:24 +0000
committerJean-Sébastien Pédron <dumbbell@FreeBSD.org>2023-12-13 18:18:46 +0000
commitd752a5e82ac92603fadf82e7de75878e1f5d054a (patch)
tree02bc9290414332a221ee9c44048160fad0a83c9b
parent509707e8b6b7326c7f4793b6e291f0a8e6939412 (diff)
downloadsrc-d752a5e82ac92603fadf82e7de75878e1f5d054a.tar.gz
src-d752a5e82ac92603fadf82e7de75878e1f5d054a.zip
linuxkpi: Fix `__ATTR_RO()` in <linux/sysfs.h>
[Why] The passed structure may not have a `.store` field. This is the case in the amdgpu DRM driver starting with Linux 5.18. Reviewed by: manu Approved by: manu Differential Revision: https://reviews.freebsd.org/D43023
-rw-r--r--sys/compat/linuxkpi/common/include/linux/sysfs.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/compat/linuxkpi/common/include/linux/sysfs.h b/sys/compat/linuxkpi/common/include/linux/sysfs.h
index 8b4160453a3a..4a65095d9eb1 100644
--- a/sys/compat/linuxkpi/common/include/linux/sysfs.h
+++ b/sys/compat/linuxkpi/common/include/linux/sysfs.h
@@ -54,7 +54,10 @@ struct attribute_group {
.attr = { .name = __stringify(_name), .mode = _mode }, \
.show = _show, .store = _store, \
}
-#define __ATTR_RO(_name) __ATTR(_name, 0444, _name##_show, NULL)
+#define __ATTR_RO(_name) { \
+ .attr = { .name = __stringify(_name), .mode = 0444 }, \
+ .show = _name##_show, \
+}
#define __ATTR_WO(_name) __ATTR(_name, 0200, NULL, _name##_store)
#define __ATTR_RW(_name) __ATTR(_name, 0644, _name##_show, _name##_store)
#define __ATTR_NULL { .attr = { .name = NULL } }