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

(cherry picked from commit d752a5e82ac92603fadf82e7de75878e1f5d054a)
This commit is contained in:
Jean-Sébastien Pédron 2023-12-08 22:57:24 +01:00 committed by Vladimir Kondratyev
parent af41c1bee4
commit 0b3e4b3cc9

View file

@ -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 } }