diff options
| author | Jean-Sébastien Pédron <dumbbell@FreeBSD.org> | 2026-06-12 10:44:36 +0000 |
|---|---|---|
| committer | Jean-Sébastien Pédron <dumbbell@FreeBSD.org> | 2026-06-20 10:34:45 +0000 |
| commit | 294553b022b1e775111365094a70041934d98501 (patch) | |
| tree | 47409b2ea15f4209e33eb38b970583a94c1eaf2e | |
| parent | 4831a8d792d4ac2cbf4d49d9d220947fb53e2e86 (diff) | |
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
| -rw-r--r-- | sys/compat/linuxkpi/common/include/linux/sysfs.h | 9 |
1 files 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) \ |
