sysfs: transparently handle const pointers in ATTRIBUTE_GROUPS()
To ease the constification process of 'struct attribute', transparently handle the const pointers in ATTRIBUTE_GROUPS(). A cast is used instead of assigning to .attrs_new as it keeps the macro smaller. As both members are aliased to each other the result is identical. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Link: https://patch.msgid.link/20251029-sysfs-const-attr-prep-v5-2-ea7d745acff4@weissschuh.net Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
f85d90dd8d
commit
964c93b1ee
@@ -287,7 +287,12 @@ static const struct attribute_group *_name##_groups[] = { \
|
|||||||
|
|
||||||
#define ATTRIBUTE_GROUPS(_name) \
|
#define ATTRIBUTE_GROUPS(_name) \
|
||||||
static const struct attribute_group _name##_group = { \
|
static const struct attribute_group _name##_group = { \
|
||||||
.attrs = _name##_attrs, \
|
.attrs = _Generic(_name##_attrs, \
|
||||||
|
struct attribute **: \
|
||||||
|
_name##_attrs, \
|
||||||
|
const struct attribute *const *: \
|
||||||
|
(void *)_name##_attrs \
|
||||||
|
), \
|
||||||
}; \
|
}; \
|
||||||
__ATTRIBUTE_GROUPS(_name)
|
__ATTRIBUTE_GROUPS(_name)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user