git: d752a5e82ac9 - main - linuxkpi: Fix `__ATTR_RO()` in <linux/sysfs.h>
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 13 Dec 2023 18:28:48 UTC
The branch main has been updated by dumbbell:
URL: https://cgit.FreeBSD.org/src/commit/?id=d752a5e82ac92603fadf82e7de75878e1f5d054a
commit d752a5e82ac92603fadf82e7de75878e1f5d054a
Author: Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
AuthorDate: 2023-12-08 21:57:24 +0000
Commit: Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
CommitDate: 2023-12-13 18:18:46 +0000
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
---
sys/compat/linuxkpi/common/include/linux/sysfs.h | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
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 } }