git: 294553b022b1 - main - linuxkpi: Define `__ATTR_RO_MODE()` and `__ATTR_RW_MODE()`
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 20 Jun 2026 11:53:54 UTC
The branch main has been updated by dumbbell:
URL: https://cgit.FreeBSD.org/src/commit/?id=294553b022b1e775111365094a70041934d98501
commit 294553b022b1e775111365094a70041934d98501
Author: Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
AuthorDate: 2026-06-12 10:44:36 +0000
Commit: Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
CommitDate: 2026-06-20 10:34:45 +0000
linuxkpi: Define `__ATTR_RO_MODE()` and `__ATTR_RW_MODE()`
They are the same as their `__ATTR_RO()` and `_ATTR_RW()` equivalents
but they take the file mode as an extra argument.
We now use these new macros to redefine `__ATTR_RO()` and `__ATTR_RW()`
on top of them.
The amdgpu DRM driver started to use `__ATTR_RW_MODE()` in Linux 6.13.
Reviewed by: emaste
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57574
---
sys/compat/linuxkpi/common/include/linux/sysfs.h | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/sys/compat/linuxkpi/common/include/linux/sysfs.h b/sys/compat/linuxkpi/common/include/linux/sysfs.h
index 7c8c4e2e32b9..4aea46d6b120 100644
--- a/sys/compat/linuxkpi/common/include/linux/sysfs.h
+++ b/sys/compat/linuxkpi/common/include/linux/sysfs.h
@@ -64,12 +64,15 @@ struct attribute_group {
.attr = { .name = __stringify(_name), .mode = _mode }, \
.show = _show, .store = _store, \
}
-#define __ATTR_RO(_name) { \
- .attr = { .name = __stringify(_name), .mode = 0444 }, \
+#define __ATTR_RO_MODE(_name, _mode) { \
+ .attr = { .name = __stringify(_name), .mode = _mode }, \
.show = _name##_show, \
}
+#define __ATTR_RO(_name) __ATTR_RO_MODE(_name, 0444)
#define __ATTR_WO(_name) __ATTR(_name, 0200, NULL, _name##_store)
-#define __ATTR_RW(_name) __ATTR(_name, 0644, _name##_show, _name##_store)
+#define __ATTR_RW_MODE(_name, _mode) \
+ __ATTR(_name, _mode, _name##_show, _name##_store)
+#define __ATTR_RW(_name) __ATTR_RW_MODE(_name, 0644)
#define __ATTR_NULL { .attr = { .name = NULL } }
#define ATTRIBUTE_GROUPS(_name) \